In general you don't.
If you need a Tx, you use session.getTransaction()
If you need to register a synchronization for a given transaction
session
.getTransaction
().registerSynchronization(javax.transaction.Synchronization)
If you really need the TM which is not always configured, then you
need to use the internal Hibernate contract
SessionFactoryImplementor.getTransactionManager() (can be null).
On 17 août 09, at 08:09, Galder Zamarreno wrote:
Hmmm, potentially from Hibernate. Adding hibernate-dev to the
discussion. What's the correct way to get hold of the transaction
manager in a Hibernate env?
org
.hibernate
.transaction
.TransactionManagerLookupFactory.getTransactionManager(Properties
props)
On 08/17/2009 02:00 PM, Manik Surtani wrote:
> Why do you need to get the TM from Infinispan? Surely there would be
> other ways to get this, either from Hibernate or from JNDI?
>
> On 17 Aug 2009, at 12:38, Galder Zamarreno wrote:
>
>> Hi,
>>
>> I'm currently working on the query cache region and calling get() on
>> query cache region should suspend current transaction. With JBC,
>> we used
>> to call the following to get the transaction manager:
>>
>> cache.getConfiguration().getRuntimeConfig().getTransactionManager();
>>
>> However, this API is not available in Infinispan. What should be the
>> correct way to get the transaction manager?
>> TestingUtil.geTransactionManager() includes a method to do so but I
>> don't think such method should be used for anything other than
>> testing.
>>
>> Thoughts?
>> --
>> Galder Zamarreño
>> Sr. Software Engineer
>> Infinispan, JBoss Cache
>> _______________________________________________
>> infinispan-dev mailing list
>> infinispan-dev(a)lists.jboss.org
>>
https://lists.jboss.org/mailman/listinfo/infinispan-dev
>
> --
> Manik Surtani
> manik(a)jboss.org
> Lead, Infinispan
> Lead, JBoss Cache
>
http://www.infinispan.org
>
http://www.jbosscache.org
>
>
>
>
--
Galder Zamarreño
Sr. Software Engineer
Infinispan, JBoss Cache
_______________________________________________
hibernate-dev mailing list
hibernate-dev(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/hibernate-dev