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

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

I have two classes:

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

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

public class A{

    @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:

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(
    at org.eclipse.persistence.internal.jpa.metadata.accessors.classes.EntityAccessor.validatePrimaryKey(
    at org.eclipse.persistence.internal.jpa.metadata.accessors.classes.EntityAccessor.processMappingAccessors(
    at org.eclipse.persistence.internal.jpa.metadata.accessors.classes.EntityAccessor.process(
    at org.eclipse.persistence.internal.jpa.metadata.MetadataProject.processStage2(
    at org.eclipse.persistence.internal.jpa.metadata.MetadataProcessor.processORMMetadata(
    at org.eclipse.persistence.internal.jpa.deployment.PersistenceUnitProcessor.processORMetadata(
    at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.predeploy(
    at org.eclipse.persistence.internal.jpa.deployment.JPAInitializer.callPredeploy(
    at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactoryImpl(
    at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactory(
    at org.eclipse.gemini.jpa.ProviderWrapper.createEntityManagerFactory(
    at org.eclipse.gemini.jpa.proxy.EMFServiceProxyHandler.createEMF(
    at org.eclipse.gemini.jpa.proxy.EMFServiceProxyHandler.syncGetEMFAndSetIfAbsent(
    at org.eclipse.gemini.jpa.proxy.EMFServiceProxyHandler.invoke(
    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: 1342
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: Thu Apr 02 07:37:44 GMT 2020

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

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

Back to the top