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 Brosius
Messages: 11
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(CriteriaBuilderImpl.java:81)
at com.acme.pgbu.dao.datasource.EntityDataSource.getDataTOs(Ent ityDataSource.java:88)
at com.acme.pgbu.dao.datasource.EntityDataSourceTest.testGetDat aTOs(EntityDataSourceTest.java:118)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall( FrameworkMethod.java:44)
at org.junit.internal.runners.model.ReflectiveCallable.run(Refl ectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(Fr ameworkMethod.java:41)
at org.junit.internal.runners.statements.InvokeMethod.evaluate( InvokeMethod.java:20)
at org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(Block JUnit4ClassRunner.java:79)
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 Sutherland
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: Tue Sep 23 10:32:44 GMT 2014

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

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