Tagged Questions
109
votes
6answers
132k views
Hibernate question 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 ...
100
votes
23answers
10k 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 ...
93
votes
12answers
54k 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 ...
91
votes
10answers
65k 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 ...
83
votes
14answers
41k 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?
60
votes
6answers
31k views
hibernate show real sql
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 ...
51
votes
8answers
7k 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 ...
46
votes
8answers
56k 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 ...
46
votes
12answers
14k views
Hibernate, iBatis, JEE or other Java ORM tool
We're in the process of planning a large, enterprise application. We're focusing our efforts on evaluating hibernate after experiencing the pains of J2EE.
It looks like the new JEE API is simpler. ...
45
votes
19answers
29k views
Light weight alternative to Hibernate?
I have a single user java program that I would like to have store data in a light weight database such as Derby or Sqlite. I would like to use a data abstraction layer in my program. Hibernate appears ...
45
votes
6answers
34k 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
42
votes
4answers
9k 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 ...
41
votes
8answers
39k 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 ...
39
votes
9answers
47k views
Creation timestamp and last update timestamp with Hibernate and MySQL
For a certain Hibernate entity we have a requirement to store its creation time and the last time it was updated. How would you design this?
What data types would you use in the database (assuming ...
38
votes
7answers
54k 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 ...