Daniel HERLEMONT wrote:
>
> Hello
>
> I have developed a thin persistent layer on top of JDBC interface.
> This persistent layer try to stick with the ODMG (www.odmg.org) for
> transactions: transactions are attached to the current thread, so that I can
> retrieve the current transaction by Transaction.current(), anywhere without
> passing the transaction object.
We have the same design (ODMG on top of JDBC) and we're simply using
XADataSource/XAResource.
<open source>
You might want to check out http://castor.exolab.org
</open source>
The ODMG layer obtains a connection through the JNDI, which is
automatically enlisted in the current transactions, so you're covered as
far as the database goes.
It also registers itself as an XAResource, so the EJB server will notify
it when the transaction commits/rollsback. You can also use
Synchronization for that.
> I saw that the user transaction has some nice thing such as setRollbackOnly.
> I would also expect some other things such as readonly transactions, ...
Currently there is no way to mark a transaction as read-only with the
JTA interface.
> Any hint (I am a newbiee in EJB)
>
> BTW there are ohter advantage of doing this encapsulation: my Transaction
> object has a finalizer that try to rollback the transaction and give back
> the connection to my pool, then I can program wihtout fear of keeping
> running connections and locks, even in case of exceptions
No need to worry about the connections. When the transaction is over,
all the connections you acquired through JNDI will be
committed/rolledback.
IF you are sticking a transaction context to the current thread,
finalizer should not be called when you expect it. The transaction
should be committed/rolledback through the ODMG API (explicitly) or by
registered as XAResource/Synchronization with the JTA.
arkin
>
> I supposed that EJB managed transactions could provide the same thing, but i
> am not sure of that.
>
> ===========================================================================
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff EJB-INTEREST". For general help, send email to
> [EMAIL PROTECTED] and include in the body of the message "help".
--
----------------------------------------------------------------------
Assaf Arkin www.exoffice.com
CTO, Exoffice Technologies, Inc. www.exolab.org
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".