I am using Hibernate 3.1 on MySQL community server edition 5.0.18.
I am trying to load an entity from DB using the primary key. My code is fairly simple.
Session session = null;
Transaction tx = null;
try {
session = HibernateUtil.currentSession();
tx = session.beginTransaction();
abcDAO dao = abcDAO.getInstance();
Abc obj = dao.get(primaryKey, session);
} catch (Exception ex) {
return false;
} finally {
if (session != null) {
session.close();
}
}
The key I am trying to load is present in DB and I can connect to MySQL and confirm its presence. However, when reading using Hibernate, it does not load any data. Hibernate returns with no result.
Have any body seen this kind of behavior?
Any help is greatly appreciated.
Regards,
KG
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version:
Mapping documents:
Code between sessionFactory.openSession() and session.close():
Full stack trace of any exception that occurs:
Name and version of the database you are using:
The generated SQL (show_sql=true):
Debug level Hibernate log excerpt:
Problems with Session and transaction handling?
Read this:
http://hibernate.org/42.html