Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [Teneo] Exploring... Can I use teneo mapped EMF with legacy EnitityManagerCode ?
[Teneo] Exploring... Can I use teneo mapped EMF with legacy EnitityManagerCode ? [message #111886] Thu, 07 February 2008 16:57 Go to next message
Eclipse UserFriend
Originally posted by: tom.eiswind.de

I think about switching my domain model to EMF. I have lots of
servercode thats based on standard JPA EntityManager. I saw that Teneo
has some custom things around that. Do I need this ? (Would be KO) Or
can I still use my existing JPA Code ?

Regards
Thomas
Re: [Teneo] Exploring... Can I use teneo mapped EMF with legacy EnitityManagerCode ? [message #111889 is a reply to message #111886] Thu, 07 February 2008 17:13 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: tom.eiswind.de

To be clear: I saw about HbEntityDataStore. Will I need it only to
create the mappings / schema ? Or is there more about it ?

I have the EntityManager injected with spring which is very nice and
gives me a transaction manager.
Re: [Teneo] Exploring... Can I use teneo mapped EMF with legacy EnitityManagerCode ? [message #111895 is a reply to message #111886] Thu, 07 February 2008 19:14 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
No you can't use your current jpa code. The code generated by emf should work out-of-the-box with
Teneo (and cdo) and should be directly persistable through hibernate.
Teneo works on the basis of information in the model and not in the generated code. Also with cdo
there is no generated code at the serverside, the generated code is only present at the client (Eike
please correct me if I am wrong).
The Teneo jpa approach is the idea that Teneo will automatically generate most or-mappings for you.
To handle specific cases you can override the default mapping approach using jpa annotations in the
model or in a separate annotations.xml file. The jpa annotations in the model follow the exact same
syntax as for standard jpa and the hibernate jpa extensions.

Out of interest, do you have a lot of jpa annotations in your code? If you have some examples then I
can comment if Teneo will cover this automatically for you.

This thread may also be of interest to you:
http://www.eclipsezone.com/eclipse/forums/m92225174.html

btw, the hibernate-cdo integration will still take a few days (a week) to be somewhat workable.

gr. Martin

Thomas wrote:
> I think about switching my domain model to EMF. I have lots of
> servercode thats based on standard JPA EntityManager. I saw that Teneo
> has some custom things around that. Do I need this ? (Would be KO) Or
> can I still use my existing JPA Code ?
>
> Regards
> Thomas


--

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: [Teneo] Exploring... Can I use teneo mapped EMF with legacy EnitityManagerCode ? [message #111897 is a reply to message #111889] Thu, 07 February 2008 19:40 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
The HbEntityDataStore makes it possible to use an entitymanager instead of the hibernate session.
I noticed that HbEntityDataStore should implement EntityManagerFactory. Then you can define it as a
bean with the id "entityManagerFactory" in a Spring applicationContext.xml. As far as I know Spring
should then use it automatically to create entitymanagers and inject them in your code.

In the next build (today or tomorrow) I will have this fixed.

When initializing the HbEntityDataStore in a applicationContext.xml then you should set three main
things:
hibernateProperties
persistenceProperties
epackages

The first two are basic properties. The last seems more difficult as the current method expects an
array of epackage instances. If required I can add a method which supports a list of Strings
(classnames of EPackage instance classes). This would be easier to initialize.

gr. Martin

Thomas wrote:
> To be clear: I saw about HbEntityDataStore. Will I need it only to
> create the mappings / schema ? Or is there more about it ?
>
> I have the EntityManager injected with spring which is very nice and
> gives me a transaction manager.


--

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: [Teneo] Exploring... Can I use teneo mapped EMF with legacy EnitityManagerCode ? [message #111901 is a reply to message #111895] Fri, 08 February 2008 09:39 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: tom.eiswind.de

HI Martin, Hi Eike,

I guess theres a misunderstanding. I understand that I need to use the
generated emf code for my model. But for now (depends if I decide to go
the cdo way though) I have services that do for e.g. a query on the
model an return the result to the client. If I can integrate the
HbEntityDatastore with spring that should still work without problems as
far as I can see.

If I dont go the cdo way (still to be decided...) I need fetchtype=Eager
an all relations. Is there a way to generate that as default ? with cdo
this problem would go away I know.

And another question on the ids. I read that the synthetic ids are
compared on object equality. that doesnt makes sense as I transfer them
through rmi. now I have strategy= AUTO on all my IDs to be db-independant.

And that goes to both of you. I had lot of trouble with id and version.
Guess I merge / persist and object, hibernate gives me (on merge) a new
instance (on persist) a modified instance with the new values of id and
version. i have to send that back to the client and completely rebind my
gui to that new instance. how is the behaviour if i use cdo ? are the
new values set on the existing instance or is it the same trouble ?

Regards Thomas



Martin Taal schrieb:
> No you can't use your current jpa code. The code generated by emf should
> work out-of-the-box with Teneo (and cdo) and should be directly
> persistable through hibernate.
> Teneo works on the basis of information in the model and not in the
> generated code. Also with cdo there is no generated code at the
> serverside, the generated code is only present at the client (Eike
> please correct me if I am wrong).
> The Teneo jpa approach is the idea that Teneo will automatically
> generate most or-mappings for you. To handle specific cases you can
> override the default mapping approach using jpa annotations in the model
> or in a separate annotations.xml file. The jpa annotations in the model
> follow the exact same syntax as for standard jpa and the hibernate jpa
> extensions.
>
> Out of interest, do you have a lot of jpa annotations in your code? If
> you have some examples then I can comment if Teneo will cover this
> automatically for you.
>
> This thread may also be of interest to you:
> http://www.eclipsezone.com/eclipse/forums/m92225174.html
>
> btw, the hibernate-cdo integration will still take a few days (a week)
> to be somewhat workable.
>
> gr. Martin
>
> Thomas wrote:
>> I think about switching my domain model to EMF. I have lots of
>> servercode thats based on standard JPA EntityManager. I saw that Teneo
>> has some custom things around that. Do I need this ? (Would be KO) Or
>> can I still use my existing JPA Code ?
>>
>> Regards
>> Thomas
>
>
Re: [Teneo] Exploring... Can I use teneo mapped EMF with legacy EnitityManagerCode ? [message #111909 is a reply to message #111901] Fri, 08 February 2008 12:42 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Thomas,
A few comments below.

gr. Martin

Thomas wrote:
> HI Martin, Hi Eike,
>
> I guess theres a misunderstanding. I understand that I need to use the
> generated emf code for my model. But for now (depends if I decide to go
> the cdo way though) I have services that do for e.g. a query on the
> model an return the result to the client. If I can integrate the
> HbEntityDatastore with spring that should still work without problems as
> far as I can see.
>
> If I dont go the cdo way (still to be decided...) I need fetchtype=Eager
> an all relations. Is there a way to generate that as default ? with cdo
> this problem would go away I know.
MT>> there is an option: FETCH_CONTAINMENT_EAGERLY in Teneo, but I think you mean fetch on all
associations. It would be possible for me to add this FETCH_NON_CONTAINMENT_EAGERLY. Just enter a
bugzilla for this if you want it.

>
> And another question on the ids. I read that the synthetic ids are
> compared on object equality. that doesnt makes sense as I transfer them
> through rmi. now I have strategy= AUTO on all my IDs to be db-independant.
MT>> Teneo does the mapping and some emf runtime functions. It does not add information to the
object itself. This means that if you don't have an id or version feature in your object that Teneo
has no way of keeping this information with the object when it travels from server to client and
back. To at least give some support the synthetic id and version are kept in a separate hashmap.
MT>> Let me know if you have any other method of doing this without object equality (and not adding
information to the object).
MT>> Overall my experience with Hibernate is that it is much easier if your objects have explicit id
features (and version features).

>
> And that goes to both of you. I had lot of trouble with id and version.
MT>> I am not sure if you mean this: the id and version are used by Hibernate to determine if the
object is new or that it is a detached instance which needs to be attached to the hibernate session.
The hibernate manual touches on this topic a few times: search for unsaved-value and transitive
reattachment.

> Guess I merge / persist and object, hibernate gives me (on merge) a new
> instance (on persist) a modified instance with the new values of id and
> version. i have to send that back to the client and completely rebind my
> gui to that new instance. how is the behaviour if i use cdo ? are the
> new values set on the existing instance or is it the same trouble ?
>
> Regards Thomas
>
>
>
> Martin Taal schrieb:
>> No you can't use your current jpa code. The code generated by emf
>> should work out-of-the-box with Teneo (and cdo) and should be directly
>> persistable through hibernate.
>> Teneo works on the basis of information in the model and not in the
>> generated code. Also with cdo there is no generated code at the
>> serverside, the generated code is only present at the client (Eike
>> please correct me if I am wrong).
>> The Teneo jpa approach is the idea that Teneo will automatically
>> generate most or-mappings for you. To handle specific cases you can
>> override the default mapping approach using jpa annotations in the
>> model or in a separate annotations.xml file. The jpa annotations in
>> the model follow the exact same syntax as for standard jpa and the
>> hibernate jpa extensions.
>>
>> Out of interest, do you have a lot of jpa annotations in your code? If
>> you have some examples then I can comment if Teneo will cover this
>> automatically for you.
>>
>> This thread may also be of interest to you:
>> http://www.eclipsezone.com/eclipse/forums/m92225174.html
>>
>> btw, the hibernate-cdo integration will still take a few days (a week)
>> to be somewhat workable.
>>
>> gr. Martin
>>
>> Thomas wrote:
>>> I think about switching my domain model to EMF. I have lots of
>>> servercode thats based on standard JPA EntityManager. I saw that
>>> Teneo has some custom things around that. Do I need this ? (Would be
>>> KO) Or can I still use my existing JPA Code ?
>>>
>>> Regards
>>> Thomas
>>
>>


--

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: [Teneo] Exploring... Can I use teneo mapped EMF with legacy EnitityManagerCode ? [message #111918 is a reply to message #111909] Fri, 08 February 2008 16:25 Go to previous message
Eclipse UserFriend
Originally posted by: tom.eiswind.de

See below ...

>> And another question on the ids. I read that the synthetic ids are
>> compared on object equality. that doesnt makes sense as I transfer
>> them through rmi. now I have strategy= AUTO on all my IDs to be
>> db-independant.
> MT>> Teneo does the mapping and some emf runtime functions. It does not
> add information to the object itself. This means that if you don't have
> an id or version feature in your object that Teneo has no way of keeping
> this information with the object when it travels from server to client
> and back. To at least give some support the synthetic id and version are
> kept in a separate hashmap.
> MT>> Let me know if you have any other method of doing this without
> object equality (and not adding information to the object).
> MT>> Overall my experience with Hibernate is that it is much easier if
> your objects have explicit id features (and version features).

Yes I see. This is the way to go.
>
>>
>> And that goes to both of you. I had lot of trouble with id and version.
> MT>> I am not sure if you mean this: the id and version are used by
> Hibernate to determine if the object is new or that it is a detached
> instance which needs to be attached to the hibernate session.
> The hibernate manual touches on this topic a few times: search for
> unsaved-value and transitive reattachment.
>
>> Guess I merge / persist and object, hibernate gives me (on merge) a
>> new instance (on persist) a modified instance with the new values of
>> id and version. i have to send that back to the client and completely
>> rebind my gui to that new instance. how is the behaviour if i use cdo
>> ? are the new values set on the existing instance or is it the same
>> trouble ?

this goes again to both of you, as i have no idea how you handle it. say
i have id and version features on my model. i have the id generated by
the database (sequence, identity column, hibernate decides what to do).

if you persist an object it gets an id. the object at client side needs
to learn about that id.

same with version. merge gives us a new version. the client object needs
to be updatet otherwise you will get conflicts on your next merge attempt.

in my current implementation i pass pack the changed instance to the
client and simply discard the old instance for the new one. means the i
have to rebind my whole gui (one can save an editor many times) to the
new instance. (i use databinding ..)
theres i reason behind why i do so, but i simply dont remember right
know. i just remember thinking some time about it ...:) I could have
overwritten the id and version, but there was a drawback on this, my
mind bugs me right now.

So long Thomas
Re: [Teneo] Exploring... Can I use teneo mapped EMF with legacy EnitityManagerCode ? [message #615439 is a reply to message #111886] Thu, 07 February 2008 17:13 Go to previous message
Thomas is currently offline ThomasFriend
Messages: 151
Registered: July 2009
Senior Member
To be clear: I saw about HbEntityDataStore. Will I need it only to
create the mappings / schema ? Or is there more about it ?

I have the EntityManager injected with spring which is very nice and
gives me a transaction manager.
Re: [Teneo] Exploring... Can I use teneo mapped EMF with legacy EnitityManagerCode ? [message #615445 is a reply to message #111886] Thu, 07 February 2008 19:14 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
No you can't use your current jpa code. The code generated by emf should work out-of-the-box with
Teneo (and cdo) and should be directly persistable through hibernate.
Teneo works on the basis of information in the model and not in the generated code. Also with cdo
there is no generated code at the serverside, the generated code is only present at the client (Eike
please correct me if I am wrong).
The Teneo jpa approach is the idea that Teneo will automatically generate most or-mappings for you.
To handle specific cases you can override the default mapping approach using jpa annotations in the
model or in a separate annotations.xml file. The jpa annotations in the model follow the exact same
syntax as for standard jpa and the hibernate jpa extensions.

Out of interest, do you have a lot of jpa annotations in your code? If you have some examples then I
can comment if Teneo will cover this automatically for you.

This thread may also be of interest to you:
http://www.eclipsezone.com/eclipse/forums/m92225174.html

btw, the hibernate-cdo integration will still take a few days (a week) to be somewhat workable.

gr. Martin

Thomas wrote:
> I think about switching my domain model to EMF. I have lots of
> servercode thats based on standard JPA EntityManager. I saw that Teneo
> has some custom things around that. Do I need this ? (Would be KO) Or
> can I still use my existing JPA Code ?
>
> Regards
> Thomas


--

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: [Teneo] Exploring... Can I use teneo mapped EMF with legacy EnitityManagerCode ? [message #615447 is a reply to message #111889] Thu, 07 February 2008 19:40 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
The HbEntityDataStore makes it possible to use an entitymanager instead of the hibernate session.
I noticed that HbEntityDataStore should implement EntityManagerFactory. Then you can define it as a
bean with the id "entityManagerFactory" in a Spring applicationContext.xml. As far as I know Spring
should then use it automatically to create entitymanagers and inject them in your code.

In the next build (today or tomorrow) I will have this fixed.

When initializing the HbEntityDataStore in a applicationContext.xml then you should set three main
things:
hibernateProperties
persistenceProperties
epackages

The first two are basic properties. The last seems more difficult as the current method expects an
array of epackage instances. If required I can add a method which supports a list of Strings
(classnames of EPackage instance classes). This would be easier to initialize.

gr. Martin

Thomas wrote:
> To be clear: I saw about HbEntityDataStore. Will I need it only to
> create the mappings / schema ? Or is there more about it ?
>
> I have the EntityManager injected with spring which is very nice and
> gives me a transaction manager.


--

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: [Teneo] Exploring... Can I use teneo mapped EMF with legacy EnitityManagerCode ? [message #615451 is a reply to message #111895] Fri, 08 February 2008 09:39 Go to previous message
Thomas is currently offline ThomasFriend
Messages: 151
Registered: July 2009
Senior Member
HI Martin, Hi Eike,

I guess theres a misunderstanding. I understand that I need to use the
generated emf code for my model. But for now (depends if I decide to go
the cdo way though) I have services that do for e.g. a query on the
model an return the result to the client. If I can integrate the
HbEntityDatastore with spring that should still work without problems as
far as I can see.

If I dont go the cdo way (still to be decided...) I need fetchtype=Eager
an all relations. Is there a way to generate that as default ? with cdo
this problem would go away I know.

And another question on the ids. I read that the synthetic ids are
compared on object equality. that doesnt makes sense as I transfer them
through rmi. now I have strategy= AUTO on all my IDs to be db-independant.

And that goes to both of you. I had lot of trouble with id and version.
Guess I merge / persist and object, hibernate gives me (on merge) a new
instance (on persist) a modified instance with the new values of id and
version. i have to send that back to the client and completely rebind my
gui to that new instance. how is the behaviour if i use cdo ? are the
new values set on the existing instance or is it the same trouble ?

Regards Thomas



Martin Taal schrieb:
> No you can't use your current jpa code. The code generated by emf should
> work out-of-the-box with Teneo (and cdo) and should be directly
> persistable through hibernate.
> Teneo works on the basis of information in the model and not in the
> generated code. Also with cdo there is no generated code at the
> serverside, the generated code is only present at the client (Eike
> please correct me if I am wrong).
> The Teneo jpa approach is the idea that Teneo will automatically
> generate most or-mappings for you. To handle specific cases you can
> override the default mapping approach using jpa annotations in the model
> or in a separate annotations.xml file. The jpa annotations in the model
> follow the exact same syntax as for standard jpa and the hibernate jpa
> extensions.
>
> Out of interest, do you have a lot of jpa annotations in your code? If
> you have some examples then I can comment if Teneo will cover this
> automatically for you.
>
> This thread may also be of interest to you:
> http://www.eclipsezone.com/eclipse/forums/m92225174.html
>
> btw, the hibernate-cdo integration will still take a few days (a week)
> to be somewhat workable.
>
> gr. Martin
>
> Thomas wrote:
>> I think about switching my domain model to EMF. I have lots of
>> servercode thats based on standard JPA EntityManager. I saw that Teneo
>> has some custom things around that. Do I need this ? (Would be KO) Or
>> can I still use my existing JPA Code ?
>>
>> Regards
>> Thomas
>
>
Re: [Teneo] Exploring... Can I use teneo mapped EMF with legacy EnitityManagerCode ? [message #615459 is a reply to message #111901] Fri, 08 February 2008 12:42 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Thomas,
A few comments below.

gr. Martin

Thomas wrote:
> HI Martin, Hi Eike,
>
> I guess theres a misunderstanding. I understand that I need to use the
> generated emf code for my model. But for now (depends if I decide to go
> the cdo way though) I have services that do for e.g. a query on the
> model an return the result to the client. If I can integrate the
> HbEntityDatastore with spring that should still work without problems as
> far as I can see.
>
> If I dont go the cdo way (still to be decided...) I need fetchtype=Eager
> an all relations. Is there a way to generate that as default ? with cdo
> this problem would go away I know.
MT>> there is an option: FETCH_CONTAINMENT_EAGERLY in Teneo, but I think you mean fetch on all
associations. It would be possible for me to add this FETCH_NON_CONTAINMENT_EAGERLY. Just enter a
bugzilla for this if you want it.

>
> And another question on the ids. I read that the synthetic ids are
> compared on object equality. that doesnt makes sense as I transfer them
> through rmi. now I have strategy= AUTO on all my IDs to be db-independant.
MT>> Teneo does the mapping and some emf runtime functions. It does not add information to the
object itself. This means that if you don't have an id or version feature in your object that Teneo
has no way of keeping this information with the object when it travels from server to client and
back. To at least give some support the synthetic id and version are kept in a separate hashmap.
MT>> Let me know if you have any other method of doing this without object equality (and not adding
information to the object).
MT>> Overall my experience with Hibernate is that it is much easier if your objects have explicit id
features (and version features).

>
> And that goes to both of you. I had lot of trouble with id and version.
MT>> I am not sure if you mean this: the id and version are used by Hibernate to determine if the
object is new or that it is a detached instance which needs to be attached to the hibernate session.
The hibernate manual touches on this topic a few times: search for unsaved-value and transitive
reattachment.

> Guess I merge / persist and object, hibernate gives me (on merge) a new
> instance (on persist) a modified instance with the new values of id and
> version. i have to send that back to the client and completely rebind my
> gui to that new instance. how is the behaviour if i use cdo ? are the
> new values set on the existing instance or is it the same trouble ?
>
> Regards Thomas
>
>
>
> Martin Taal schrieb:
>> No you can't use your current jpa code. The code generated by emf
>> should work out-of-the-box with Teneo (and cdo) and should be directly
>> persistable through hibernate.
>> Teneo works on the basis of information in the model and not in the
>> generated code. Also with cdo there is no generated code at the
>> serverside, the generated code is only present at the client (Eike
>> please correct me if I am wrong).
>> The Teneo jpa approach is the idea that Teneo will automatically
>> generate most or-mappings for you. To handle specific cases you can
>> override the default mapping approach using jpa annotations in the
>> model or in a separate annotations.xml file. The jpa annotations in
>> the model follow the exact same syntax as for standard jpa and the
>> hibernate jpa extensions.
>>
>> Out of interest, do you have a lot of jpa annotations in your code? If
>> you have some examples then I can comment if Teneo will cover this
>> automatically for you.
>>
>> This thread may also be of interest to you:
>> http://www.eclipsezone.com/eclipse/forums/m92225174.html
>>
>> btw, the hibernate-cdo integration will still take a few days (a week)
>> to be somewhat workable.
>>
>> gr. Martin
>>
>> Thomas wrote:
>>> I think about switching my domain model to EMF. I have lots of
>>> servercode thats based on standard JPA EntityManager. I saw that
>>> Teneo has some custom things around that. Do I need this ? (Would be
>>> KO) Or can I still use my existing JPA Code ?
>>>
>>> Regards
>>> Thomas
>>
>>


--

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: [Teneo] Exploring... Can I use teneo mapped EMF with legacy EnitityManagerCode ? [message #615468 is a reply to message #111909] Fri, 08 February 2008 16:25 Go to previous message
Thomas is currently offline ThomasFriend
Messages: 151
Registered: July 2009
Senior Member
See below ...

>> And another question on the ids. I read that the synthetic ids are
>> compared on object equality. that doesnt makes sense as I transfer
>> them through rmi. now I have strategy= AUTO on all my IDs to be
>> db-independant.
> MT>> Teneo does the mapping and some emf runtime functions. It does not
> add information to the object itself. This means that if you don't have
> an id or version feature in your object that Teneo has no way of keeping
> this information with the object when it travels from server to client
> and back. To at least give some support the synthetic id and version are
> kept in a separate hashmap.
> MT>> Let me know if you have any other method of doing this without
> object equality (and not adding information to the object).
> MT>> Overall my experience with Hibernate is that it is much easier if
> your objects have explicit id features (and version features).

Yes I see. This is the way to go.
>
>>
>> And that goes to both of you. I had lot of trouble with id and version.
> MT>> I am not sure if you mean this: the id and version are used by
> Hibernate to determine if the object is new or that it is a detached
> instance which needs to be attached to the hibernate session.
> The hibernate manual touches on this topic a few times: search for
> unsaved-value and transitive reattachment.
>
>> Guess I merge / persist and object, hibernate gives me (on merge) a
>> new instance (on persist) a modified instance with the new values of
>> id and version. i have to send that back to the client and completely
>> rebind my gui to that new instance. how is the behaviour if i use cdo
>> ? are the new values set on the existing instance or is it the same
>> trouble ?

this goes again to both of you, as i have no idea how you handle it. say
i have id and version features on my model. i have the id generated by
the database (sequence, identity column, hibernate decides what to do).

if you persist an object it gets an id. the object at client side needs
to learn about that id.

same with version. merge gives us a new version. the client object needs
to be updatet otherwise you will get conflicts on your next merge attempt.

in my current implementation i pass pack the changed instance to the
client and simply discard the old instance for the new one. means the i
have to rebind my whole gui (one can save an editor many times) to the
new instance. (i use databinding ..)
theres i reason behind why i do so, but i simply dont remember right
know. i just remember thinking some time about it ...:) I could have
overwritten the id and version, but there was a drawback on this, my
mind bugs me right now.

So long Thomas
Previous Topic:Making an EMF-Application extensible / non-standard way to access plug-in executableExtensions
Next Topic:[CDO] UI repository browser
Goto Forum:
  


Current Time: Thu Apr 18 14:48:21 GMT 2024

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

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

Back to the top