Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » EclipseLink: OSGi and inheritance(EclipseLink: OSGi and inheritance)
icon3.gif  EclipseLink: OSGi and inheritance [message #1732378] Mon, 16 May 2016 16:09 Go to next message
Pavel No is currently offline Pavel NoFriend
Messages: 47
Registered: May 2016
Member

I have three osgi bundles:1,2,3.

I have two classes:

@Entity
@Table(name = "...")
public class B extends A{

    @Column (name = "...")
    private String fieldB;
    //+getter and setter
}

@MappedSuperclass
public class A{

    @Id
    @Column(name = "...")
    private String fieldA;
    //+getter and setter
}


Both classes are defined in persistence.xml. Persistence.xml file is in bundle 3.

When both classes are in the same bundle (for example bundle 1) everything works. However, when class A is in bundle 1 and class B is in bunle 2 (both bunldes 1 and 2 export their packages) I get the following exception:

org.eclipse.persistence.exceptions.ValidationException: 
Exception Description: Entity class [class B] has no primary key specified. It should define either an @Id, @EmbeddedId or an @IdClass. If you have defined PK using any of these annotations then make sure that you do not have mixed access-type (both fields and properties annotated) in your entity class hierarchy.
    at org.eclipse.persistence.exceptions.ValidationException.noPrimaryKeyAnnotationsFound(ValidationException.java:1425)
    at org.eclipse.persistence.internal.jpa.metadata.accessors.classes.EntityAccessor.validatePrimaryKey(EntityAccessor.java:1542)
    at org.eclipse.persistence.internal.jpa.metadata.accessors.classes.EntityAccessor.processMappingAccessors(EntityAccessor.java:1249)
    at org.eclipse.persistence.internal.jpa.metadata.accessors.classes.EntityAccessor.process(EntityAccessor.java:699)
    at org.eclipse.persistence.internal.jpa.metadata.MetadataProject.processStage2(MetadataProject.java:1808)
    at org.eclipse.persistence.internal.jpa.metadata.MetadataProcessor.processORMMetadata(MetadataProcessor.java:573)
    at org.eclipse.persistence.internal.jpa.deployment.PersistenceUnitProcessor.processORMetadata(PersistenceUnitProcessor.java:604)
    at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.predeploy(EntityManagerSetupImpl.java:1948)
    at org.eclipse.persistence.internal.jpa.deployment.JPAInitializer.callPredeploy(JPAInitializer.java:100)
    at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactoryImpl(PersistenceProvider.java:104)
    at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactory(PersistenceProvider.java:188)
    at org.eclipse.gemini.jpa.ProviderWrapper.createEntityManagerFactory(ProviderWrapper.java:128)
    at org.eclipse.gemini.jpa.proxy.EMFServiceProxyHandler.createEMF(EMFServiceProxyHandler.java:151)
    at org.eclipse.gemini.jpa.proxy.EMFServiceProxyHandler.syncGetEMFAndSetIfAbsent(EMFServiceProxyHandler.java:127)
    at org.eclipse.gemini.jpa.proxy.EMFServiceProxyHandler.invoke(EMFServiceProxyHandler.java:73)
    at com.sun.proxy.$Proxy8.createEntityManager(Unknown Source)


How to solve this problem?
Re: EclipseLink: OSGi and inheritance [message #1733458 is a reply to message #1732378] Fri, 27 May 2016 16:56 Go to previous message
Chris Delahunt is currently offline Chris DelahuntFriend
Messages: 1389
Registered: July 2009
Senior Member
Is your persistence unit bundle importing the other bundles? Check the logs and OSGI classloader setup, as EclipseLink must not be able to find your mappedSupperclass class when it is loading the persistence unit.
Previous Topic:JPA 2.1 @Converter bug?
Next Topic:EclipseLink get stuck
Goto Forum:
  


Current Time: Fri Apr 26 04:35:38 GMT 2024

Powered by FUDForum. Page generated in 0.03512 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top