Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » Teneo and Hibernate's Session.load() issue
Teneo and Hibernate's Session.load() issue [message #620158] Tue, 29 July 2008 15:59
Mikhail Kadan is currently offline Mikhail KadanFriend
Messages: 61
Registered: July 2009
Member
Hi.

I have EMF model, which defines only one class "A", without any
attrinutes. I map this to DB using Teneo/Hibernate:

...
session.beginTransaction();

A a = TestFactory.eINSTANCE.createA();
Long aId = (Long) session.save(a);

session.getTransaction().commit();
...

Ok. Then I try to load this object from DB:

A a2 = (A) session.load("A", aId);

Works fine. But I need to load objects from DB not by EMF name, but by
interface/instance name/class. Hibernate provides me with such method:

A a3 = (A) session.load(A.class, aId);

But it fails with:

org.hibernate.MappingException: Unknown entity: test.A

So I look into generated "hibernate.hbm.xml":

<class name="test.impl.AImpl" entity-name="A" ...

So what do I think? Maybe Teneo places invalid value into "entity-name"
attribute for class mapping, so I cannot load classes by interface, and
have to provide name string w/o package specification? Of cource, I can
always get this string by traversing through EPackage.Registry, but its
very perfomance damaging option.

Thanks.
Previous Topic:Re: org.eclipse.emf.mwe?
Next Topic:[EMF Compare] How to deactivate
Goto Forum:
  


Current Time: Thu Apr 09 14:49:41 GMT 2020

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

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

Back to the top