Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Populating EMF Resource using default serialization and Non-containment from Database - Want to avoi
Populating EMF Resource using default serialization and Non-containment from Database - Want to avoi [message #482263] Tue, 25 August 2009 21:54 Go to next message
Richard Catlin is currently offline Richard CatlinFriend
Messages: 50
Registered: July 2009
Member
I am populating an Ecore model using the default serialization from a
database.

Object A has a many-to-many relationship with Object B

I am using JPA to build a tree from the database, traverse it, and
persist to the Ecore default serialization.

The problem I am encountering is that several Object A may point to
Object B, so when I traverse the tree, I want to check the Resource to
see if Object B has already been added.

What the best way to do this? Is there an Option to prevent duplicates
or do I have to query the resource first to see if Object B already exists?

Regards,
Richard Catlin
Re: Populating EMF Resource using default serialization and Non-containment from Database - Want to [message #482769 is a reply to message #482263] Thu, 27 August 2009 20:36 Go to previous message
Mario Winterer is currently offline Mario WintererFriend
Messages: 136
Registered: July 2009
Senior Member
Hi Richard!

Why not use an IdentityHashMap to remember already loaded objects?
By the way: Do you know "´Teneo"
(http://www.eclipse.org/modeling/emft/?project=teneo)?
It uses Hibernate to persist EMF objects into relational databases.

Mario

"Richard Catlin" <richard.m.catlin@gmail.com> schrieb im Newsbeitrag
news:h71mhq$n3b$1@build.eclipse.org...
>I am populating an Ecore model using the default serialization from a
>database.
>
> Object A has a many-to-many relationship with Object B
>
> I am using JPA to build a tree from the database, traverse it, and persist
> to the Ecore default serialization.
>
> The problem I am encountering is that several Object A may point to Object
> B, so when I traverse the tree, I want to check the Resource to see if
> Object B has already been added.
>
> What the best way to do this? Is there an Option to prevent duplicates or
> do I have to query the resource first to see if Object B already exists?
>
> Regards,
> Richard Catlin
Previous Topic:Re: XML Schema Exporter For EMF
Next Topic:EcrossReferenceAdapter ClassCastException
Goto Forum:
  


Current Time: Thu Apr 25 14:24:27 GMT 2024

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

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

Back to the top