You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@aries.apache.org by "maciek (JIRA)" <ji...@apache.org> on 2016/10/05 10:21:20 UTC

[jira] [Created] (ARIES-1625) JPA inheritence Eclipselink - classloader issue ?!

maciek created ARIES-1625:
-----------------------------

             Summary: JPA inheritence Eclipselink - classloader issue ?!
                 Key: ARIES-1625
                 URL: https://issues.apache.org/jira/browse/ARIES-1625
             Project: Aries
          Issue Type: Bug
          Components: JPA
         Environment: 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 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




            Reporter: maciek


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("OPERATION")
public class OperationParameter 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 pl.orange.isep.model.service.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]


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 U have any idea why it happens? 
The examples from github (https://github.com/apache/aries/tree/trunk/jpa/examples) has 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?








--
This message was sent by Atlassian JIRA
(v6.3.4#6332)