-->
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.  [ 6 posts ] 
Author Message
 Post subject: [Help] transactionManager
PostPosted: Wed Dec 28, 2011 8:14 pm 
Newbie

Joined: Wed Dec 28, 2011 8:10 pm
Posts: 5
Hi, i'm new with Hibernate and Spring.
I have a problem with my spring configuration about the "transactionManager".

There is my bean configuration :
Code:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xmlns:tx="http://www.springframework.org/schema/tx"
   xmlns:jdbc="http://www.springframework.org/schema/jdbc"
   xsi:schemaLocation="
      http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.0.xsd
      http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
      http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd ">
   
   <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
        <property name="driverClassName" value="com.mysql.jdbc.Driver" />
        <property name="url" value="jdbc:mysql://localhost:3306/ludus_realm" />
        <property name="username" value="root" />
        <property name="password" value="" />
   </bean>
   
   <bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
        <property name="dataSource" ref="dataSource" />
        <property name="annotatedClasses">
       <list>
       </list>
        </property>
        <property name="hibernateProperties">
          <props>
               <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
               <prop key="hibernate.show_sql">true</prop>
               <prop key="hibernate.hbm2ddl.auto">update</prop>
          </props>
        </property>
   </bean>
   
   <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
        <property name="sessionFactory" ref="sessionFactory" />
   </bean>
   <tx:annotation-driven />
</beans>


The error is on "
Code:
<tx:annotation-driven />
"
There's the error :
Quote:
Error occured processing XML 'org/springframework/transaction/interceptor/TransactionInterceptor'. See Error Log for more details


I've search for a solution, but I don't find it, so i come here to ask you.
Thanks

Cordialy,
baskwo


Top
 Profile  
 
 Post subject: Re: [Help] transactionManager
PostPosted: Sat Nov 17, 2012 12:06 pm 
Newbie

Joined: Sat Nov 17, 2012 11:55 am
Posts: 3
Hi

I'm starting with hibernate.

I have same problem with spring configuration, please tell me if you have a solution for this issue.

Thanks


Top
 Profile  
 
 Post subject: Re: [Help] transactionManager
PostPosted: Sun Nov 18, 2012 3:02 am 
Newbie

Joined: Wed Dec 28, 2011 8:10 pm
Posts: 5
Hi, i've resolve it. When i'll be on my computor, i'll show what to modify.
That's mean, almost when I woke up x)


Top
 Profile  
 
 Post subject: Re: [Help] transactionManager
PostPosted: Mon Nov 19, 2012 7:05 am 
Newbie

Joined: Sat Nov 17, 2012 11:55 am
Posts: 3
Hi baskwo,

Thanks, I'm waiting for you.


Top
 Profile  
 
 Post subject: Re: [Help] transactionManager
PostPosted: Wed Nov 21, 2012 1:20 am 
Newbie

Joined: Wed Dec 28, 2011 8:10 pm
Posts: 5
Hi, sorry for the time that keeps :s
There's my new xml :
Code:
<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE beans SYSTEM "http://www.springframework.org/dtd/spring-beans.dtd" PUBLIC "-//SPRING//DTD BEAN//EN">
-<beans>
<!-- ========================= Start of PERSISTENCE DEFINITIONS ========================= -->

<!-- DataSource Definition via JNDI -->
-<bean destroy-method="close" class="org.apache.commons.dbcp.BasicDataSource" id="database">
<property value="com.mysql.jdbc.Driver" name="driverClassName"/>
<property value="jdbc:mysql://localhost:3306/ludus" name="url"/>
<property value="root" name="username"/>
<property value="" name="password"/>
</bean>
<!-- Hibernate SessionFactory Definition -->
-<bean class="org.springframework.orm.hibernate3.LocalSessionFactoryBean" id="sessionFactory">
-<property name="mappingResources">
-<list>
<value>data/sql/entity/account.hbm.xml</value>
<value>data/sql/entity/player.hbm.xml</value>
</list>
</property>
-<property name="hibernateProperties">
-<props> <prop key="hibernate.hbm2ddl.auto">update</prop>
<prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
<prop key="hibernate.show_sql">false</prop>
<prop key="hibernate.format_sql">false</prop>
<prop key="hibernate.bytecode.use_reflection_optimizer">true</prop>
<prop key="hibernate.cache.provider_class">net.sf.ehcache.hibernate.EhCacheProvider</prop>
<prop key="hibernate.cache.region.factory_class">net.sf.ehcache.hibernate.EhCacheRegionFactory</prop>
<prop key="hibernate.cache.use_second_level_cache">true</prop>
<prop key="hibernate.cache.use_query_cache">true</prop>
</property>
<property name="dataSource" ref="database"/>
</bean>
<!-- Hibernate Transaction Manager Definition -->
-<bean class="org.springframework.orm.hibernate3.HibernateTransactionManager" id="transactionManager">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
</beans>


If I remember, the problem was the class of the sessionFactory, he was using the annotation version, and that was making a trouble with hibernate,etc. So Just change : class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean" to : class="org.springframework.orm.hibernate3.LocalSessionFactoryBean" and i think it will be ok (Remove the shemaLocation if you don't need it) And now i'm using Apache DBCP project and ehcache.

P.S: Sorry for my bad english, i'm speaking french x) (And i think that you should more understand by watching the xml xD)


Top
 Profile  
 
 Post subject: Re: [Help] transactionManager
PostPosted: Wed Nov 21, 2012 10:59 am 
Newbie

Joined: Sat Nov 17, 2012 11:55 am
Posts: 3
Hi baskwo

Thanks for the reponse, I changed class as you said
it's OK now.

regards
Boubacar


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 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.