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.  [ 3 posts ] 
Author Message
 Post subject: JBoss hibernate transaction commit
PostPosted: Tue Jun 09, 2009 4:41 am 
Newbie

Joined: Tue Jun 09, 2009 4:26 am
Posts: 3
hi,

i am struggling with hibernate operations in spring environment
on a jboss 4 appserver.

my problem is that i would like to see hibernate save() results
immediately in the database, but i only see them if i shut down jboss.

i have already tried getHibernateTemplate().flush(),
setting flushmode to auto, etc.

please help me if you have any ideas. i have googled this problem,
but no appropriate information.

on startup i receive the following information:

Code:
[SettingsFactory] Automatic flush during beforeCompletion(): disabled
[SettingsFactory] Automatic session close at end of transaction: disabled


this is something i dont understand, but seems related to my problem.

my spring configuration is:

Code:
<bean id="bbSessionFactory"
      class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
      <property name="dataSource" ref="bbDatasource" />

      <property name="mappingDirectoryLocations"
         value="classpath:com/rote/bb/" />

      <property name="hibernateProperties">
         <props>
            <prop key="hibernate.dialect">
               org.hibernate.dialect.OracleDialect
            </prop>
            <prop key="hibernate.show_sql">true</prop>
         </props>
      </property>
   </bean>

   <bean id="billbirdDatasource"
      class="org.springframework.jndi.JndiObjectFactoryBean">
      <property name="jndiName" value="java:XAOracleDS" />
      <property name="resourceRef" value="true" />
   </bean>

   <bean id="hibernateTemplate"
      class="org.springframework.orm.hibernate3.HibernateTemplate">
      <property name="sessionFactory" ref="bbSessionFactory" />
      <property name="flushModeName" value="FLUSH_EAGER"/>
   </bean>

   <bean id="hibernateTransactionManager"
      class="org.springframework.orm.hibernate3.HibernateTransactionManager">
      <property name="sessionFactory" ref="bbSessionFactory"/>
   </bean>

   <bean id="hibernateTransactionTemplate"
      class="org.springframework.transaction.support.TransactionTemplate">
      <property name="transactionManager" ref="hibernateTransactionManager" />
   </bean>   


Top
 Profile  
 
 Post subject: Re: JBoss hibernate transaction commit
PostPosted: Thu Jun 11, 2009 4:36 am 
Newbie

Joined: Tue Jun 09, 2009 4:26 am
Posts: 3
i have found the reason:

if i confugured my datasource as

Code:
<bean id="dataSource" class="oracle.jdbc.pool.OracleDataSource">
...


i could see all operations in the database from PL/SQL at once.

if i configured my datasource as:

Code:
<bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
...
</bean>


then i did not see the changes immediately, only after i shut down jboss..


Top
 Profile  
 
 Post subject: Re: JBoss hibernate transaction commit
PostPosted: Thu Jun 11, 2009 5:05 am 
Newbie

Joined: Tue Jun 09, 2009 4:26 am
Posts: 3
unfortunately my JUnit test all fail if i call some addXXX() method
and then test if the results appear in the getAllXXX() method:
they do not, only after a JBoss restart.

i really dont understand this. does anyone have any advice?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.