[hibernate-issues] [Hibernate-JIRA] Updated: (HHH-3358) Enable JTATransactionFactory and JTATransaction factory to work without JNDI

Les Hazlewood (JIRA) noreply at atlassian.com
Wed Jun 25 17:22:19 EDT 2008


     [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-3358?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Les Hazlewood updated HHH-3358:
-------------------------------

    Attachment: HHH-3358.patch

The patch contains the fix.

Here is a summary:

JTATransaction's constructor was changed from:

JTATransaction( InitialContext ctx, String userTransactionName, JDBCContext jdbcCtx, TransactionFactory.Context txnFctryCtx )

to

JTATransaction( UserTransaction ut, JDBCContext jdbcCtx, TransactionFactory.Context txnFctryCtx );

This imposes the burden of the UserTransaction lookup from JNDI on the JTATransactionFactory.  But, since the JTATransactionFactory already performs the exact same lookup when checking the transaction status, two benefits from this move occur:

1) The UT JNDI lookup is consolidated into a single location, used in two different places
2) The JTATransaction now has no compile or runtime dependencies on JNDI.

The modification to JTATransactionFactory retain backwards compatibility, but the UserTransaction lookup is delegated to a helper method:

UserTransaction getUserTransaction( InitialContext ctx, String userTransactionName );

This allows standalone TransactionManagers (Atomikos, JOTM, etc) to subclass JTATransactionFactory, override this method and essentially ignore the method arguments.  They can then acquire the UserTransaction object in an implementation specific manner.  Pretty clean fix.

> Enable JTATransactionFactory and JTATransaction factory to work without JNDI
> ----------------------------------------------------------------------------
>
>                 Key: HHH-3358
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3358
>             Project: Hibernate3
>          Issue Type: Improvement
>          Components: core
>    Affects Versions: 3.2.x, 3.3.0.CR2, 3.3.x
>            Reporter: Les Hazlewood
>            Assignee: Les Hazlewood
>             Fix For: 3.2.6, 3.2.x, 3.3.0.CR1, 3.3.0.CR2, 3.3.x
>
>         Attachments: HHH-3358.patch
>
>   Original Estimate: 1 hour
>  Remaining Estimate: 1 hour
>
> Per issue HHH-3110, a JNDI lookup occurs when attempting to acquire a UserTransaction.  This causes problems for 'standalone' JTA TransactionManagers that don't require JNDI.
> By abstracting the JNDI lookup to a method, that method could be overridden to acquire the UserTransaction in an implementation specific manner if so desired.
> I'll attach the patch after I create the issue.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the hibernate-issues mailing list