openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Heiko Kopp <it-media.k...@daimler.com>
Subject @Externalizer not working during maven test phase
Date Tue, 28 Sep 2010 10:10:02 GMT

Hello,

I've encountered a problem when using openJPA inside mavens integration test
phase. Alot of my entities respectively their members have been annotated
with @Factory and @Externalizer to automatically convert database datatypes
into schema relevent enumerations. An example for this is:

@Entity
@Table(name = "PARTNER", schema = "PART")
public class Partner
{
    ....

    @Column(name = "I_SCHL_WERTBEZ")
    @Externalizer(TypeMapping.MARSHAL_SALUTATION_INDIVIDUAL)
    @Factory(TypeMapping.UNMARSHAL_SALUTATION_INDIVIDUAL)
    private SalutationIndividualEnum salutationIndividual;

    ...
}

The Externalizer- and Factory-Methods have been extracted into a separate
class called 'TypeMapping'. In this class we additionally have the following
string constants as used above:

public static final String MARSHAL_SALUTATION_INDIVIDUAL
   =
"com.mbbank.partner.pas.common.system.typemapping.TypeMapping.marshalSalutationIndividual";

public static final String UNMARSHAL_SALUTATION_INDIVIDUAL
   =
"com.mbbank.partner.pas.common.system.typemapping.TypeMapping.unmarshalSalutationIndividual";

These strings referr to the actuall methods.

The TypeMapping-class is located in a different package than the entity
class. And this seems to be a problem during test test phase in maven. While
the code works perfectly in the application server, it fails in the maven
test phase with the following exception:

<openjpa-1.0.4-SNAPSHOT-r420667:809016 fatal user error>
org.apache.openjpa.persistence.ArgumentException: Der Klassenname
"com.mbbank.partner.pas.common.system.typemapping.TypeMapping", der in der
Metadatenerweiterung im Feld
"com.mbbank.partner.pas.common.system.database.model.Person.salutationIndividual"
verwendet wird, ist nicht g├╝ltig.
at org.apache.openjpa.meta.JavaTypes.classForName(JavaTypes.java:227)
	at org.apache.openjpa.meta.JavaTypes.classForName(JavaTypes.java:194)
	at org.apache.openjpa.meta.JavaTypes.classForName(JavaTypes.java:185)
	at
org.apache.openjpa.meta.FieldMetaData.findMethod(FieldMetaData.java:1533)
	at
org.apache.openjpa.meta.FieldMetaData.getExternalizerMethod(FieldMetaData.java:1465)
	at org.apache.openjpa.meta.FieldMetaData.resolve(FieldMetaData.java:1640)
	at org.apache.openjpa.jdbc.meta.FieldMapping.resolve(FieldMapping.java:400)
	at
org.apache.openjpa.meta.ClassMetaData.resolveMeta(ClassMetaData.java:1688)
	at org.apache.openjpa.meta.ClassMetaData.resolve(ClassMetaData.java:1623)
	at
org.apache.openjpa.meta.MetaDataRepository.processBuffer(MetaDataRepository.java:675)
	at
org.apache.openjpa.meta.MetaDataRepository.resolveMeta(MetaDataRepository.java:574)
	at
org.apache.openjpa.meta.MetaDataRepository.resolve(MetaDataRepository.java:499)
	at
org.apache.openjpa.meta.MetaDataRepository.getMetaData(MetaDataRepository.java:301)
	at org.apache.openjpa.kernel.BrokerImpl.newObjectId(BrokerImpl.java:1060)
	at
org.apache.openjpa.kernel.DelegatingBroker.newObjectId(DelegatingBroker.java:252)
	at
org.apache.openjpa.persistence.EntityManagerImpl.find(EntityManagerImpl.java:347)

The string is localized into German, the original one is referred to as
'bad-class'. It's English representation is:

bad-class: The class name "{0}" used in a metadata extension on field "{1}"
is not valid.

As both class files are present in the same module and even during the test
phase, I've actually no clue on how to fix this issue. It can be fixed, when
I put the static methods in the same package/class as the annotated field,
but that is no solutation for us as it will duplicate a lot of code.

Has anyone an idea why this appends and what can be done to prevent it?

Thank you very much.

As seen in the stack trace above, I'm using openJPA 1.0.4-<something>, which
is part of the Websphere Application Server 6.1.0.29.

Best regards,

Heiko
-- 
View this message in context: http://openjpa.208410.n2.nabble.com/Externalizer-not-working-during-maven-test-phase-tp5578748p5578748.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Mime
View raw message