Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Teneo/EclipseLink/EMF find Object
Teneo/EclipseLink/EMF find Object [message #634767] Sat, 23 October 2010 10:08 Go to next message
Dennis Melzer is currently offline Dennis MelzerFriend
Messages: 244
Registered: July 2009
Senior Member
Hello,

How can I find a Object via EClass?
For Example EMF generates a interface Person and PersonImpl class. I generate with Teneo the orml.xml.
Now i want to find da Object with the entityManager.
But it doesn't work because the JPA layer doesn't know the interfaces.

java.lang.IllegalArgumentException: Unknown entity bean class: interface Person

	public DBObject find(EClass entityClass, Object primaryKey) {
		return (DBObject ) entityManager.find(entityClass.getInstanceClass(), primaryKey);
	}


How i can get the right class?

[Updated on: Sat, 23 October 2010 10:09]

Report message to a moderator

Re: Teneo/EclipseLink/EMF find Object [message #634775 is a reply to message #634767] Sat, 23 October 2010 12:23 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi,
Not the nicest approach but my first idea to get the implementation class for an eclass is this:
eClass.getEPackage().getEFactory().create(eClass).getClass()

You can iterate over all eclasses of an epackage and build a cache of eclass-->class mappings.

gr. Martin
Re: Teneo/EclipseLink/EMF find Object [message #635133 is a reply to message #634775] Mon, 25 October 2010 17:31 Go to previous message
Dennis Melzer is currently offline Dennis MelzerFriend
Messages: 244
Registered: July 2009
Senior Member
Martin taal wrote on Sat, 23 October 2010 08:23
Hi,
Not the nicest approach but my first idea to get the implementation class for an eclass is this:
eClass.getEPackage().getEFactory().create(eClass).getClass()

You can iterate over all eclasses of an epackage and build a cache of eclass-->class mappings.

gr. Martin


Thx =)
it's not very nice but better than nothing.
Other suggestions are always welcome.

Previous Topic:Use Case XMI generation
Next Topic:Teneo/EclipseLink/EMF/Blob
Goto Forum:
  


Current Time: Mon Oct 21 03:40:39 GMT 2019

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

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

Back to the top