Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » ClassCastException on EntityManager.getCriteriaBuilder()(Error in Metamodel? How to get further information?)
ClassCastException on EntityManager.getCriteriaBuilder() [message #662474] Wed, 30 March 2011 18:11 Go to next message
No real name is currently offline No real name
Messages: 3
Registered: August 2010
Junior Member
Hi,

when calling EntitiyManager.getCriteriaBuilder() I get a ClassCastException:
java.lang.ClassCastException: org.eclipse.persistence.internal.jpa.metamodel.EmbeddableTyp eImpl cannot be cast to javax.persistence.metamodel.IdentifiableType

I tried EclipseLink 2.1.2 and 2.2.0, both the same behaviour.
Maybe my objects / annotations are wrong (maybe not?) - I don't know how to get more information. The exception text doesn't help me in any way and the stacktrace points directly into EclipseLink internals:

2.1.2:
java.lang.ClassCastException: org.eclipse.persistence.internal.jpa.metamodel.EmbeddableTypeImpl cannot be cast to javax.persistence.metamodel.IdentifiableType
	at org.eclipse.persistence.internal.jpa.metamodel.MetamodelImpl.initialize(MetamodelImpl.java:377)
	at org.eclipse.persistence.internal.jpa.metamodel.MetamodelImpl.<init>(MetamodelImpl.java:101)
	at org.eclipse.persistence.internal.jpa.metamodel.MetamodelImpl.<init>(MetamodelImpl.java:120)
	at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.getMetamodel(EntityManagerSetupImpl.java:2005)
	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.getMetamodel(EntityManagerFactoryImpl.java:511)
	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.getCriteriaBuilder(EntityManagerFactoryImpl.java:485)
	at org.eclipse.persistence.internal.jpa.EntityManagerImpl.getCriteriaBuilder(EntityManagerImpl.java:2129)
	at xxx.jpa.JPAManager.getObjectListInternal(JPAManager.java:230)

2.2.0:
java.lang.ClassCastException: org.eclipse.persistence.internal.jpa.metamodel.EmbeddableTypeImpl cannot be cast to javax.persistence.metamodel.IdentifiableType
	at org.eclipse.persistence.internal.jpa.metamodel.MetamodelImpl.initialize(MetamodelImpl.java:410)
	at org.eclipse.persistence.internal.jpa.metamodel.MetamodelImpl.<init>(MetamodelImpl.java:109)
	at org.eclipse.persistence.internal.jpa.metamodel.MetamodelImpl.<init>(MetamodelImpl.java:128)
	at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.getMetamodel(EntityManagerSetupImpl.java:2179)
	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.getMetamodel(EntityManagerFactoryImpl.java:532)
	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.getCriteriaBuilder(EntityManagerFactoryImpl.java:506)
	at org.eclipse.persistence.internal.jpa.EntityManagerImpl.getCriteriaBuilder(EntityManagerImpl.java:2136)
	at xxx.jpa.JPAManager.getObjectListInternal(JPAManager.java:230)


Can somebody help me?

Thanks.
Re: ClassCastException on EntityManager.getCriteriaBuilder() [message #662696 is a reply to message #662474] Thu, 31 March 2011 15:21 Go to previous message
James Sutherland is currently offline James Sutherland
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

My guess is that you have an @Entity subclasses from an @Embeddable. I don't think this is valid, but you should be getting a better error, so please log and bug and include your model.

If you don't have this, please include your model, or check for other odd inheritance usages.



James : Wiki : Book : Blog : Twitter
Previous Topic:JAP and RCP javax.persistence.PersistenceException: No Persistence provider for EntityManager named
Next Topic:update query and stale cache
Goto Forum:
  


Current Time: Fri Oct 24 18:52:52 GMT 2014

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

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