[hibernate-dev] Is this a bug or am I just handling it the wrong way ?

Chris Bredesen cbredesen at redhat.com
Wed Mar 12 09:56:22 EDT 2008


joël Winteregg wrote:
> Hello Chris,
>
> Thanks for your email. As you will notice I posted a related question on
> http://opensource.atlassian.com/projects/hibernate/browse/HHH-3110 this
> morning.
>   
>   
>> I haven't looked closely enough to comment on the query problem but I 
>> can confirm that your assessment above is correct.   JTATransaction has 
>> and always has had a dependency on JNDI.  It's only been recently 
>> uncovered because a) we changed how/when the transaction was 
>> instantiated and b) it turns out some folks are using JTA services 
>> outside the container that don't bind to JNDI.  If you want to use such 
>> a service, you're exactly right - also use a JNDI service or create a 
>> TransactionFactory/Transaction combo that doesn't need JNDI.
>>     
>
> The strange thing is that I'm also using JNDI with my Transaction
> Manager - System.setProperty("java.naming.factory.initial",
> "org.apache.naming.java.javaURLContextFactory");.
> And Hibernate is fetching the JTA service using the following lookup
> class:
>
> http://docs.codehaus.org/display/BTM/Hibernate#Hibernate-Transactionmanagerlookupclass
>
> Using the following Hibernate config:
>
> <property name="transaction.manager_lookup_class">
>  db.BitronixTransactionManagerLookup
> </property>
>
> <property name="transaction.factory_class">
>  org.hibernate.transaction.JTATransactionFactory
> </property>
>
> As I understood from your post on issue HHH-3110, Hibernate should not
> use a lookup class anymore but create (instance) the Transaction
> Manager. Am I right ? If so, to do this, I should implement a
> org.hibernate.transaction.TransactionFactory for my transaction
> manager ?

You can do whichever works.  Using the default JTATransaction, you'll 
need JNDI.  But you can alternatively provide your own Impl that does 
not rely on JNDI.  Your choice really, and all this is pluggable so 
Hibernate won't care.

-Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/hibernate-dev/attachments/20080312/fff3a08a/attachment.html 


More information about the hibernate-dev mailing list