180
votes
6answers
187k views
Hibernate hbm2ddl.auto possible values and what they do?
I really want to know more about the update, export and the values that could be given to hbm2ddl.auto.
I need to know when to use the update and when not? And what is the alternative?
These are ...
120
votes
11answers
81k views
Hibernate vs JPA vs JDO - pros and cons of each?
I'm familiar with ORM as a concept, and I've even used nHibernate several years ago for a .NET project; however, I haven't kept up with the topic of ORM in Java and haven't had a chance to use any of ...
117
votes
14answers
64k views
Hibernate: Criteria vs. HQL
What are the pros and cons of using Criteria or HQL? The Criteria API is a nice object-oriented way to express queries in Hibernate, but sometimes Criteria Queries are more difficult to ...
110
votes
23answers
14k views
Weaknesses of Hibernate
I would like to know which are the weak points of Hibernate 3. This is not pretended to be a thread against Hibernate. I think it will be a very useful knowledge for decide if Hibernate is the best ...
106
votes
14answers
51k views
Hibernate: hbm2ddl.auto=update in production?
Is it okay to run Hibernate applications configured with hbm2ddl.auto=update to update the database schema in a production environment?
86
votes
5answers
58k views
Hibernate show real SQL [duplicate]
if I set
<property name="show_sql">true</property>
in my hibernate.cfg.xml configuration file in the console I can see the SQL.
But it's not real SQL... Can I see the SQL code that ...
76
votes
4answers
37k views
Hibernate cannot simultaneously fetch multiple bags
Hibernate throws this exception during SessionFactory creation:
org.hibernate.loader.MultipleBagFetchException: cannot simultaneously fetch multiple bags
This is my test case:
Parent.java
...
68
votes
9answers
12k views
The JPA hashCode() / equals() dilemma
There have been some discussions here about JPA entities and which hashCode()/equals() implementation should be used for JPA entity classes. Most (if not all) of them depend on Hibernate, but I'd ...
63
votes
6answers
55k views
How do we count rows using Hibernate?
For example, if we have a table Books, how would we count total number of book records with hibernate?
Thanks
61
votes
8answers
55k views
How do you do a limit query in HQL
In Hibernate 3, is there a way to do the equivalent of the following MySql limit in HQL.
select * from a_table order by a_table_column desc limit 0, 20;
I don't want to use setMaxResults if ...
59
votes
2answers
54k views
object references an unsaved transient instance - save the transient instance before flushing
I receive following error when i save the object using hibernate
object references an unsaved transient
instance - save the transient instance
before flushing
Can you help me ?
58
votes
5answers
34k views
What's new in Hibernate 4?
I just saw that a beta of Hibernate 4 was released. What's new in 4 compared to 3(.6)? I couldn't find this info in the beta announcement, nor when Googling the title of this question.
57
votes
8answers
71k views
JPA CascadeType.ALL does not delete orphans
I am having trouble deleting orphan nodes using JPA with the following mapping
@OneToMany (cascade = CascadeType.ALL, fetch = FetchType.EAGER, mappedBy = "owner")
private List<Bikes> bikes;
I ...
56
votes
3answers
28k views
Exception NoClassDefFoundError for CacheProvider
I'm kind of new in Spring and hibernate so I'm trying to implement some simple web application based on Spring 3 + hibernate 4
while I start tomcat I have this exception:
...
56
votes
4answers
17k views
apache commons equals/hashcode builder
I'm curious to know, what people here think about using
org.apache.commons.lang.builder EqualsBuilder/HashCodeBuilder
for implementing the equals/hashcode? Would it be a better practice than writing ...