ok guys...

solved the problem with this bean configs:


<?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:camel="http://camel.apache.org/schema/spring";
       xsi:schemaLocation="
       http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
       http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring.xsd";>

  <bean  id="bindyDataFormat"
class="org.apache.camel.dataformat.bindy.csv.BindyCsvDataFormat">
    <constructor-arg value="com.test.integration.camel.spring.poc.file"/>
  </bean>
  
  <bean id="jpa" class="org.apache.camel.component.jpa.JpaComponent">
    <property name="entityManagerFactory" ref="entityManagerFactory"/>
  </bean>
  
  <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close"> 
    <property name="driverClassName" value="com.mysql.jdbc.Driver" /> 
    <property name="url"
value="jdbc:mysql://localhost:3306/servicemix-camel-db" /> 
    <property name="username" value="root" /> 
    <property name="password" value="mysql" /> 
  </bean> 
  
  <bean id="entityManagerFactory"
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
    <property name="persistenceUnitName" value="camelPU"/>
    <property name="jpaVendorAdapter" ref="jpaAdapter"/>
    <property name="dataSource" ref="dataSource" />
  </bean>
  
  <bean id="jpaAdapter"
class="org.springframework.orm.jpa.vendor.OpenJpaVendorAdapter">
    <property name="databasePlatform"
value="org.apache.openjpa.jdbc.sql.MySQLDictionary" />
    <property name="database" value="MYSQL"/>
  </bean>
  
  <bean id="transactionTemplate"
class="org.springframework.transaction.support.TransactionTemplate">
    <property name="transactionManager">
      <bean class="org.springframework.orm.jpa.JpaTransactionManager">
        <property name="entityManagerFactory" ref="entityManagerFactory"/>
      </bean>
    </property>
  </bean>
  
  <camel:camelContext xmlns="http://camel.apache.org/schema/spring";>
    <camel:package>com.test.integration.camel.spring.poc</camel:package>
    <camel:route>
      <camel:from
uri="file:/home/jedimaster/Java-Env/Sandbox/DB/From?delete=true"/>
          <camel:log message="Started unmarshalling file ${file:name}..."/>
      <camel:split streaming="true" parallelProcessing="true">
        <camel:tokenize token="\n"/>
        <camel:unmarshal ref="bindyDataFormat"/>
        <camel:split>
         
<camel:simple>in.body[0]?[com.test.integration.camel.spring.poc.file.CSVEventRecordBean]</camel:simple>
          <camel:to
uri="jpa:com.test.integration.camel.spring.poc.file.CSVEventRecordBean"/>
        </camel:split>
      </camel:split>
      <camel:log message="Finished unmarshalling file ${file:name}..."/>
    </camel:route>
  </camel:camelContext>

</beans>

and persistence.xml:

<?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"; version="1.0">
  <persistence-unit name="camelPU" transaction-type="RESOURCE_LOCAL">
   
<provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
   
<class>com.test.integration.camel.spring.poc.file.CSVEventRecordBean</class>
    <exclude-unlisted-classes>true</exclude-unlisted-classes>

    <properties>
        <property name="openjpa.Log" value="DefaultLevel=WARN, Tool=INFO"/>
    </properties>
  </persistence-unit>
</persistence>

but now got to a problem relative to entity enhancement:

19:15:14,128 | ERROR | read #11 - Split | DefaultErrorHandler              |
90 - org.apache.camel.camel-core - 2.8.3 | Failed delivery for exchangeId:
ID-deathstar-52480-1330640027104-1-30. Exhausted after delivery attempt: 1
caught: org.springframework.dao.InvalidDataAccessApiUsageException: The type
"class com.test.integration.camel.spring.poc.file.CSVEventRecordBean" has
not been enhanced.; nested exception is <openjpa-2.1.1-r422266:1148538 fatal
user error> org.apache.openjpa.persistence.ArgumentException: The type
"class com.test.integration.camel.spring.poc.file.CSVEventRecordBean" has
not been enhanced.
FailedObject:
com.test.integration.camel.spring.poc.file.CSVEventRecordBean@198b372
[java.lang.String]
org.springframework.dao.InvalidDataAccessApiUsageException: The type "class
com.test.integration.camel.spring.poc.file.CSVEventRecordBean" has not been
enhanced.; nested exception is <openjpa-2.1.1-r422266:1148538 fatal user
error> org.apache.openjpa.persistence.ArgumentException: The type "class
com.test.integration.camel.spring.poc.file.CSVEventRecordBean" has not been
enhanced.
FailedObject:
com.test.integration.camel.spring.poc.file.CSVEventRecordBean@198b372 

Any ideas?

Cheers.

--
View this message in context: 
http://servicemix.396122.n5.nabble.com/OpenJPA-MySQL-DBCP-and-Camel-Route-Exception-tp5529115p5529410.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Reply via email to