I dont know anything about Spring Hibernate template. But I use a class
HibernateUtil from book Manning: Hibernate in Action (or Java perzistnce
with Hibernate, it is a 2nd edition of first book) and it works super. I
have only one SessionFactory in JVM, and only one Session and Transaction in
every  thread. U can look for it. 

Fero


pokkie wrote:
> 
> Hey Vincenzo , 
> 
> thanks for your response. have tried it, but still having the problem.
> will have a look again
> 
> 
> Vincenzo Vitale wrote:
>> 
>> Have you the same problem using directly the Hibernate session?
>> 
>> It's also interesting to read this article about the Hibernate template:
>> 
>> http://blog.interface21.com/main/2007/06/26/so-should-you-still-use-springs-hibernatetemplate-andor-jpatemplate/
>> 
>> I remember I had in the past similar porblems with the hibernate
>> template...  actually I didn't understand the problems I was
>> experiencing but after having red the article I tried to use directly
>> the session and it worked.
>> 
>> My code now looks in this way:
>> 
>> public Account saveOrUpdate(Account account) {
>>         account.setDateModified(new Date());
>>         getSession().saveOrUpdate(account);
>> 
>>         //Maybe flush and refresh can be avoided...
>>         getSession().flush();
>>         getSession().refresh(account);
>>         return (Account) account;
>> }
>> 
>> Hope this helps.
>> 
>> 
>> Ciao,
>> V.
>> 
>> 
>> On 8/29/07, pokkie <[EMAIL PROTECTED]> wrote:
>>>
>>> i have a button on a form, when clicked it saves a object to the
>>> database
>>> (via Spring's HibernateTemplate),
>>> but for some reason when i look in the db it is not there, until i go to
>>> another page, then suddenly the object is being written into the
>>> database.
>>>
>>> i am presuming that the session is not being flushed, until i go to
>>> another
>>> page, so i added a flush
>>> to my save method, but still experience the same behaviour.
>>>
>>> either the session or i am thinking that it might be running in a long
>>> running transaction,
>>> which only ends once a new request is coming in, and subsequently write
>>> the
>>> data to the database.
>>>
>>> any thoughts?
>>>
>>>  -- pokkie
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Hibernate-Spring-transaction-problem-tf4347663.html#a12386692
>>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>
>>>
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>> 
>> 
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Hibernate-Spring-transaction-problem-tf4347663.html#a12392329
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to