Skip to content
Advertisement

Tag: hibernate

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 situation. Both Matchup and Team are listed in my persistence.xml as being included. If I

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 when referencing a compound key? Answer I’m actually surprised

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 in http://docs.jboss.org/hibernate/core/3.3/reference/en/html/mapping.html#mapping-declaration-class : Although these settings can increase performance in some cases, they can actually decrease performance in others. Can anybody please suggest some example/scenario mentioning negative

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 Oracle’s Statspack. you could use some kind of JDBC proxy driver logging

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: The University entity might have some basic properties such as id, name, address, etc. as

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 another entity that has one-to-one multiplicity.

Advertisement