What exactly does the owning side mean? What is an explanation with some mapping examples (one to many, one to one, many to one)? The following text is an excerpt from the description of @OneToOne in Java EE 6 documentation. You can see the concept owning side in it. Defines a single-valued association to another entity that has one-to-one multiplicity.
Tag: orm
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 map a PostgreSQL array with Hibernate
Has anyone successfully mapped a numeric array in PostgreSQL to a numeric array in Java via Hibernate? SQL: Mapping: Class: I get an exception when querying the table. Answer Hibernate does not support database arrays (e.g. ones mapped to java.sql.Array) out of the box. array and primitive-array types provided by Hibernate are for mapping Java arrays into backing table –
How should equals and hashcode be implemented when using JPA and Hibernate
How should model class’s equals and hashcode be implemented in Hibernate? What are the common pitfalls? Is the default implementation good enough for most cases? Is there any sense to use business keys? It seems to me that it’s pretty hard to get it right to work in every situation, when lazy fetching, id generation, proxy, etc are taken into
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