-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: persistence.xml loaded before Spring on Unix/Weblogic?
PostPosted: Fri Nov 06, 2009 8:24 am 
Newbie

Joined: Fri Nov 06, 2009 6:05 am
Posts: 12
In a the Spring forum thread http://forum.springsource.org/showthread.php?t=80015 I described a problem that seems to boil down to the fact that on Unix/Weblogic persistence.xml seems to be loaded by Hibernate before the Spring entity manager config is applied. Is there a sensible explanation for this?

In short...

The Spring config properly configures the transaction manager lookup for Hibernate like so:
Code:
<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
    ...
<property name="jpaPropertyMap">
      <map>
        <entry key="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.WeblogicTransactionManagerLookup"/>   


While loading the application on Unix/Weblogic, however, Hibernate complains about:
Code:
org.hibernate.HibernateException: The chosen transaction strategy requires access to the JTA TransactionManager
   at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:361)
   at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1327)


The remedy for that was to set the lookup class redundantly also in persistence.xml:
Code:
<persistence-unit name="cstd" transaction-type="JTA">
    <provider>org.hibernate.ejb.HibernatePersistence</provider>
    <jta-data-source>jdbc/myds</jta-data-source>
    ...
    <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.WeblogicTransactionManagerLookup"/>


Why is that necessary on Unix but not on Windows? Why is it necessary at all?

Cheers,
Marcel

_________________
my2cents @ http://www.frightanic.com/


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.