Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Apparent interface violation in CriteriaBuilderImpl
Apparent interface violation in CriteriaBuilderImpl [message #667108] Tue, 26 April 2011 18:44 Go to next message
Dave Brosius is currently offline Dave BrosiusFriend
Messages: 14
Registered: July 2009
Junior Member
I am unit testing some stuff that uses eclipselink. I have created my own mock of the MetaModel as passed into the EntityManager.

However when CriteriaBuilderImpl.createQuery executes i get class cast exceptions such as the following, as CriteriaBuilderImpl apparently assumes an implementation of the MetaModel, and does not use the interface. This seems wrong to me, bug?:

java.lang.ClassCastException: com.acme.pgbu.dao.datasource.EntityDataSourceTest$2$1 cannot be cast to org.eclipse.persistence.internal.jpa.metamodel.MetamodelImpl
at org.eclipse.persistence.internal.jpa.querydef.CriteriaBuilde rImpl.createQuery(
at com.acme.pgbu.dao.datasource.EntityDataSource.getDataTOs(Ent
at com.acme.pgbu.dao.datasource.EntityDataSourceTest.testGetDat aTOs(
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe
at java.lang.reflect.Method.invoke(
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(
at org.junit.runners.model.FrameworkMethod.invokeExplosively(Fr
at org.junit.internal.runners.statements.InvokeMethod.evaluate(
at org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(Block
Re: Apparent interface violation in CriteriaBuilderImpl [message #667233 is a reply to message #667108] Wed, 27 April 2011 14:46 Go to previous message
James Sutherland is currently offline James SutherlandFriend
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

No, you must use the EclipseLink meta-model.

James : Wiki : Book : Blog : Twitter
Previous Topic:Howto map a map?
Next Topic:merge not updating pk IDs
Goto Forum:

Current Time: Sat Nov 28 18:31:06 GMT 2015

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

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