orm

NHibernate. Current server datetime()

Hello. At my domains for audit purposes I've got UpdatedOn property. Now I set it at client before updating to DateTime.Now. But a lot of users have incorrect datetime at theirs machines, so i need use server datetime (getdate(),now()...) How can i implement this strategy? ...

Is there something like SqlAlchemy's SqlSoup for Java?

I'm looking for a Java ORM that works from database reflection - I need to just point it at a DB, and start being able to walk through the entire set of tables, etc. Ideas? ...

Can we use MongoDB with ORMs we used to use with relational databases, such as linq2sql, entity framework, subsonic,...?

I want to know if its possible based on your experience to use our previous experiences using .net ORMs with nosql db such as MongoDB. And also if you know samples doing this please refer in your answer. ...

Why is an oracle sequence named hibernate_sequence being created with JPA using Hibernate with the Oracle 10g dialect?

All my entities use this type of @Id @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "MYENTITY_SEQ") @SequenceGenerator(name = "MYENTITY_SEQ", sequenceName = "MYENTITY_SEQ") @Column(name = "MYENTITY", nullable = false) private Long id; Or @Id @Column(name = "MYENTITY") I find that an oracle sequence named hibern...

Doctrine generate-migrations-diff and migrate

Hi guys, I have tried to execute the cli command ./doctrine generate-migrations-diff and a version file has been created correctly in the right folder. The message is: generate-migrations-diff - Generated migration classes successfully from difference Then I try to execute another cli command ./doctrine migrate and a message appears t...

Doctrine 1.2 Column Naming Conventions for Many To Many Relationships

I'm working with an existing database schema, and trying to setup two Doctrine models with a Many to Many relationship, as described in this document When creating tables from scratch, I have no trouble getting this working. However, the existing join tables use a different naming convention that what's described in the Doctrine docume...

Hibernate and Child Objects (add versus clear)

Lets say I have domain model with Automobile and Wheels. Wheels is a List of Wheels Wheels has a many-to-one relationship to Automobile. If I get an object back from Hibernate and it has 4 wheels. I take that object remove the 4 wheels and add 4. And then Save. If I ask Hibernate for the object again and it returns an auto with 8 wheels...

Unique items in Hibernate collections

I have defined a collection in Hibernate like this: ... public class Item { ... @ElementCollection List<Object> relatedObjects; } It creates a mapping table with colums item_id and object_id. The problem is that object_id seems to be unique. In other words I can not have two different items being related to the same objec...

ORM vs SQL XML, very simple middle-tier

I know it is rather heated question. But anyway I'd like to hear opinions of those in Stackoverflow. Given that XML support is quite good in SQL Server 2005/2008, and there's no concern about database independency, why one need Linq-to-SQL, Entity Framework, NHibernate and the likes, which are quite complex and awkward in advanced use-ca...

Kodo / openjpa data cache watermark settings?

I'm trying to find information on what triggers a data cache cleardown in kodo / openjpa. I'm guessing there is a high watermark - at which point the cache will clear down data. Does it just remove a single item once you hit your cache size limit, or a whole load of stuff? Or maybe there is no clear down, and you simply get an error w...

Hibernate sequence on oracle, @GeneratedValue(strategy = GenerationType.AUTO)

I'm usign @GeneratedValue(strategy = GenerationType.AUTO) to generate and id on my entity. I don't now how it works, but on my chils table, generates id values, that follow the parent sequence. //parent table @Entity @Table(name="parent") public class Parent { @Id @GeneratedValue(strategy = GenerationType....

Unable to compile and create maven project for hibernate

I am trying to create a Eclipse project from Hibernate tutorials under path \hibernate-distribution-3.5.3-Final\project\tutorials\eg using command line mvn eclipse:eclipse. But i am getting this error Reason: POM 'org.jboss.maven.plugins:maven-jdocbook-style-plugin' not found in repository: Unable to download the artifact from any repos...

Hibernate triggering constraint violations using orphanRemoval

I'm having trouble with a JPA/Hibernate (3.5.3) setup, where I have an entity, an "Account" class, which has a list of child entities, "Contact" instances. I'm trying to be able to add/remove instances of Contact into a List<Contact> property of Account. Adding a new instance into the set and calling saveOrUpdate(account) persists every...

How to create custom query for CollectionOfElements

Hi. I have problems creating a custom query. This is what entities: @Entity public class ApplicationProcess { @CollectionOfElements private Set defaultTemplates; //more fields } And Template.java @Embeddable @EqualsAndHashCode(exclude={"used"}) public class Template implements Comparable<Template> { @Setter priv...

Hibernate: Walk millions of rows and don't leak memory

The below code functions, but Hibernate never lets go of its grip of any object. Calling session.clear() causes exceptions regarding fetching a joined class, and calling session.evict(currentObject) before retrieving the next object also fails to free the memory. Eventually I exhaust my heap space. Checking my heap dumps, StatefulPersis...

Can Hibernate generate uppercase SQL?

Hi, can Hibernate generate uppercase SQL? I.e. some option which would make it send SELECT table1_.prop1_ FROM my_table AS table1_; instead of current select table1_.prop1_ from my_table as table1_; which I consider far less readable, esp. for long queries HBN tends to spit. See also https://forum.hibernate.org/viewtopic.php?f=1&...

Update OneToMany list after entity save in Hibernate

Hi all, i have relationship: // In A.java class @OneToMany(mappedBy="a", fetch=FetchType.LAZY) @Cascade(CascadeType.SAVE_UPDATE) private List<B> bList; // In B.java class @ManyToOne(fetch=FetchType.LAZY) @JoinColumn(name="id_a") @Cascade(CascadeType.SAVE_UPDATE) private A a; Now look this: A a=new A(); // setting A B b=new B(); // ...

MySQLSyntaxErrorException though everything seems fine (Hibernate)

I have a Project entity and a Group entity. I can get a Project by name using the following getter method from DAO: public Project getProject(String name){ Project project = null; DetachedCriteria criteria = DetachedCriteria.forClass(Project.class); criteria.add(Restrictions.eq("name", name)); List<Project> projects = g...

How to use multilanguage database schema with ORM?

Good day! I'm searching for the best way to implement multilanguage database schema, the approach I use is the same as here: http://stackoverflow.com/questions/929410/what-is-best-practices-for-multilanguage-database-design (one table with language neutral data and one for all translation). It seems to be good and clean and doesn't limi...

hibernate generator won't insert with uniqueidentifier

I'm trying to map an entity using Hibernate Annotations, so that when a record is created and saved (via cascade), an ID is automatically generated. With my current setup (or a few others I've tried) I get the following error: ...org.hibernate.exception.ConstraintViolationException: could not insert: [com.gorkwobbler.shadowrun.karm...