Hibernate transaction missing problem

"이희승 (Trustin Lee)" trustin at gmail.com
Thu Jun 25 07:20:08 EDT 2009


The Hibernate session must start and terminate in the same thread.  To
do so, the session must start and terminate in the same ChannelHandler
method.  Otherwise, your session will be lost because ChannelHandler
might be called from a different thread.

HTH,
Trustin

On 2009-06-23 오후 11:32, infectedrhythms wrote:
> 
> Make sure you are not sharing the hibernate session in the handler I.e: you
> handler should be stateless.
> 
> lpeagle wrote:
>>
>> Hi,
>>
>> My business layer is using Dao with Hibernate, it works fine with unit
>> tests. But when I try to call it from my Netty handler, I always got
>> something like this:
>> org.hibernate.HibernateException: createCriteria is not valid without
>> active transaction
>>
>> Any clue that why the transaction is missing even after I have called
>> beginTransaction on the session?
>>
>> Configuration of hibernate:
>> <property
>> name="transaction.factory_class">org.hibernate.transaction.JDBCTransactionFactory</property>
>>                 <property
>> name="current_session_context_class">thread</property>
>>
>> Thanks a lot!
>>
>> Bill 
>>
> 


-- 
— Trustin Lee, http://gleamynode.net/

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 259 bytes
Desc: OpenPGP digital signature
Url : http://lists.jboss.org/pipermail/netty-users/attachments/20090625/e494e5c5/attachment.bin 


More information about the netty-users mailing list