Skip to content
Advertisement

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

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

Advertisement