星期六 2004年07月03日
Never use hibernate JTATransaction implemention because it's wrong
Commonly, JTATransaction shall be used as
the following:
Lookup
UserTransaction and begin transaction
get Connection
from DS and do something and close the connection
get Connection
from DS and do something and close the connection
...
commit or
roolback
So, you can see only the connection as
opened after jtaTransaction started will be managed by the Transaction.
But In Hibernate, The Transaction is new by
a parameter Session.
JTATransaction(SessionImplementor session)
You can see the JTATransaction is based on
the session.
So if the session has already connected,
the connection can't been managed by the transaction.
So it is realy realy wrong.
The right flow to use JTATransaction
through hibernate shall like the following:
Lookup UserTransaction
and begin transaction
get hibernate session
and do something and flush
...
commit or rollback
So the better way is use cmt SessionBean.
七月 03, 2004 01:06 上午 GMT+08:00
Permalink
该日志评论功能被禁用了。