Topic
No replies
thebryce
thebryce
2 Posts
ACCEPTED ANSWER

Pinned topic Custom FieldMapping Strategy problem in Jpa 2.0 feature pack

‏2012-02-20T08:34:26Z |
Hi ,
I 'have à problem when the JEE server try to load
my custom class for a Custom FieldMapping Strategy ( OpenJpa 2.0 feature pack ,PM37821​)

Ok-> J2SE ( with junit config..) , it'does works fine
NOK->J2ee 5 -> doesn't work....
config : windows 2003 server+
ibm was 7.0.0.21 + Feature Pack for OSGi Applications and Java Persistence API 2.0 ( and fix pack 7.0.0.7 )
  • custom strategy *********************

package org.apache.openjpa.jdbc.meta.strats;

public class CipherStrategy extends StringFieldStrategy{
@Override
public int select(Select sel, OpenJPAStateManager sm, JDBCStore store,JDBCFetchConfiguration fetch, int eagerMode) {...}
}

********************MyEntity*******************************
public class MyEntity implements Serializable {
@Column(name = "VALUE" )
@Strategy("org.apache.openjpa.jdbc.meta.strats.CipherStrategy")
private String value;
....
}

*******************J2ee my persistence.xml*********************

<persistence version="2.0" 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_2_0.xsd">
<persistence-unit name="MyEntity" transaction-type="JTA">
<provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
<jta-data-source>jdbc/Base</jta-data-source>
<class>com.hsbc.mc.business.bean.MyEntity</class>
<properties>
<property name="jdbc/Base" value="jdbc/Base" />
<property name="openjpa.Compatibility" value="StrictIdentityValues=true"/>
<property name="open.jdbc.DriverDataSource" value="simple"/>
<property name="openjpa.Log" value="DefaultLevel=TRACE, Runtime=TRACE, Tool=TRACE, SQL=TRACE" />
<property name="openjpa.ConnectionFactoryProperties" value="PrettyPrint=true, PrettyPrintLineLength=72"/>
</properties>
</persistence-unit>

******************J2se config my persistence.xml*************
<persistence version="2.0" 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_2_0.xsd">
<persistence-unit name="MyEntity" transaction-type="RESOURCE_LOCAL">
<provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
<non-jta-data-source>jdbc/Base</non-jta-data-source>
<class>com.hsbc.mc.business.bean.MyEntity</class>
<properties>
<property name="jdbc/Base" value="jdbc/Base" />
<property name="openjpa.RuntimeUnenhancedClasses" value="supported"/>
<property name="openjpa.DynamicDataStructs" value="true"/>
<property name="openjpa.Compatibility" value="StrictIdentityValues=true"/>
<property name="openjpa.DynamicEnhancementAgent" value="false"/>
<property name="open.jdbc.DriverDataSource" value="simple"/>
<property name="openjpa.Log" value="DefaultLevel=TRACE, Runtime=TRACE, Tool=TRACE, SQL=TRACE" />
<property name="openjpa.ConnectionFactoryProperties" value="PrettyPrint=true, PrettyPrintLineLength=72"/>
</properties>
</persistence-unit>

**********************Log meta data j2se Ok********************

openjpa.MetaData - Resolving field "com.hsbc.mc.business.bean.MyEntity@1618960511.value".
28200 CipherEntity TRACE P=662471:O=0:CT openjpa.MetaData - "value" has mapping strategy "org.apache.openjpa.jdbc.meta.strats.CipherStrategy".

***********************Log data jEE pblem*******************

trace log : throw BusinessExceptionMappingStrategy.......

com.ibm.ejs.container.ExceptionMappingStrategy::exceptionToBeThrown:null
com.ibm.ejs.container.ExceptionMappingStrategy::thisStrategiesOwner:com.ibm.ejs.container.EJSDeployedSupport@26062606
com.ibm.ejs.container.BusinessExceptionMappingStrategy::CLASS_NAME:com.ibm.ejs.container.BusinessExceptionMappingStrategy
com.ibm.ejs.container.BusinessExceptionMappingStrategy::tc BEGIN:com.ibm.ejs.ras.TraceComponent@1dd81dd8
com.ibm.ejs.ras.TraceElement::ivLevel:10
com.ibm.ejs.ras.TraceElement::ivName:com.ibm.ejs.container.BusinessExceptionMappingStrategy
com.ibm.ejs.ras.TraceElement::ivDebugEnabled:false
com.ibm.ejs.ras.TraceElement::ivEventEnabled:false
com.ibm.ejs.ras.TraceElement::ivEntryEnabled:false
com.ibm.ejs.ras.TraceElement::ivDetailEnabled:false
com.ibm.ejs.ras.TraceElement::ivConfigEnabled:false
com.ibm.ejs.ras.TraceElement::ivInfoEnabled:true
com.ibm.ejs.ras.TraceElement::ivServiceEnabled:true
com.ibm.ejs.ras.TraceElement::ivWarningEnabled:true
com.ibm.ejs.ras.TraceElement::ivErrorEnabled:true
com.ibm.ejs.ras.TraceElement::ivFatalEnabled:true
com.ibm.ejs.ras.TraceComponent::defaultMessageFile:com.ibm.ejs.resources.seriousMessages
com.ibm.ejs.ras.TraceComponent::EXTENSION_NAME_DPID:DiagnosticProvider
com.ibm.ejs.ras.TraceComponent::ivDumpEnabled:false
com.ibm.ejs.ras.TraceComponent::ivResourceBundleName:com.ibm.ejs.container.container
com.ibm.ejs.ras.TraceComponent::ivLogger:null
com.ibm.ejs.ras.TraceComponent::ivDiagnosticProviderID:null
com.ibm.ejs.ras.TraceComponent::anyTracingEnabled:true
END:com.ibm.ejs.ras.TraceComponent@1dd81dd8

END:com.ibm.ejs.container.BusinessExceptionMappingStrategy@1de61de6
Any Answers ?