-
Apr 20th, 2009, 10:30 AM
#1
hibernate does not perssist with hibernateTemplate.save() -- Please help
Hi,
I desperately need help with the problem I have with hibernate session data persisting.
The problem is that sometimes the save() works and data is persisted into the database, and in occassion it is not.
I do not get any errors. I have placed in logs before and after the transaction, and there are no errors in the logs.
This is very frustrating.
I am using Spring 2 + hibernate 3.2.
The persistence of the hibernate objects are within the transaction.
Below is the part of the code:
-----------------------------------------------------------------------------------
HibernateTransactionManager transactionManager = (HibernateTransactionManager) ctx.getBean("transactionManager");
DefaultTransactionDefinition def = new DefaultTransactionDefinition();
def.setPropagationBehavior(TransactionDefinition.P ROPAGATION_REQUIRED);
TransactionStatus status = transactionManager.getTransaction(def);
........
I use hibernateTemplate.save() to store the data.
....
//I am clearing the session before commit
Session session = SessionFactoryUtils.getSession(getSessionFactory() , false);
session.flush();
session.clear();
transactionManager.commit(status);
______________________________________________
I am at loss, please help.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules