[jboss-user] [Persistence, JBoss/CMP, Hibernate, Database] - Changing DB from mySql - oracle having persistance problems

gubisoul do-not-reply at jboss.com
Mon Oct 22 05:12:06 EDT 2007


Hey.

We had our tests with EJB3 in an mysql db and it worked fine, but we have to change db to Oracle now, and that caused alot of problems.
I hope someone can give me some pointers to what i am doing wrong, and what i am doing right, i have tried with transaktions, but without any effect.

The error i get is:

anonymous wrote : 10:53:10,147 ERROR [STDERR] javax.ejb.EJBException: javax.persistence.PersistenceException: org.hibernate.HibernateException: this instance does not yet exist as a row in the database
  | 10:53:10,147 ERROR [STDERR] 	at org.jboss.ejb3.tx.Ejb3TxPolicy.handleExceptionInOurTx(Ejb3TxPolicy.java:69)
  | 10:53:10,147 ERROR [STDERR] 	at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:83)
  | 10:53:10,147 ERROR [STDERR] 	at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:191)
  | 10:53:10,147 ERROR [STDERR] 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)

At this point of my code after the Sysout 4:
anonymous wrote : 
  | public CustomerBean addNewCustomerBean(ServiceProviderBean serviceProviderBean, CustomerBean customerBean) throws Exception {
  | System.out.println("1");
  | serviceProviderBean = em.find(ServiceProviderBean.class, serviceProviderBean.getId());
  | System.out.println("2");
  | serviceProviderBean.getCustomerBeans().add(customerBean);
  | System.out.println("3");
  | em.persist(customerBean);
  | System.out.println("4");
  | em.refresh(customerBean);
  | System.out.println("5");
  | em.merge(serviceProviderBean);
  | System.out.println("6");
  | return customerBean;
  | 	}



Here is the DS file:
 anonymous wrote :  <xa-datasource>
  |     <jndi-name>OracleDS</jndi-name>
  |     <track-connection-by-tx/>
  |     <isSameRM-override-value>false</isSameRM-override-value>
  |     <xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class>
  |     <xa-datasource-property name="URL">jdbc:oracle:thin:@url ending (this is correct at my end)UK</xa-datasource-property>
  |     <xa-datasource-property name="User">***Username***</xa-datasource-property>
  |     <xa-datasource-property name="Password">***password***</xa-datasource-property>
  |     <!-- Uses the pingDatabase method to check a connection is still valid before handing it out from the
  |  pool -->
  |     <valid-connection-checker-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleValidConnectionChecker</valid-connection-checker-class-name>
  |     <!-- Checks the Oracle error codes and messages for fatal errors -->
  |     <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name>
  |     <!-- Oracles XA datasource cannot reuse a connection outside a transaction once enlisted in a global 
  | transaction and vice-versa -->
  |     <no-tx-separate-pools/>
  | 
  |       <!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml -->
  |       
  |          <type-mapping>Oracle9i</type-mapping>
  |       
  |     <min-pool-size>1</min-pool-size>
  |     <max-pool-size>10</max-pool-size>
  |     <blocking-timeout-millis>5000</blocking-timeout-millis>
  |     <idle-timeout-minutes>2</idle-timeout-minutes>
  |   </xa-datasource>

And here is the Persistance file:
anonymous wrote : <?xml version="1.0" encoding="UTF-8"?>
  | <persistence xmlns="http://java.sun.com/xml/ns/persistence"
  |     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  |     xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
  |     http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" version="1.0">
  |     
  | 	<persistence-unit name="forums" transaction-type="JTA">
  |   		<jta-data-source>java:/OracleDS</jta-data-source>
  |   		
  |   			
  | 			
  | 		
  | 	</persistence-unit>
  | 

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4097373#4097373

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4097373



More information about the jboss-user mailing list