Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Not A Bug
-
None
-
None
-
None
-
Karaf 4.0.7 with Eclipselink:
330 | Active | 80 | 3.2.0.v201302191141 | EclipseLink ANTLR
331 | Active | 80 | 5.0.1.v201405080102 | EclipseLink ASM
332 | Active | 80 | 2.6.1.v20150916-55dc7c3 | EclipseLink Core
333 | Active | 80 | 2.6.1.v20150916-55dc7c3 | EclipseLink JPA
334 | Active | 80 | 2.6.1.v20150916-55dc7c3 | EclipseLink Hermes Parserand JPA support:
162 | Active | 80 | 2.3.0 | Apache Aries JPA Container API
163 | Active | 80 | 2.3.0 | Apache Aries JPA blueprint
164 | Active | 80 | 2.3.0 | Apache Aries JPA container
165 | Active | 80 | 2.3.0 | Apache Aries JPA supportJava:
Java(TM) SE Runtime Environment (build 1.8.0_101-b13)OS:
Distributor ID: Ubuntu
Description: Ubuntu 14.04.4 LTS
Release: 14.04
Codename: trustyKaraf 4.0.7 with Eclipselink: 330 | Active | 80 | 3.2.0.v201302191141 | EclipseLink ANTLR 331 | Active | 80 | 5.0.1.v201405080102 | EclipseLink ASM 332 | Active | 80 | 2.6.1.v20150916-55dc7c3 | EclipseLink Core 333 | Active | 80 | 2.6.1.v20150916-55dc7c3 | EclipseLink JPA 334 | Active | 80 | 2.6.1.v20150916-55dc7c3 | EclipseLink Hermes Parser and JPA support: 162 | Active | 80 | 2.3.0 | Apache Aries JPA Container API 163 | Active | 80 | 2.3.0 | Apache Aries JPA blueprint 164 | Active | 80 | 2.3.0 | Apache Aries JPA container 165 | Active | 80 | 2.3.0 | Apache Aries JPA support Java: Java(TM) SE Runtime Environment (build 1.8.0_101-b13) OS: Distributor ID: Ubuntu Description: Ubuntu 14.04.4 LTS Release: 14.04 Codename: trusty
Description
I have jar with packaged entities in it.
I have package org.test.base where I have class like:
package org.test.base; @Entity @Inheritance(strategy = InheritanceType.SINGLE_TABLE) @DiscriminatorColumn(name = "TYPE") @Table(name = "PARAMETER") public abstract class BaseParameter implements Serializable {... @Id @SequenceGenerator(name = "ParameterIdGenerator", allocationSize = 1, sequenceName = "SEQ_PARAMETER_ID") @GeneratedValue(generator = "ParameterIdGenerator", strategy = GenerationType.SEQUENCE) @Column(name = "ID", nullable = false, precision = 20) protected Long id;
and another package org.test.operation in which I have concrete parameter for example:
package org.test.operation @Entity @DiscriminatorValue("SUBSCRIPTION") public class SubscriptionParameter extends BaseParameter { .....
I am using example from
https://github.com/apache/aries/tree/trunk/jpa/examples
to get to my entities using DS module but of course I modified it to fit my model.
Commands I do are:
install -s mvn:pl.orange.isep/my-model/0.1-SNAPSHOT -> OK
install -s mvn:org.apache.aries.jpa.example/org.apache.aries.jpa.example.tasklist.model/3.0.0-SNAPSHOT
and then the exception arises:
org.apache.aries.jpa/org.apache.aries.jpa.container/2.3.0]: Unexpected problem updating configuration org.apache.aries.jpa.tasklist javax.persistence.PersistenceException: Exception [EclipseLink-28018] (Eclipse Persistence Services - 2.6.1.v20150916-55dc7c3): org.eclipse.persistence.exceptions.EntityManagerSetupException Exception Description: Predeployment of PersistenceUnit [tasklist] failed. Internal Exception: Exception [EclipseLink-7161] (Eclipse Persistence Services - 2.6.1.v20150916-55dc7c3): org.eclipse.persistence.exceptions.ValidationException Exception Description: Entity class [class org.test.operation.SubscriptionParameter] 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.internal.jpa.EntityManagerSetupImpl.createPredeployFailedPersistenceException(EntityManagerSetupImpl.java:2035)[333:org.eclipse.persistence.jpa:2.6.1.v20150916-55dc7c3] at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.predeploy(EntityManagerSetupImpl.java:2026)[333:org.eclipse.persistence.jpa:2.6.1.v20150916-55dc7c3] at org.eclipse.persistence.jpa.PersistenceProvider.createContainerEntityManagerFactoryImpl(PersistenceProvider.java:347)[333:org.eclipse.persistence.jpa:2.6.1.v20150916-55dc7c3] at org.eclipse.persistence.jpa.PersistenceProvider.createContainerEntityManagerFactory(PersistenceProvider.java:313)[333:org.eclipse.persistence.jpa:2.6.1.v20150916-55dc7c3] at org.apache.aries.jpa.eclipselink.adapter.EclipseLinkPersistenceProvider.createContainerEntityManagerFactory(EclipseLinkPersistenceProvider.java:52)[302:org.apache.aries.jpa.eclipselink.adapter:2.3.0] at org.apache.aries.jpa.container.impl.ManagedEMF.createAndPublishEMF(ManagedEMF.java:129)[164:org.apache.aries.jpa.container:2.3.0] at org.apache.aries.jpa.container.impl.ManagedEMF.updated(ManagedEMF.java:125)[164:org.apache.aries.jpa.container:2.3.0] at org.apache.felix.cm.impl.helper.ManagedServiceTracker.updated(ManagedServiceTracker.java:189)[3:org.apache.felix.configadmin:1.8.8] at org.apache.felix.cm.impl.helper.ManagedServiceTracker.updateService(ManagedServiceTracker.java:152)[3:org.apache.felix.configadmin:1.8.8]
My assumption is that class BaseParameter is not seen by the eclipselink that validates entities.
But surprisingly when I change the package for this two entities that they are in common package for example org.base then everything is loading fine and I can access my entities.
Problem was happening with all my entities consecutively until I packed them all in one package, then it disappeared.
My model is quite complex and I really dont want to have all entities mixed in one package. Do You have any idea why it happens?
The examples from github (https://github.com/apache/aries/tree/trunk/jpa/examples) have no JPA inheritence and all the entities are in one package.
I have my application configured correctly (persistence.xml etc.) because only package change makes a difference.
Is it Karaf classloader issue or jpa-container one? Is there any workaroud other than putting all entities in one package?