Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » EMF hibernate resource problem
EMF hibernate resource problem [message #660936] Tue, 22 March 2011 12:38 Go to next message
Alex Mising name is currently offline Alex Mising nameFriend
Messages: 61
Registered: February 2011
Member
Hello guys. I have problem with Teneo/Hibernate/EMF Resource. I have hbdatastore initialize code:
String dataStoreName = "WtpDataStore";
			dataStore = HbHelper.INSTANCE
					.createRegisterDataStore(dataStoreName);
			dataStore.setEPackages(new EPackage[] { WtpdbPackage.eINSTANCE });
			dataStore.getProperties().setProperty(PersistenceOptions.CASCADE_POLICY_ON_NON_CONTAINMENT, "REFRESH,PERSIST,MERGE");
			dataStore.getProperties().setProperty(PersistenceOptions.INHERITANCE_MAPPING, "JOINED");
			dataStore.initialize();
			sessionFactory = dataStore.getSessionFactory();
			uri = "hibernate://?"+HibernateResource.DS_NAME_PARAM+"="+dataStoreName;

Then i'm creating resource in Activator.start method:
ResourceSet resourceSet = new ResourceSetImpl();
		 Resource resource1 = resourceSet.createResource(URI.createURI(HibernateFactory.uri));
		 resource1.load(null);

I have following strange exception:
Caused by: java.lang.IncompatibleClassChangeError: Found interface org.hibernate.type.PrimitiveType, but class was expected
at org.eclipse.emf.teneo.hibernate.HbUtil.idToString(HbUtil.jav a:85)
at org.eclipse.emf.teneo.hibernate.resource.HibernateResource.g etURIFragment(HibernateResource.java:277)
at org.eclipse.emf.teneo.resource.StoreResource.attachedHelper( StoreResource.java:775)
at org.eclipse.emf.teneo.resource.StoreResource.attached(StoreR esource.java:681)
at org.eclipse.emf.teneo.resource.StoreResource.setEResource(St oreResource.java:843)
at org.eclipse.emf.teneo.resource.StoreResource.addToContent(St oreResource.java:326)
at org.eclipse.emf.teneo.resource.StoreResource.load(StoreResou rce.java:306)
at lv.psiers.wtp.Activator.start(Activator.java:65)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl$1 .run(BundleContextImpl.java:783)
at java.security.AccessController.doPrivileged(Native Method)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.s tartActivator(BundleContextImpl.java:774)
... 34 more

I can't understand, where can be problem?
Re: EMF hibernate resource problem [message #661002 is a reply to message #660936] Tue, 22 March 2011 16:03 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 30542
Registered: July 2009
Senior Member
Alex,

The only time I've seen this error is when the jar I'm running with
isn't compatible with the version against which the code was compiled.
Which version of Hibernate are you using?


Alex wrote:
> Hello guys. I have problem with Teneo/Hibernate/EMF Resource. I have
> hbdatastore initialize code:
>
> String dataStoreName = "WtpDataStore";
> dataStore = HbHelper.INSTANCE
> .createRegisterDataStore(dataStoreName);
> dataStore.setEPackages(new EPackage[] {
> WtpdbPackage.eINSTANCE });
>
> dataStore.getProperties().setProperty(PersistenceOptions.CAS CADE_POLICY_ON_NON_CONTAINMENT,
> "REFRESH,PERSIST,MERGE");
>
> dataStore.getProperties().setProperty(PersistenceOptions.INH ERITANCE_MAPPING,
> "JOINED");
> dataStore.initialize();
> sessionFactory = dataStore.getSessionFactory();
> uri =
> "hibernate://?"+HibernateResource.DS_NAME_PARAM+"="+dataStoreName;
>
> Then i'm creating resource in Activator.start method:
>
> ResourceSet resourceSet = new ResourceSetImpl();
> Resource resource1 =
> resourceSet.createResource(URI.createURI(HibernateFactory.ur i));
> resource1.load(null);
>
> I have following strange exception:
> Caused by: java.lang.IncompatibleClassChangeError: Found interface
> org.hibernate.type.PrimitiveType, but class was expected
> at org.eclipse.emf.teneo.hibernate.HbUtil.idToString(HbUtil.jav
> a:85)
> at org.eclipse.emf.teneo.hibernate.resource.HibernateResource.g
> etURIFragment(HibernateResource.java:277)
> at org.eclipse.emf.teneo.resource.StoreResource.attachedHelper(
> StoreResource.java:775)
> at org.eclipse.emf.teneo.resource.StoreResource.attached(StoreR
> esource.java:681)
> at org.eclipse.emf.teneo.resource.StoreResource.setEResource(St
> oreResource.java:843)
> at org.eclipse.emf.teneo.resource.StoreResource.addToContent(St
> oreResource.java:326)
> at org.eclipse.emf.teneo.resource.StoreResource.load(StoreResou
> rce.java:306)
> at lv.psiers.wtp.Activator.start(Activator.java:65)
> at org.eclipse.osgi.framework.internal.core.BundleContextImpl$1
> .run(BundleContextImpl.java:783)
> at java.security.AccessController.doPrivileged(Native Method)
> at org.eclipse.osgi.framework.internal.core.BundleContextImpl.s
> tartActivator(BundleContextImpl.java:774)
> ... 34 more
>
> I can't understand, where can be problem?
>
Re: EMF hibernate resource problem [message #661006 is a reply to message #661002] Tue, 22 March 2011 16:26 Go to previous message
Alex Mising name is currently offline Alex Mising nameFriend
Messages: 61
Registered: February 2011
Member
Year Ed, it's really was problem with hibernate.jar. Thank you
Previous Topic:[ATL] Debugger doesn't work
Next Topic:CDO server resource editor error
Goto Forum:
  


Current Time: Tue Oct 15 04:45:23 GMT 2019

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

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

Back to the top