Hi all,
I have a Class 'A' mapped to Table_A and classes 'B' and 'C' mapped to Table_B and Table_C respectively. The PK in Table_B and Table_C have a foreign key relationship to Table_A.
I fetched an object of 'A' from database using getHibernateTemplate().get(). But when I check for values of 'B' or 'C' inside object 'A', I dont find them. I tried putting getHibernateTemplate().clear() and getHibernateTemplate().flush() after the getHibernateTemplate().get() statement as below.
Code:
getHibernateTemplate().get(A.class, A_ID);
getHibernateTemplate().flush();
getHibernateTemplate().clear();
When I did this, I got it working and I could get objects of B and C populated inside A.
I have written an Interceptor to keep the history of updates. I am getting a NullpointerException inside onflushDirty() because previousState array is coming as null. I doubt this is due to the flush() and clear() that I wrote above. This is making the session forget about the previousState it seems.
Can anyone suggest me a solution to this problem ?
Thanks in advance.
vinodtr
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