Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » Using Ecore instrospection vs Java introspection in Teneo
Using Ecore instrospection vs Java introspection in Teneo [message #113183] Mon, 25 February 2008 17:17 Go to next message
Eclipse UserFriend
Originally posted by: ydewit.gmail.com

After I noticed a few Teneo classes adapting Ecore to Hibernate (namely:
EMFTuplizer, EMFComponentTuplizer, EMFInstantiator), I was wondering if
there is any support at this point for utilizing Ecore introspection
instead of Java's for all Hibernate property access.

The main reason I am interested in this is because I need to obfuscate my
application code and Ecore introspection is a great way to insulate the
obfuscation changes to classes from introspection clients such as
Hibernate (we have successfully done so in a few other cases).

I can also see the use for this in supporting the persistence of dynamic
Ecore models (not something we are interested at this point, but may be of
value to other people using Teneo).

If this is not yet implemented in Teneo, could any of you gives us an idea
of the complexity of implementing that? I'll happy to contribute this code
back to the community if there is an interest.

thanks in advance,

-- yuri
Re: Using Ecore instrospection vs Java introspection in Teneo [message #113222 is a reply to message #113183] Mon, 25 February 2008 17:55 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Yuri,
Teneo uses ecore introspection (if that is what you mean with the dynamic api). See the classes in
org.eclipse.emf.teneo.hibernate.mapping.* (and the subpackages). As a default Teneo uses the
hibernate map-mode.
This also means that Teneo supports dynamic emf (see http://www.elver.org/hibernate/dynamic.html).

There are specific cases where it is not possible to use the hibernate map-mode and a real
implementation class is required (as I remember when handling composite-ids). But these are only
fairly special cases.

During mapping Teneo will detect if an eclass has a implementation class and add this to the
mapping. This makes it possible for hibernate to use cglib proxies. However if an eclass does not
have an implementation java class (like with dynamic emf) then Teneo works fine also.
See also the javadoc with: PersistenceOptions.ALSO_MAP_AS_CLASS option.

Let me know if this answers your question.

Btw, I am always interested in contributions or feedback, so please feel free to improve/remark
where you can.

gr. Martin

Yuri de Wit wrote:
> After I noticed a few Teneo classes adapting Ecore to Hibernate (namely:
> EMFTuplizer, EMFComponentTuplizer, EMFInstantiator), I was wondering if
> there is any support at this point for utilizing Ecore introspection
> instead of Java's for all Hibernate property access.
>
> The main reason I am interested in this is because I need to obfuscate
> my application code and Ecore introspection is a great way to insulate
> the obfuscation changes to classes from introspection clients such as
> Hibernate (we have successfully done so in a few other cases).
> I can also see the use for this in supporting the persistence of dynamic
> Ecore models (not something we are interested at this point, but may be
> of value to other people using Teneo).
>
> If this is not yet implemented in Teneo, could any of you gives us an
> idea of the complexity of implementing that? I'll happy to contribute
> this code back to the community if there is an interest.
>
> thanks in advance,
> -- yuri
>
>
>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: Using Ecore instrospection vs Java introspection in Teneo [message #113249 is a reply to message #113183] Mon, 25 February 2008 18:22 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: ydewit.gmail.com

After browsing the source code I found a few property accessors for Ecore
(e.g. EAttributePropertyHandler) but it seems that I am getting an
exception while initializing Teneo:

javax.persistence.PersistenceException:
org.hibernate.PropertyNotFoundException: Could not find a getter for id in
class nr
at
org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactor y(Ejb3Configuration.java:737)
at
org.hibernate.ejb.Ejb3Configuration.createEntityManagerFacto ry(Ejb3Configuration.java:716)
at
org.eclipse.emf.teneo.hibernate.HbEntityDataStore.buildEntit yManagerFactory(HbEntityDataStore.java:168)
at
org.eclipse.emf.teneo.hibernate.HbEntityDataStore.initialize (HbEntityDataStore.java:85)
at ph.a(Unknown Source)
at os.b(Unknown Source)
at hm.a(Unknown Source)

Maybe the first part of Teneo initialization is using the standard
property accessors?
Re: Using Ecore instrospection vs Java introspection in Teneo [message #113262 is a reply to message #113222] Mon, 25 February 2008 18:36 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: ydewit.gmail.com

Hi Martin,

Yes, thanks, I just noticed this classes in the sources (see my other
earlier post). It is actually great to see that Teneo supports this
scenario out of the box.

However, it is not working in my case
I guess this thread turns then into a problem of this not working in a my
obfuscation scenario. I am still trying to digest the exception I am
getting, which seems to be thrown at initialization time. Somewhere in the
initialization Hibernate is trying to access my obfuscated EMF classes
using the standard Java introspection (so it seems). Here is the exception:

javax.persistence.PersistenceException:
org.hibernate.PropertyNotFoundException: Could not find a getter for id in
class nr
at
org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactor y(Ejb3Configuration.java:737)
at
org.hibernate.ejb.Ejb3Configuration.createEntityManagerFacto ry(Ejb3Configuration.java:716)
at
org.eclipse.emf.teneo.hibernate.HbEntityDataStore.buildEntit yManagerFactory(HbEntityDataStore.java:168)
at
org.eclipse.emf.teneo.hibernate.HbEntityDataStore.initialize (HbEntityDataStore.java:85)
at ph.a(Unknown Source)
at os.b(Unknown Source)
at hm.a(Unknown Source)

thanks,
-- yuri
Re: Using Ecore instrospection vs Java introspection in Teneo [message #113287 is a reply to message #113262] Mon, 25 February 2008 19:32 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: ydewit.gmail.com

Martin,

sorry for taking this in piece meal...

This is great! It seems that setting the teneo.mapping.also_map_as_class
to false does the job!

thanks for you help,

- yuri
Re: Using Ecore instrospection vs Java introspection in Teneo [message #113325 is a reply to message #113287] Tue, 26 February 2008 07:37 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Yuri,
Good that it works, but I don't understand why it was a problem and this solves it... Let me know if
you accidently get more background info then I can adapt the docs.

The stacktrace shows the same exception I got in case of composite ids, there are some (rare) cases
(like composite ids) where hibernate will try to find the getter/setter for the id-property on its
own and not uses the emftuplizer supplied by Teneo.

gr. Martin

Yuri de Wit wrote:
> Martin,
> sorry for taking this in piece meal...
> This is great! It seems that setting the teneo.mapping.also_map_as_class
> to false does the job!
> thanks for you help,
>
> - yuri
>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: Using Ecore instrospection vs Java introspection in Teneo [message #113406 is a reply to message #113325] Tue, 26 February 2008 22:14 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: ydewit.gmail.com

Martin Taal wrote:

> Hi Yuri,
> Good that it works, but I don't understand why it was a problem and this
solves it... Let me know if
> you accidently get more background info then I can adapt the docs.

> The stacktrace shows the same exception I got in case of composite ids,
there are some (rare) cases
> (like composite ids) where hibernate will try to find the getter/setter for
the id-property on its
> own and not uses the emftuplizer supplied by Teneo.

> gr. Martin

> Yuri de Wit wrote:
>> Martin,
>> sorry for taking this in piece meal...
>> This is great! It seems that setting the teneo.mapping.also_map_as_class
>> to false does the job!
>> thanks for you help,
>>
>> - yuri
>> Martin,

Yes, I hit another problem further down the line....

The teneo.mapping.also_map_as_class seems to have gotten me past the
Hibernate initialization and schema update.

However, I just hit a problem trying to persist an obfuscated EMF object
using Teneo. Basically a NPE in EListPropertyHandler @ line 251: javaField
is null. The exception makes sense since it is using Java instrospection
to find the set method instead of relying on eClass.

Does this make sense to you? Anything different I could try?

thanks,

-- yuri

The exception:
java.lang.NullPointerException
at
org.eclipse.emf.teneo.hibernate.mapping.property.EListProper tyHandler.set(EListPropertyHandler.java:293)
at
org.hibernate.tuple.entity.AbstractEntityTuplizer.setPropert yValues(AbstractEntityTuplizer.java:337)
at
org.hibernate.persister.entity.AbstractEntityPersister.setPr opertyValues(AbstractEntityPersister.java:3566)
at
org.hibernate.event.def.AbstractSaveEventListener.performSav eOrReplicate(AbstractSaveEventListener.java:277)
at
org.hibernate.event.def.AbstractSaveEventListener.performSav e(AbstractSaveEventListener.java:181)
at
org.hibernate.event.def.AbstractSaveEventListener.saveWithGe neratedId(AbstractSaveEventListener.java:121)
at
org.hibernate.ejb.event.EJB3PersistEventListener.saveWithGen eratedId(EJB3PersistEventListener.java:49)
at
org.hibernate.event.def.DefaultPersistEventListener.entityIs Transient(DefaultPersistEventListener.java:131)
at
org.hibernate.event.def.DefaultPersistEventListener.onPersis t(DefaultPersistEventListener.java:87)
at
org.hibernate.event.def.DefaultPersistEventListener.onPersis t(DefaultPersistEventListener.java:38)
at org.hibernate.impl.SessionImpl.firePersist(SessionImpl.java: 618)
at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:592)
at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:596)
at
org.hibernate.ejb.AbstractEntityManagerImpl.persist(Abstract EntityManagerImpl.java:213)
Re: Using Ecore instrospection vs Java introspection in Teneo [message #113432 is a reply to message #113406] Wed, 27 February 2008 09:22 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Yuri,
This can probably be changed to make the elistpropertyhandler also use the
EcoreAccess.setManyEFeatureValue method. However, you have to wait for me to fix this (maybe I have
time this evening to look at it, otherwise tomorrow) or implement your own EListPropertyHandler and
set it as an extension:
http://www.elver.org/hibernate/extensions.html

gr. Martin

Yuri de Wit wrote:
> Martin Taal wrote:
>
>> Hi Yuri,
>> Good that it works, but I don't understand why it was a problem and this
> solves it... Let me know if
>> you accidently get more background info then I can adapt the docs.
>
>> The stacktrace shows the same exception I got in case of composite ids,
> there are some (rare) cases
>> (like composite ids) where hibernate will try to find the
>> getter/setter for
> the id-property on its
>> own and not uses the emftuplizer supplied by Teneo.
>
>> gr. Martin
>
>> Yuri de Wit wrote:
>>> Martin,
>>> sorry for taking this in piece meal...
>>> This is great! It seems that setting the
>>> teneo.mapping.also_map_as_class to false does the job!
>>> thanks for you help,
>>>
>>> - yuri
>>> Martin,
>
> Yes, I hit another problem further down the line....
>
> The teneo.mapping.also_map_as_class seems to have gotten me past the
> Hibernate initialization and schema update.
> However, I just hit a problem trying to persist an obfuscated EMF object
> using Teneo. Basically a NPE in EListPropertyHandler @ line 251:
> javaField is null. The exception makes sense since it is using Java
> instrospection to find the set method instead of relying on eClass.
>
> Does this make sense to you? Anything different I could try?
>
> thanks,
>
> -- yuri
>
> The exception:
> java.lang.NullPointerException
> at
> org.eclipse.emf.teneo.hibernate.mapping.property.EListProper tyHandler.set(EListPropertyHandler.java:293)
>
> at
> org.hibernate.tuple.entity.AbstractEntityTuplizer.setPropert yValues(AbstractEntityTuplizer.java:337)
>
> at
> org.hibernate.persister.entity.AbstractEntityPersister.setPr opertyValues(AbstractEntityPersister.java:3566)
>
> at
> org.hibernate.event.def.AbstractSaveEventListener.performSav eOrReplicate(AbstractSaveEventListener.java:277)
>
> at
> org.hibernate.event.def.AbstractSaveEventListener.performSav e(AbstractSaveEventListener.java:181)
>
> at
> org.hibernate.event.def.AbstractSaveEventListener.saveWithGe neratedId(AbstractSaveEventListener.java:121)
>
> at
> org.hibernate.ejb.event.EJB3PersistEventListener.saveWithGen eratedId(EJB3PersistEventListener.java:49)
>
> at
> org.hibernate.event.def.DefaultPersistEventListener.entityIs Transient(DefaultPersistEventListener.java:131)
>
> at
> org.hibernate.event.def.DefaultPersistEventListener.onPersis t(DefaultPersistEventListener.java:87)
>
> at
> org.hibernate.event.def.DefaultPersistEventListener.onPersis t(DefaultPersistEventListener.java:38)
>
> at org.hibernate.impl.SessionImpl.firePersist(SessionImpl.java: 618)
> at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:592)
> at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:596)
> at
> org.hibernate.ejb.AbstractEntityManagerImpl.persist(Abstract EntityManagerImpl.java:213)
>
>
>
>
>
>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: Using Ecore instrospection vs Java introspection in Teneo [message #113472 is a reply to message #113432] Wed, 27 February 2008 19:18 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: ydewit.gmail.com

Martin,

Thanks for your help!

I will take in your changes, but I will have, most likely, have to create
my own custom lib with your changes added. The reason is that I am using
Teneo's release 200709051239 against EMF 2.2.v200606271057 and afaik the
latest Teneo release depends on the newer EMF 2.3 (for a variety of
reasons we werent able to upgrade so far).

In any case, I am working on a patch trying to anticipate yours and I am
getting a strange error in Eclipse (works compiling straight from javac
5.0):

----
Severity and Description Path Resource Location Creation Time Id
The type DelegatingEcoreEList is not generic; it cannot be parameterized
with arguments <E> TeneoServicesFactory.java line 1 1204131581095 82200
----

Yes, my JDK is 5.0 and the source compatibility is set to 5.0 (the
default). The only caveat is that I am using the older Teneo's release
with a non-generics EMF 2.2 (as described above). Maybe this release of
Teneo was compiled with a generics version of EMF and Eclipse compiler
doesnt like that? Not sure.

thanks,

-- yuri
Re: Using Ecore instrospection vs Java introspection in Teneo [message #113485 is a reply to message #113472] Thu, 28 February 2008 06:39 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Yuri,
The 200709051239 build has been built against emf 2.3 and it was built using 5.0/1.5, see here:
http://download.eclipse.org/modeling/emft/teneo/downloads/dr ops/0.8.0/I200709051239/build.cfg

For emf 2.2 (and jdk 1.4) you should use the Teneo 0.7.5 build (latest build was in april 2007).
But I am afraid that the 0.7.5 build is not maintained actively...

gr. Martin

Yuri de Wit wrote:
> Martin,
> Thanks for your help!
> I will take in your changes, but I will have, most likely, have to
> create my own custom lib with your changes added. The reason is that I
> am using Teneo's release 200709051239 against EMF 2.2.v200606271057 and
> afaik the latest Teneo release depends on the newer EMF 2.3 (for a
> variety of reasons we werent able to upgrade so far).
>
> In any case, I am working on a patch trying to anticipate yours and I am
> getting a strange error in Eclipse (works compiling straight from javac
> 5.0):
>
> ----
> Severity and Description Path Resource Location Creation
> Time Id
> The type DelegatingEcoreEList is not generic; it cannot be parameterized
> with arguments <E> TeneoServicesFactory.java line 1
> 1204131581095 82200
> ----
>
> Yes, my JDK is 5.0 and the source compatibility is set to 5.0 (the
> default). The only caveat is that I am using the older Teneo's release
> with a non-generics EMF 2.2 (as described above). Maybe this release of
> Teneo was compiled with a generics version of EMF and Eclipse compiler
> doesnt like that? Not sure.
>
> thanks,
>
> -- yuri
>
>
>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: Using Ecore instrospection vs Java introspection in Teneo [message #113770 is a reply to message #113485] Tue, 04 March 2008 03:11 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: ydewit.gmail.com

Hi Martin,

Yes, we have been using 0.8 with emf 2.2 for a few months now without
problems except for this compile error in eclipse, which seems to be an
eclipse compiler issue since compiling using the JDK works fine.

Any ideas regarding the EListPropertyHandler. I tried to patch it but got
into an Hibernate exception trying to persist and was then busy with other
stuff in the meantime.

thanks,

-- yuri
Re: Using Ecore instrospection vs Java introspection in Teneo [message #113794 is a reply to message #113770] Tue, 04 March 2008 08:56 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Yuri,
I have not yet had time to look at the elistpropertyhandler thing. Something I just thought of now.
As I remember you can force emf to use the dynamic features instead of static features (i.e. members
in generated java classes). Can you try to set the genmodel option 'Feature Delegation' to
'reflective' and then regenerate (and obfuscate) your code? Possibly Teneo will then see all
features as dynamic. You will loose all your java members but you can access them through the
getters/setters anyway.
It is a try so I am not sure if it works...

gr. Martin

Yuri de Wit wrote:
> Hi Martin,
> Yes, we have been using 0.8 with emf 2.2 for a few months now without
> problems except for this compile error in eclipse, which seems to be an
> eclipse compiler issue since compiling using the JDK works fine.
>
> Any ideas regarding the EListPropertyHandler. I tried to patch it but
> got into an Hibernate exception trying to persist and was then busy with
> other stuff in the meantime.
>
> thanks,
>
> -- yuri
>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: Using Ecore instrospection vs Java introspection in Teneo [message #615559 is a reply to message #113183] Mon, 25 February 2008 17:55 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Yuri,
Teneo uses ecore introspection (if that is what you mean with the dynamic api). See the classes in
org.eclipse.emf.teneo.hibernate.mapping.* (and the subpackages). As a default Teneo uses the
hibernate map-mode.
This also means that Teneo supports dynamic emf (see http://www.elver.org/hibernate/dynamic.html).

There are specific cases where it is not possible to use the hibernate map-mode and a real
implementation class is required (as I remember when handling composite-ids). But these are only
fairly special cases.

During mapping Teneo will detect if an eclass has a implementation class and add this to the
mapping. This makes it possible for hibernate to use cglib proxies. However if an eclass does not
have an implementation java class (like with dynamic emf) then Teneo works fine also.
See also the javadoc with: PersistenceOptions.ALSO_MAP_AS_CLASS option.

Let me know if this answers your question.

Btw, I am always interested in contributions or feedback, so please feel free to improve/remark
where you can.

gr. Martin

Yuri de Wit wrote:
> After I noticed a few Teneo classes adapting Ecore to Hibernate (namely:
> EMFTuplizer, EMFComponentTuplizer, EMFInstantiator), I was wondering if
> there is any support at this point for utilizing Ecore introspection
> instead of Java's for all Hibernate property access.
>
> The main reason I am interested in this is because I need to obfuscate
> my application code and Ecore introspection is a great way to insulate
> the obfuscation changes to classes from introspection clients such as
> Hibernate (we have successfully done so in a few other cases).
> I can also see the use for this in supporting the persistence of dynamic
> Ecore models (not something we are interested at this point, but may be
> of value to other people using Teneo).
>
> If this is not yet implemented in Teneo, could any of you gives us an
> idea of the complexity of implementing that? I'll happy to contribute
> this code back to the community if there is an interest.
>
> thanks in advance,
> -- yuri
>
>
>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: Using Ecore instrospection vs Java introspection in Teneo [message #615561 is a reply to message #113183] Mon, 25 February 2008 18:22 Go to previous message
Lemao  is currently offline Lemao Friend
Messages: 48
Registered: December 2009
Member
After browsing the source code I found a few property accessors for Ecore
(e.g. EAttributePropertyHandler) but it seems that I am getting an
exception while initializing Teneo:

javax.persistence.PersistenceException:
org.hibernate.PropertyNotFoundException: Could not find a getter for id in
class nr
at
org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactor y(Ejb3Configuration.java:737)
at
org.hibernate.ejb.Ejb3Configuration.createEntityManagerFacto ry(Ejb3Configuration.java:716)
at
org.eclipse.emf.teneo.hibernate.HbEntityDataStore.buildEntit yManagerFactory(HbEntityDataStore.java:168)
at
org.eclipse.emf.teneo.hibernate.HbEntityDataStore.initialize (HbEntityDataStore.java:85)
at ph.a(Unknown Source)
at os.b(Unknown Source)
at hm.a(Unknown Source)

Maybe the first part of Teneo initialization is using the standard
property accessors?
Re: Using Ecore instrospection vs Java introspection in Teneo [message #615562 is a reply to message #113222] Mon, 25 February 2008 18:36 Go to previous message
Lemao  is currently offline Lemao Friend
Messages: 48
Registered: December 2009
Member
Hi Martin,

Yes, thanks, I just noticed this classes in the sources (see my other
earlier post). It is actually great to see that Teneo supports this
scenario out of the box.

However, it is not working in my case
I guess this thread turns then into a problem of this not working in a my
obfuscation scenario. I am still trying to digest the exception I am
getting, which seems to be thrown at initialization time. Somewhere in the
initialization Hibernate is trying to access my obfuscated EMF classes
using the standard Java introspection (so it seems). Here is the exception:

javax.persistence.PersistenceException:
org.hibernate.PropertyNotFoundException: Could not find a getter for id in
class nr
at
org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactor y(Ejb3Configuration.java:737)
at
org.hibernate.ejb.Ejb3Configuration.createEntityManagerFacto ry(Ejb3Configuration.java:716)
at
org.eclipse.emf.teneo.hibernate.HbEntityDataStore.buildEntit yManagerFactory(HbEntityDataStore.java:168)
at
org.eclipse.emf.teneo.hibernate.HbEntityDataStore.initialize (HbEntityDataStore.java:85)
at ph.a(Unknown Source)
at os.b(Unknown Source)
at hm.a(Unknown Source)

thanks,
-- yuri
Re: Using Ecore instrospection vs Java introspection in Teneo [message #615564 is a reply to message #113262] Mon, 25 February 2008 19:32 Go to previous message
Lemao  is currently offline Lemao Friend
Messages: 48
Registered: December 2009
Member
Martin,

sorry for taking this in piece meal...

This is great! It seems that setting the teneo.mapping.also_map_as_class
to false does the job!

thanks for you help,

- yuri
Re: Using Ecore instrospection vs Java introspection in Teneo [message #615567 is a reply to message #113287] Tue, 26 February 2008 07:37 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Yuri,
Good that it works, but I don't understand why it was a problem and this solves it... Let me know if
you accidently get more background info then I can adapt the docs.

The stacktrace shows the same exception I got in case of composite ids, there are some (rare) cases
(like composite ids) where hibernate will try to find the getter/setter for the id-property on its
own and not uses the emftuplizer supplied by Teneo.

gr. Martin

Yuri de Wit wrote:
> Martin,
> sorry for taking this in piece meal...
> This is great! It seems that setting the teneo.mapping.also_map_as_class
> to false does the job!
> thanks for you help,
>
> - yuri
>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: Using Ecore instrospection vs Java introspection in Teneo [message #615573 is a reply to message #113325] Tue, 26 February 2008 22:14 Go to previous message
Lemao  is currently offline Lemao Friend
Messages: 48
Registered: December 2009
Member
Martin Taal wrote:

> Hi Yuri,
> Good that it works, but I don't understand why it was a problem and this
solves it... Let me know if
> you accidently get more background info then I can adapt the docs.

> The stacktrace shows the same exception I got in case of composite ids,
there are some (rare) cases
> (like composite ids) where hibernate will try to find the getter/setter for
the id-property on its
> own and not uses the emftuplizer supplied by Teneo.

> gr. Martin

> Yuri de Wit wrote:
>> Martin,
>> sorry for taking this in piece meal...
>> This is great! It seems that setting the teneo.mapping.also_map_as_class
>> to false does the job!
>> thanks for you help,
>>
>> - yuri
>> Martin,

Yes, I hit another problem further down the line....

The teneo.mapping.also_map_as_class seems to have gotten me past the
Hibernate initialization and schema update.

However, I just hit a problem trying to persist an obfuscated EMF object
using Teneo. Basically a NPE in EListPropertyHandler @ line 251: javaField
is null. The exception makes sense since it is using Java instrospection
to find the set method instead of relying on eClass.

Does this make sense to you? Anything different I could try?

thanks,

-- yuri

The exception:
java.lang.NullPointerException
at
org.eclipse.emf.teneo.hibernate.mapping.property.EListProper tyHandler.set(EListPropertyHandler.java:293)
at
org.hibernate.tuple.entity.AbstractEntityTuplizer.setPropert yValues(AbstractEntityTuplizer.java:337)
at
org.hibernate.persister.entity.AbstractEntityPersister.setPr opertyValues(AbstractEntityPersister.java:3566)
at
org.hibernate.event.def.AbstractSaveEventListener.performSav eOrReplicate(AbstractSaveEventListener.java:277)
at
org.hibernate.event.def.AbstractSaveEventListener.performSav e(AbstractSaveEventListener.java:181)
at
org.hibernate.event.def.AbstractSaveEventListener.saveWithGe neratedId(AbstractSaveEventListener.java:121)
at
org.hibernate.ejb.event.EJB3PersistEventListener.saveWithGen eratedId(EJB3PersistEventListener.java:49)
at
org.hibernate.event.def.DefaultPersistEventListener.entityIs Transient(DefaultPersistEventListener.java:131)
at
org.hibernate.event.def.DefaultPersistEventListener.onPersis t(DefaultPersistEventListener.java:87)
at
org.hibernate.event.def.DefaultPersistEventListener.onPersis t(DefaultPersistEventListener.java:38)
at org.hibernate.impl.SessionImpl.firePersist(SessionImpl.java: 618)
at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:592)
at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:596)
at
org.hibernate.ejb.AbstractEntityManagerImpl.persist(Abstract EntityManagerImpl.java:213)
Re: Using Ecore instrospection vs Java introspection in Teneo [message #615575 is a reply to message #113406] Wed, 27 February 2008 09:22 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Yuri,
This can probably be changed to make the elistpropertyhandler also use the
EcoreAccess.setManyEFeatureValue method. However, you have to wait for me to fix this (maybe I have
time this evening to look at it, otherwise tomorrow) or implement your own EListPropertyHandler and
set it as an extension:
http://www.elver.org/hibernate/extensions.html

gr. Martin

Yuri de Wit wrote:
> Martin Taal wrote:
>
>> Hi Yuri,
>> Good that it works, but I don't understand why it was a problem and this
> solves it... Let me know if
>> you accidently get more background info then I can adapt the docs.
>
>> The stacktrace shows the same exception I got in case of composite ids,
> there are some (rare) cases
>> (like composite ids) where hibernate will try to find the
>> getter/setter for
> the id-property on its
>> own and not uses the emftuplizer supplied by Teneo.
>
>> gr. Martin
>
>> Yuri de Wit wrote:
>>> Martin,
>>> sorry for taking this in piece meal...
>>> This is great! It seems that setting the
>>> teneo.mapping.also_map_as_class to false does the job!
>>> thanks for you help,
>>>
>>> - yuri
>>> Martin,
>
> Yes, I hit another problem further down the line....
>
> The teneo.mapping.also_map_as_class seems to have gotten me past the
> Hibernate initialization and schema update.
> However, I just hit a problem trying to persist an obfuscated EMF object
> using Teneo. Basically a NPE in EListPropertyHandler @ line 251:
> javaField is null. The exception makes sense since it is using Java
> instrospection to find the set method instead of relying on eClass.
>
> Does this make sense to you? Anything different I could try?
>
> thanks,
>
> -- yuri
>
> The exception:
> java.lang.NullPointerException
> at
> org.eclipse.emf.teneo.hibernate.mapping.property.EListProper tyHandler.set(EListPropertyHandler.java:293)
>
> at
> org.hibernate.tuple.entity.AbstractEntityTuplizer.setPropert yValues(AbstractEntityTuplizer.java:337)
>
> at
> org.hibernate.persister.entity.AbstractEntityPersister.setPr opertyValues(AbstractEntityPersister.java:3566)
>
> at
> org.hibernate.event.def.AbstractSaveEventListener.performSav eOrReplicate(AbstractSaveEventListener.java:277)
>
> at
> org.hibernate.event.def.AbstractSaveEventListener.performSav e(AbstractSaveEventListener.java:181)
>
> at
> org.hibernate.event.def.AbstractSaveEventListener.saveWithGe neratedId(AbstractSaveEventListener.java:121)
>
> at
> org.hibernate.ejb.event.EJB3PersistEventListener.saveWithGen eratedId(EJB3PersistEventListener.java:49)
>
> at
> org.hibernate.event.def.DefaultPersistEventListener.entityIs Transient(DefaultPersistEventListener.java:131)
>
> at
> org.hibernate.event.def.DefaultPersistEventListener.onPersis t(DefaultPersistEventListener.java:87)
>
> at
> org.hibernate.event.def.DefaultPersistEventListener.onPersis t(DefaultPersistEventListener.java:38)
>
> at org.hibernate.impl.SessionImpl.firePersist(SessionImpl.java: 618)
> at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:592)
> at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:596)
> at
> org.hibernate.ejb.AbstractEntityManagerImpl.persist(Abstract EntityManagerImpl.java:213)
>
>
>
>
>
>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: Using Ecore instrospection vs Java introspection in Teneo [message #615578 is a reply to message #113432] Wed, 27 February 2008 19:18 Go to previous message
Lemao  is currently offline Lemao Friend
Messages: 48
Registered: December 2009
Member
Martin,

Thanks for your help!

I will take in your changes, but I will have, most likely, have to create
my own custom lib with your changes added. The reason is that I am using
Teneo's release 200709051239 against EMF 2.2.v200606271057 and afaik the
latest Teneo release depends on the newer EMF 2.3 (for a variety of
reasons we werent able to upgrade so far).

In any case, I am working on a patch trying to anticipate yours and I am
getting a strange error in Eclipse (works compiling straight from javac
5.0):

----
Severity and Description Path Resource Location Creation Time Id
The type DelegatingEcoreEList is not generic; it cannot be parameterized
with arguments <E> TeneoServicesFactory.java line 1 1204131581095 82200
----

Yes, my JDK is 5.0 and the source compatibility is set to 5.0 (the
default). The only caveat is that I am using the older Teneo's release
with a non-generics EMF 2.2 (as described above). Maybe this release of
Teneo was compiled with a generics version of EMF and Eclipse compiler
doesnt like that? Not sure.

thanks,

-- yuri
Re: Using Ecore instrospection vs Java introspection in Teneo [message #615579 is a reply to message #113472] Thu, 28 February 2008 06:39 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Yuri,
The 200709051239 build has been built against emf 2.3 and it was built using 5.0/1.5, see here:
http://download.eclipse.org/modeling/emft/teneo/downloads/dr ops/0.8.0/I200709051239/build.cfg

For emf 2.2 (and jdk 1.4) you should use the Teneo 0.7.5 build (latest build was in april 2007).
But I am afraid that the 0.7.5 build is not maintained actively...

gr. Martin

Yuri de Wit wrote:
> Martin,
> Thanks for your help!
> I will take in your changes, but I will have, most likely, have to
> create my own custom lib with your changes added. The reason is that I
> am using Teneo's release 200709051239 against EMF 2.2.v200606271057 and
> afaik the latest Teneo release depends on the newer EMF 2.3 (for a
> variety of reasons we werent able to upgrade so far).
>
> In any case, I am working on a patch trying to anticipate yours and I am
> getting a strange error in Eclipse (works compiling straight from javac
> 5.0):
>
> ----
> Severity and Description Path Resource Location Creation
> Time Id
> The type DelegatingEcoreEList is not generic; it cannot be parameterized
> with arguments <E> TeneoServicesFactory.java line 1
> 1204131581095 82200
> ----
>
> Yes, my JDK is 5.0 and the source compatibility is set to 5.0 (the
> default). The only caveat is that I am using the older Teneo's release
> with a non-generics EMF 2.2 (as described above). Maybe this release of
> Teneo was compiled with a generics version of EMF and Eclipse compiler
> doesnt like that? Not sure.
>
> thanks,
>
> -- yuri
>
>
>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: Using Ecore instrospection vs Java introspection in Teneo [message #615600 is a reply to message #113485] Tue, 04 March 2008 03:11 Go to previous message
Lemao  is currently offline Lemao Friend
Messages: 48
Registered: December 2009
Member
Hi Martin,

Yes, we have been using 0.8 with emf 2.2 for a few months now without
problems except for this compile error in eclipse, which seems to be an
eclipse compiler issue since compiling using the JDK works fine.

Any ideas regarding the EListPropertyHandler. I tried to patch it but got
into an Hibernate exception trying to persist and was then busy with other
stuff in the meantime.

thanks,

-- yuri
Re: Using Ecore instrospection vs Java introspection in Teneo [message #615602 is a reply to message #113770] Tue, 04 March 2008 08:56 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Yuri,
I have not yet had time to look at the elistpropertyhandler thing. Something I just thought of now.
As I remember you can force emf to use the dynamic features instead of static features (i.e. members
in generated java classes). Can you try to set the genmodel option 'Feature Delegation' to
'reflective' and then regenerate (and obfuscate) your code? Possibly Teneo will then see all
features as dynamic. You will loose all your java members but you can access them through the
getters/setters anyway.
It is a try so I am not sure if it works...

gr. Martin

Yuri de Wit wrote:
> Hi Martin,
> Yes, we have been using 0.8 with emf 2.2 for a few months now without
> problems except for this compile error in eclipse, which seems to be an
> eclipse compiler issue since compiling using the JDK works fine.
>
> Any ideas regarding the EListPropertyHandler. I tried to patch it but
> got into an Hibernate exception trying to persist and was then busy with
> other stuff in the meantime.
>
> thanks,
>
> -- yuri
>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Previous Topic:[TENEO] [JDO] library tutorial - connection getting closed
Next Topic:[Teneo] What is the best way to check if EMF resource has been updated in the datastore?
Goto Forum:
  


Current Time: Thu Jun 24 19:48:46 GMT 2021

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

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

Back to the top