-->
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.  [ 5 posts ] 
Author Message
 Post subject: I have a quick Hibernate question - Any takers?
PostPosted: Tue Jun 23, 2009 11:37 am 
Regular
Regular

Joined: Tue Jul 29, 2008 4:15 pm
Posts: 62
Location: Dallas, TX US
I am using JPA and the EntityManager to persist my data. My jUnit test works fine but when I look in my database I don't see the data I just persisted. Does anybody know why this is happening?

Thanks!

_________________
pouncilt


Top
 Profile  
 
 Post subject: Re: I have a quick Hibernate question - Any takers?
PostPosted: Tue Jun 23, 2009 11:54 am 
Newbie

Joined: Tue Jun 23, 2009 9:49 am
Posts: 3
Are you commiting the transaction in your tests? or using the spring transactionConfiguration with rollback set?

neil


Top
 Profile  
 
 Post subject: Re: I have a quick Hibernate question - Any takers?
PostPosted: Tue Jun 23, 2009 1:44 pm 
Regular
Regular

Joined: Tue Jul 29, 2008 4:15 pm
Posts: 62
Location: Dallas, TX US
Hm... That is a good question. I am NOT committing the transaction in my test. However, I am using the JPATransactionManager to coordinate my transations. It is defined like this:

Code:
        <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
      <property name="dataSource">
         <ref bean="data-source" />
      </property>      
      <property name="persistenceUnitName">
         <value>local-jedi-persistence-test</value>
      </property>
      <property name="persistenceXmlLocation">
         <value>/itest/local-jedi-persistence.xml</value>
      </property>
   </bean>


   <bean id="tranactionManager" name="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
      <property name="entityManagerFactory" ref="entityManagerFactory" />
   </bean>


I am using @Transactional annotation in my Junit4 test too.

Do I have an error in my configuration? Did I leave out something?

_________________
pouncilt


Top
 Profile  
 
 Post subject: Re: I have a quick Hibernate question - Any takers?
PostPosted: Wed Jun 24, 2009 11:22 am 
Regular
Regular

Joined: Tue Jul 29, 2008 4:15 pm
Posts: 62
Location: Dallas, TX US
Do I need to wire up a HibernateJPADialect inside my transactionManager even though dialect is defined in my persistence.xml file? What is the purpose of the HibernateJPADialect?

_________________
pouncilt


Top
 Profile  
 
 Post subject: Re: I have a quick Hibernate question - Any takers?
PostPosted: Wed Jun 24, 2009 4:13 pm 
Regular
Regular

Joined: Tue Jul 29, 2008 4:15 pm
Posts: 62
Location: Dallas, TX US
I resolved this by and Spring Transactional annotation to my service method; which in turn used my DAOs to persist.

Thanks!

_________________
pouncilt


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

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.