views:

19

answers:

1

I have an application using Tomcat/Spring 3/JPA/Hibernate but my merges do not commit to datbase. This is the configuration:

spring-conf.xml:

 <bean id="dataSource"
  class="org.springframework.jdbc.datasource.DriverManagerDataSource">
  <property name="driverClassName" value="com.mysql.jdbc.Driver" />
  <property name="url" value="jdbc:mysql://localhost/.." />
  <property name="username" value=".." />
  <property name="password" value=".." />
 </bean>

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

 <tx:annotation-driven transaction-manager="transactionManager"/>

<context:annotation-config/>


 <bean id="entityManagerFactory"
  class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
  <property name="dataSource" ref="dataSource" />
 </bean>

persistence.xml:

<persistence-unit name=".." transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
    ...
<property name="dialect" value="org.hibernate.dialect.MySQLDialect" />

and this is a simple class:

@Transactional
public class UserAdServiceImpl{
...    
merge(...);

any idea?

+1  A: 

my bad! i was trying to merge an entity which was the result of a read-only query so i was unable to alter that !!