Community
Participate
Working Groups
Build Identifier: 2.3.1.v20110928-r10176 Exception Description: Predeployment of PersistenceUnit [mitarbeiter] failed. Internal Exception: Exception [EclipseLink-7151] (Eclipse Persistence Services - 2.3.1.v20110928-r10176): org.eclipse.persistence.exceptions.ValidationException Exception Description: The type [class data.mitarbeiter.FehlzeitType] for the attribute [fehlType] on the entity class [class mitarbeiter.dao.DBFehlzeit] is not a valid type for an enumerated mapping. The attribute must be defined as a Java enum. at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.predeploy(EntityManagerSetupImpl.java:1402) at org.eclipse.persistence.internal.jpa.deployment.JPAInitializer.callPredeploy(JPAInitializer.java:98) at org.eclipse.persistence.internal.jpa.deployment.JPAInitializer.initPersistenceUnits(JPAInitializer.java:306) at org.eclipse.gemini.jpa.provider.GeminiOSGiInitializer.initializeFromBundle(GeminiOSGiInitializer.java:119) at org.eclipse.gemini.jpa.provider.EclipseLinkOSGiProvider.assignPersistenceUnitsInBundle(EclipseLinkOSGiProvider.java:191) at org.eclipse.gemini.jpa.PersistenceBundleExtender.tryAssigningPersistenceUnitsInBundle(PersistenceBundleExtender.java:172) at org.eclipse.gemini.jpa.PersistenceBundleExtender.bundleChanged(PersistenceBundleExtender.java:314) at org.eclipse.osgi.framework.internal.core.BundleContextImpl.dispatchEvent(BundleContextImpl.java:847) at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230) at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148) at org.eclipse.osgi.framework.internal.core.Framework.publishBundleEventPrivileged(Framework.java:1523) at org.eclipse.osgi.framework.internal.core.Framework.publishBundleEvent(Framework.java:1459) at org.eclipse.osgi.framework.internal.core.Framework.publishBundleEvent(Framework.java:1454) at org.eclipse.osgi.framework.internal.core.PackageAdminImpl.processDelta(PackageAdminImpl.java:487) at org.eclipse.osgi.framework.internal.core.PackageAdminImpl.doResolveBundles(PackageAdminImpl.java:253) at org.eclipse.osgi.framework.internal.core.PackageAdminImpl$1.run(PackageAdminImpl.java:173) at java.lang.Thread.run(Thread.java:662) Reproducible: Always Steps to Reproduce: Mappings: public class DBFehlzeit extends VersionedObject implements Fehlzeit { @Temporal(TemporalType.DATE) private Date von; @Temporal(TemporalType.DATE) private Date bis; @Enumerated(EnumType.STRING) private FehlzeitType fehlType; private String user; } Enum: public enum FehlzeitType { Krankheit, Urlaub; }
I testes a little more, it seems that the superclass information is not set correctly with the setSuperclassName and isValidEnumeratedType returns always false.
Any more information you can provide about this issue will be useful. (e.g. a full test case or at least the full set of mappings including superclass) We have working test cases that demonstrate a working class with an enum, so perhaps the inheritance is important. Also, I see that DBFehlzeit is not annotated as an Entity - if it is not set up as an Entity in some other way, that may be the problem. (You cannot inherit being an Entity from a superclass)
Created attachment 209990 [details] simple tescase reproducing the problem Hi Tom, sorry for the confusion. I shrinked down the class an mapping information and thus accidentally removed the entity annotation. I now was able to put together a testcase (and another observation): As long as the enum resides in the same bundle as the Entity class everything works fine. When importing the enum via a package import the problem occurs (but still the entity can be persisted and worked with...) I'm using EclipseLink together with eclipse gemini in non container managed mode with Java 1.6 and Equinox as the OSGi runtime.
Setting target and priority. See the following page for the meanings of these fields: http://wiki.eclipse.org/EclipseLink/Development/Bugs/Guidelines Community: Please vote for this bug if it is important to you. Votes are one of the main criteria we use to determine which bugs to fix next.
(In reply to comment #4) > Setting target and priority. See the following page for the meanings of these > fields: > > http://wiki.eclipse.org/EclipseLink/Development/Bugs/Guidelines > > Community: Please vote for this bug if it is important to you. Votes are one > of the main criteria we use to determine which bugs to fix next. Bug Voted Interfaces are also affected by this problem. If you map a field with an interface outside the bundle (but in the classpath) you get the same error
I can suggest a workaround for this problem. Just put all classes, interfaces and enums outside the bundle (reached via import package) where there is the persistence.xml file. With this layout, entities are all unreachable by the predeploy method and would be analized after the bundle is started. It's not the optimal solution but it's work for me
(In reply to comment #6) > I can suggest a workaround for this problem. > Just put all classes, interfaces and enums outside the bundle (reached via > import package) where there is the persistence.xml file. > With this layout, entities are all unreachable by the predeploy method and > would be analized after the bundle is started. > It's not the optimal solution but it's work for me You mean an bundle which only contains the persitence XML?
(In reply to comment #7) > (In reply to comment #6) > > I can suggest a workaround for this problem. > > Just put all classes, interfaces and enums outside the bundle (reached via > > import package) where there is the persistence.xml file. > > With this layout, entities are all unreachable by the predeploy method and > > would be analized after the bundle is started. > > It's not the optimal solution but it's work for me > > You mean an bundle which only contains the persitence XML? Yes, an bundle with only persistence xml and at least self-contained entities, that don't refer to other classes. eg. - bundle A - persistence.xml - refers to class Alfa which has a Beta enum field - refers to class Delta (self-contained) - class Delta - bundle B - class Alfa - Enum Beta
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink