Spring+OpenJPA+MySQL+Tomcat6 Data removing
Hi,
I'm trying to configure OpenJPA. My configuration is below
Code:
<bean id="jpa.vendor.JpaAdaptor"
class="org.springframework.orm.jpa.vendor.OpenJpaVendorAdapter">
<property name="showSql" value="true"/>
<property name="generateDdl" value="true" />
<property name="database" value="MYSQL"/>
<property name="databasePlatform"
value="org.apache.openjpa.jdbc.sql.MySQLDictionary">
</property>
</bean>
<bean id="facebookEntityManagerFactory"
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="dataSource" ref="facebookDataSource"/>
<property name="loadTimeWeaver">
<bean class="org.springframework.instrument.classloading.ReflectiveLoadTimeWeaver"/>
</property>
<property name="persistenceUnitManager" ref="jpa.persistence.unit.Manager"/>
<property name="persistenceUnitName" value="jpa.persistence.unit.facebook"/>
<property name="jpaDialect">
<bean class="org.springframework.orm.jpa.vendor.OpenJpaDialect"/>
</property>
<property name="jpaVendorAdapter">
<ref bean="jpa.vendor.JpaAdaptor"/>
</property>
</bean>
All works fine but the data modification and removing.
When I'm calling method remove(), nothing really happens
Code:
@Transactional
public void removeFacebookCustomer(final String id){
logger.info("Trying to remove customer with id " + customer.getCustomerFacebookId());
Customer c = new Customer();
c.setCustomerFacebookId(id);
this.getJpaTemplate().remove(c);
return;
}
Also, in the log file there is a SELECT instead of DELETE query.
Code:
20.04.2009 17:12:12 com.donriver.mfs.facebook.pojo.FacebookPersistanceManagerImpl removeFacebookCustomer
INFO: Trying to remove customer with id 000000
892342 jpa.persistence.unit.facebook TRACE [http-8081-1] openjpa.jdbc.SQL - <t 161080, conn 22923041> executing prepstmnt 13825521 SELECT t0.customer_facebook_email, t0.customer_id, t0.status FROM CUSTOMER t0 WHERE t0.customer_facebook_id = ? [params=(String) 000000]
892342 jpa.persistence.unit.facebook TRACE [http-8081-1] openjpa.jdbc.SQL - <t 161080, conn 22923041> [0 ms] spent
What I do wrong?
Appreciate any help. Thanks