201
votes
6answers
204k 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 ...
124
votes
11answers
85k 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 ...
124
votes
15answers
67k 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 ...
115
votes
15answers
53k 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?
112
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 ...
92
votes
5answers
67k 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 ...
84
votes
4answers
43k 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 ...
73
votes
6answers
61k 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
69
votes
9answers
13k 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 ...
64
votes
4answers
61k 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 ?
63
votes
7answers
76k views

How do synchronized static methods work in Java?

If I have a util class with static methods that will call hibernate functions to accomplish basic data access. I am wondering if making the method synchronized is the right approach to ensure ...
63
votes
8answers
60k 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 ...
63
votes
4answers
20k 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 ...
62
votes
12answers
50k views

What is the proper way to re-attach detached objects in Hibernate?

I have a situation in which I need to re-attach detached objects to a hibernate session, although an object of the same identity MAY already exist in the session, which will cause errors. Right now, ...
61
votes
5answers
39k views

Is buildSessionFactory() deprecated in hibernate 4?

When I updated version of Hibernate from 3.6.8.final to 4.0.0.final I got a warning about deprecated method buildSessionFactory() in this line: private static final SessionFactory sessionFactory = ...

1 2 3 4 5 903
15 30 50 per page