Is it using some kind of byte codes modification to the original classes? Or, maybe Hibernate get the dirty state by compare the given object with previously persisted version? I’m having a problem with hashCode() and equals() methods for complicated objects. I feel it would be very slow to compute hash…
Tag: hibernate
Hibernate : How override an attribute from mapped super class
The generic entity, super class: The pojo: I try to use thoses annotations : @AttributeOverride, @Id, … but It doesn’t work. Can you help me? I want to override the attribute “id” to specify another column name and a sequence by pojo/table. What is the best way to do that? Answer Try t…
Mapping array with Hibernate
Can you please help me to map this class using Hibernate? I’m using PostgreSQL and the column type in the table is integer[] How my array should be mapped? Answer I have never mapped arrays to hibernate. I always use collections. So, I have slightly changed you class:
Hibernate @ManyToOne references an unknown entity
I am receiving the following Hibernate Exception: @OneToOne or @ManyToOne on Matchup.awayTeam references an unknown entity: Team The simplified Matchup class looks like this: The simplified Team class looks like this: Notes: Both Matchup and Team have subclasses. I’m not sure if this impacts the situati…
Difference using @Id and @EmbeddedId for a compound key
I’ve created an entity that uses @Id to point to an @Embeddable compound key. Everything I believe works fine as is. However, after switching @Id to @EmbeddedId everything continues to work fine as far as I can tell. Before: After: Is there a difference between using the @Id and @EmbeddedId annotations …
Hibernate : dynamic-update dynamic-insert – Performance Effects
Using dynamic-update or dynamic-insert has positive, though generally slight only on performance, as also mentioned by http://www.mkyong.com/hibernate/hibernate-dynamic-update-attribute-example/ But the reference documentation mentions that this could have negative performance effects also as mentioned below …
How to monitor slow SQL queries executed by JPA and Hibernate
Is there any Hibernate property I could set to see all the slow queries? I’, interested in queries that take too much time to return the result set. I’m using Spring with Hibernate, configured via an applicationContext.xml Spring configuration file. Answer I have 2 suggestions: you could use Oracl…
Persisting set of Enums in a many-to-many unidirectional mapping
I’m using Hibernate 3.5.2-FINAL with annotations to specify my persistence mappings. I’m struggling with modelling a relationship between an Application and a set of Platforms. Each application is available for a set of platforms. From all the reading and searching I’ve done, I think I need …
Difference between FetchType LAZY and EAGER in Java Persistence API?
What is the difference between FetchType.LAZY and FetchType.EAGER in Java Persistence API? Answer Sometimes you have two entities and there’s a relationship between them. For example, you might have an entity called University and another entity called Student and a University might have many Students: …
What is the “owning side” in an ORM mapping?
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 ano…