During a Hibernate Session, I am loading some objects and some of them are loaded as proxies due to lazy loading. It’s all OK and I don’t want to turn lazy loading off. But later I need to send some of the objects (actually one object) to the GWT client via RPC. And it happens that this concrete object is
Tag: jpa
JPA OneToMany not deleting child
I have a problem with a simple @OneToMany mapping between a parent and a child entity. All works well, only that child records are not deleted when I remove them from the collection. The parent: The child: If I now delete and child from the childs Set, it does not get deleted from the database. I tried nullifying the child.parent
What is a natural identifier in Hibernate?
While reading through the Hibernate documentation, I keep seeing references to the concept of a natural identifier. Does this just mean the id an entity has due to the nature of the data it holds? E.g. A user’s name + password + age + something are used as a compound identitifier? Answer In Hibernate, natural keys are often used for
How to obtain CURDATE() / NOW() on a JPA named query?
I want to do a select from table where date = TODAY, on mysql that would be where date > CURDATE(), how do I do this on a JPA named query? Answer That depends on your JPA provider. Hibernate, for example, supports current_date function:
Does JPA support mapping to sql views?
I’m currently using Eclipselink, but I know now days most JPA implementations have been pretty standardized. Is there a native way to map a JPA entity to a view? I am not looking to insert/update, but the question is really how to handle the @Id annotation. Every entity in the JPA world must have an ID field, but many of