|
Re: EMF - Teneo - Hibernate - Collection - Object [message #731916 is a reply to message #731911] |
Mon, 03 October 2011 13:19 |
Martin Taal Messages: 5468 Registered: July 2009 |
Senior Member |
|
|
Hi Herve,
I don't fully understand the question, but afaics the answer is yes you can store an object which has a list of objects.
gr. Martin
On 10/03/2011 03:13 PM, Herve Ferreira wrote:
> Hi have one Class that contains a property that's a collection of objects. All the objects are JPA entities, however,
> there are no relations between them.
>
> So, can I in some what store a class that contains a list of object?
>
> Thanks
--
With Regards, Martin Taal
Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
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: EMF - Teneo - Hibernate - Collection - Object [message #731987 is a reply to message #731916] |
Mon, 03 October 2011 15:44 |
Herve Ferreira Messages: 31 Registered: October 2011 |
Member |
|
|
Hi Martin
The entity that I want to store is something like this:
class Network
{
private String networkName = "someName";
private List<Router> routers
private List<EObject> myItems;//Problem relies here :(, how to store myItems
... Constuctors/Getters/Setters/....
}
and that I save/load the same object for both routers and myItems.
Router router = factory.createRouter();
Network net = factory.createNetwork();
net.getRouter().add(router);
net.getMyItem().add(router);
session.save(net);
I already tried to replace the EObject by EJavaObject (which is not clear the difference for me) but what I checked in the tests is that for EJavaObject the objects are basically serialized to a varchar field. When deserialized from the database different objects are created (for routers and myItems).
This means that-> net.getRouter().get(0) != net.getMyItem().get(0);
How can I store this then?
Thanks in Advance
[Updated on: Mon, 03 October 2011 15:46] Report message to a moderator
|
|
|
Re: EMF - Teneo - Hibernate - Collection - Object [message #732045 is a reply to message #731987] |
Mon, 03 October 2011 18:26 |
Martin Taal Messages: 5468 Registered: July 2009 |
Senior Member |
|
|
Hi Herve,
Not sure why this is a problem, this is like a standard case for Teneo to handle, or is the Network class not an EMF
object?
In that case (and if you are not doing an RCP), I advice to check out the Texo project which gives you better pojo
integration and standard JPA behavior.
http://wiki.eclipse.org/Texo
gr. Martin
On 10/03/2011 05:44 PM, Herve Ferreira wrote:
> Hi Martin
>
> The entity that I want to store is something like this:
>
>
> class Network
> {
> private String networkName = "someName";
> private List<Router> routers
> private List<EObject> myItems;//Problem relies here :(, how to store myItems
>
> ... Constuctors/Getters/Setters/....
> }
>
>
> and that I save/load the same object for both routers and myItems.
>
>
> Router router = factory.createRouter();
> Network net = factory.createNetwork();
>
> net.getRouter().add(router);
> net.getMyItem().add(router);
>
> session.save(net);
>
>
>
>
> I already tried to replace the EObject by EJavaObject (which is not clear the difference for me) but what I checked in
> the tests is that for EJavaObject the objects are basically serialized to a varchar field. When deserialized from the
> database different objects are created.
>
> This means that-> net.getRouter().get(0) != net.getMyItem().get(0);
>
> How can I store this then?
>
> Thanks in Advance
>
>
--
With Regards, Martin Taal
Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
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
|
|
|
|
Powered by
FUDForum. Page generated in 0.03716 seconds