Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [Teneo] Newbie question: Do I really have to register all my packages to Teneo manually? (using data
[Teneo] Newbie question: Do I really have to register all my packages to Teneo manually? (using data [message #69983] Fri, 02 February 2007 08:29 Go to next message
JG is currently offline JGFriend
Messages: 51
Registered: July 2009
Member
Hello,

I am just looking at Teneo, since I was looking for an elegant solution
to get a relational persistence solution for my rather complex model. It
consists of numerous nested packages. When I did my first simple test to
persist a small example model (I just used the setup code from the Teneo
library example and replaced writer/author/etc. with my classes, all of
which are within a single package, which I set to the DataStore using
setEPackages), I received a NullPointerException when the Mapping was
created. From the output code I figured that the culprit was a reference
to a class in another package (which I had to added with setEPackage).
So i did, and now the mapping generation stuck at another external
reference. Since all my packages are connected in one way or another, I
would have to add them all. Since I add to the model regularly, that
would require modifying the code whenever I introduce a new package. Is
there a way around this problem, i.e., can I tell Teneo to include the
"transitive closure" of packages?

Regards

Jürgen
Re: [Teneo] Newbie question: Do I really have to register all my packages to Teneo manually? (using [message #70006 is a reply to message #69983] Fri, 02 February 2007 12:28 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

This is a multi-part message in MIME format.
--------------060502050403010907090401
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit

J
Re: [Teneo] Newbie question: Do I really have to register all my packages to Teneo manually? (using [message #70025 is a reply to message #69983] Fri, 02 February 2007 12:53 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Jurgen,
No there is currently no option to do that. Using the code posted by Ed in the other post I think
you can solve this on your side.
How many epackages do you have? And how many epackages do you add/remove per week?

Can you post the npe stacktrace or enter a bugzilla for it? Then I can improve the error handling.

gr. Martin

JG wrote:
> Hello,
>
> I am just looking at Teneo, since I was looking for an elegant solution
> to get a relational persistence solution for my rather complex model. It
> consists of numerous nested packages. When I did my first simple test to
> persist a small example model (I just used the setup code from the Teneo
> library example and replaced writer/author/etc. with my classes, all of
> which are within a single package, which I set to the DataStore using
> setEPackages), I received a NullPointerException when the Mapping was
> created. From the output code I figured that the culprit was a reference
> to a class in another package (which I had to added with setEPackage).
> So i did, and now the mapping generation stuck at another external
> reference. Since all my packages are connected in one way or another, I
> would have to add them all. Since I add to the model regularly, that
> would require modifying the code whenever I introduce a new package. Is
> there a way around this problem, i.e., can I tell Teneo to include the
> "transitive closure" of packages?
>
> Regards
>
> Jürgen


--

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] Newbie question: Do I really have to register all my packages to Teneo manually? (using [message #70045 is a reply to message #70025] Fri, 02 February 2007 13:48 Go to previous messageGo to next message
Aleksander Bandelj is currently offline Aleksander BandeljFriend
Messages: 98
Registered: July 2009
Member
Just to chime in, this seems similar to:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=172645

Martin Taal wrote:
> Hi Jurgen,
> No there is currently no option to do that. Using the code posted by
> Ed in the other post I think you can solve this on your side.
> How many epackages do you have? And how many epackages do you
> add/remove per week?
>
> Can you post the npe stacktrace or enter a bugzilla for it? Then I can
> improve the error handling.
>
> gr. Martin
>
> JG wrote:
>> Hello,
>>
>> I am just looking at Teneo, since I was looking for an elegant solution
>> to get a relational persistence solution for my rather complex model. It
>> consists of numerous nested packages. When I did my first simple test to
>> persist a small example model (I just used the setup code from the Teneo
>> library example and replaced writer/author/etc. with my classes, all of
>> which are within a single package, which I set to the DataStore using
>> setEPackages), I received a NullPointerException when the Mapping was
>> created. From the output code I figured that the culprit was a reference
>> to a class in another package (which I had to added with setEPackage).
>> So i did, and now the mapping generation stuck at another external
>> reference. Since all my packages are connected in one way or another, I
>> would have to add them all. Since I add to the model regularly, that
>> would require modifying the code whenever I introduce a new package. Is
>> there a way around this problem, i.e., can I tell Teneo to include the
>> "transitive closure" of packages?
>>
>> Regards
>>
>> J�rgen
>
>
Re: [Teneo] Newbie question: Do I really have to register all my packages to Teneo manually? (using [message #70065 is a reply to message #70006] Fri, 02 February 2007 13:52 Go to previous messageGo to next message
JG is currently offline JGFriend
Messages: 51
Registered: July 2009
Member
Ed Merks wrote:
> Jürgen,
>
> It's relatively easy to compute the closure. This code
> (fromGenModelImpl.diagnose), given a list "all" of known EPackages
> should do the trick.
>
[...]
>
> It's perhaps best that this type of computation be done on the client
> side. Note that the above code won't find models that aren't actually
> referenced in some way and I would expect that it's common to have
> "derived" models that extend a base model but aren't referenced by the
> base model...

Thanks Ed, I will try this out. It is not too big an issue for me, it
just made me wonder whether my approach to modeling/EMF development
(having lots of packages and doing changes to the structure all the
time) is flawed, as no one had provided a convenience method like this
yet, or whether I was just missing something.

Regards

Jürgen
Re: [Teneo] Newbie question: Do I really have to register all my packages to Teneo manually? (using [message #70084 is a reply to message #70045] Fri, 02 February 2007 14:00 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Yes I saw your bugzilla. The same npe was reported before, is your problem similar to this post:
http://dev.eclipse.org/newslists/news.eclipse.technology.emf t/msg01760.html

He made this change:
http://dev.eclipse.org/newslists/news.eclipse.technology.emf t/msg01786.html

Does this (possibly) also apply to your case?

gr. Martin

Aleksander Bandelj wrote:
> Just to chime in, this seems similar to:
>
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=172645
>
> Martin Taal wrote:
>> Hi Jurgen,
>> No there is currently no option to do that. Using the code posted by
>> Ed in the other post I think you can solve this on your side.
>> How many epackages do you have? And how many epackages do you
>> add/remove per week?
>>
>> Can you post the npe stacktrace or enter a bugzilla for it? Then I can
>> improve the error handling.
>>
>> gr. Martin
>>
>> JG wrote:
>>> Hello,
>>>
>>> I am just looking at Teneo, since I was looking for an elegant solution
>>> to get a relational persistence solution for my rather complex model. It
>>> consists of numerous nested packages. When I did my first simple test to
>>> persist a small example model (I just used the setup code from the Teneo
>>> library example and replaced writer/author/etc. with my classes, all of
>>> which are within a single package, which I set to the DataStore using
>>> setEPackages), I received a NullPointerException when the Mapping was
>>> created. From the output code I figured that the culprit was a reference
>>> to a class in another package (which I had to added with setEPackage).
>>> So i did, and now the mapping generation stuck at another external
>>> reference. Since all my packages are connected in one way or another, I
>>> would have to add them all. Since I add to the model regularly, that
>>> would require modifying the code whenever I introduce a new package. Is
>>> there a way around this problem, i.e., can I tell Teneo to include the
>>> "transitive closure" of packages?
>>>
>>> Regards
>>>
>>> J�rgen
>>
>>
>


--

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] Newbie question: Do I really have to register all my packages to Teneo manually? (using [message #70105 is a reply to message #70025] Fri, 02 February 2007 14:08 Go to previous messageGo to next message
JG is currently offline JGFriend
Messages: 51
Registered: July 2009
Member
Martin Taal wrote:
> Hi Jurgen,
> No there is currently no option to do that. Using the code posted by Ed
> in the other post I think you can solve this on your side.
> How many epackages do you have? And how many epackages do you add/remove
> per week?

Its not so much an issue if *I* have to do that, but what I am building
right now is supposed to be extensible by other people, ideally by only
designing a model that extends my "core" model. So I would like to keep
dependencies on the actual packages present minimal -- zero at best.


> Can you post the npe stacktrace or enter a bugzilla for it? Then I can
> improve the error handling.

I got a lot of different errors. When I first encountered the problem,
looked at Teneo's debug output, telling me that it was just handling an
inbound "package-external" (don't know a better word) reference. So I
added this package. On the next run, I would get a very different stack
trace. So I added more packages. And was greeted with another, so I
decided to "just for now" add all packages. That's when I wrote the posting.

I appended the first two stack traces. ModelElement is that pivotal
class of mine, toMatches is the name of a reference to ModelElement
coming from another package.

[DEBUG] Adding manytomany annotations to ereference:
virtualContainer/ModelElement
[DEBUG] Setting indexed and unique from ereference.isOrdered/isUnique
because mtm was not set manually!
[DEBUG] Adding manytomany annotations to ereference: toMatches/ModelElement
Exception in thread "main" java.lang.NullPointerException
at
org.eclipse.emf.teneo.annotations.mapper.DefaultAnnotator.pr ocessBidirectionalManyToManyReference(DefaultAnnotator.java: 877)
at
org.eclipse.emf.teneo.annotations.mapper.DefaultAnnotator.pr ocessEFeature(DefaultAnnotator.java:516)
at
org.eclipse.emf.teneo.annotations.mapper.DefaultAnnotator.pr ocessClass(DefaultAnnotator.java:400)
at
org.eclipse.emf.teneo.hibernate.hbannotation.util.HibernateD efaultAnnotator.processClass(HibernateDefaultAnnotator.java: 140)
at
org.eclipse.emf.teneo.annotations.mapper.DefaultAnnotator.pr ocessClass(DefaultAnnotator.java:277)
at
org.eclipse.emf.teneo.hibernate.hbannotation.util.HibernateD efaultAnnotator.processClass(HibernateDefaultAnnotator.java: 140)
at
org.eclipse.emf.teneo.annotations.mapper.DefaultAnnotator.pr ocessClass(DefaultAnnotator.java:277)
at
org.eclipse.emf.teneo.hibernate.hbannotation.util.HibernateD efaultAnnotator.processClass(HibernateDefaultAnnotator.java: 140)
at
org.eclipse.emf.teneo.annotations.mapper.DefaultAnnotator.pr ocessClass(DefaultAnnotator.java:277)
at
org.eclipse.emf.teneo.hibernate.hbannotation.util.HibernateD efaultAnnotator.processClass(HibernateDefaultAnnotator.java: 140)
at
org.eclipse.emf.teneo.annotations.mapper.DefaultAnnotator.pr ocessPackage(DefaultAnnotator.java:239)
at
org.eclipse.emf.teneo.annotations.mapper.DefaultAnnotator.ma p(DefaultAnnotator.java:155)
at
org.eclipse.emf.teneo.annotations.mapper.PersistenceMappingB uilder.buildMapping(PersistenceMappingBuilder.java:157)
at
org.eclipse.emf.teneo.hibernate.HbDataStore.mapEPackages(HbD ataStore.java:377)
at
org.eclipse.emf.teneo.hibernate.HbDataStore.mapModel(HbDataS tore.java:366)
at
org.eclipse.emf.teneo.hibernate.HbDataStore.initialize(HbDat aStore.java:156)
at paladin.TeneoTest.main(TeneoTest.java:52)



After adding this one package, I get this one.

[DEBUG] Setting unique because is bidirectional (has eopposite) otm
[DEBUG] EReference + Reference/Clazz does not have a onetomany
annotation, adding one
[DEBUG] Setting indexed and unique from ereference because otm was not
set manually!
[DEBUG] Setting unique because is bidirectional (has eopposite) otm
Exception in thread "main" java.lang.NullPointerException
at
org.eclipse.emf.teneo.annotations.mapper.DefaultAnnotator.ge tIDFeaturesNames(DefaultAnnotator.java:1306)
at
org.eclipse.emf.teneo.annotations.mapper.DefaultAnnotator.ge tJoinColumns(DefaultAnnotator.java:1126)
at
org.eclipse.emf.teneo.annotations.mapper.DefaultAnnotator.ad dJoinColumns(DefaultAnnotator.java:1119)
at
org.eclipse.emf.teneo.annotations.mapper.DefaultAnnotator.pr ocessOneToManyReference(DefaultAnnotator.java:828)
at
org.eclipse.emf.teneo.hibernate.hbannotation.util.HibernateD efaultAnnotator.processOneToManyReference(HibernateDefaultAn notator.java:176)
at
org.eclipse.emf.teneo.annotations.mapper.DefaultAnnotator.pr ocessEFeature(DefaultAnnotator.java:520)
at
org.eclipse.emf.teneo.annotations.mapper.DefaultAnnotator.pr ocessClass(DefaultAnnotator.java:400)
at
org.eclipse.emf.teneo.hibernate.hbannotation.util.HibernateD efaultAnnotator.processClass(HibernateDefaultAnnotator.java: 140)
at
org.eclipse.emf.teneo.annotations.mapper.DefaultAnnotator.pr ocessPackage(DefaultAnnotator.java:239)
at
org.eclipse.emf.teneo.annotations.mapper.DefaultAnnotator.ma p(DefaultAnnotator.java:155)
at
org.eclipse.emf.teneo.annotations.mapper.PersistenceMappingB uilder.buildMapping(PersistenceMappingBuilder.java:157)
at
org.eclipse.emf.teneo.hibernate.HbDataStore.mapEPackages(HbD ataStore.java:377)
at
org.eclipse.emf.teneo.hibernate.HbDataStore.mapModel(HbDataS tore.java:366)
at
org.eclipse.emf.teneo.hibernate.HbDataStore.initialize(HbDat aStore.java:156)
at paladin.TeneoTest.main(TeneoTest.java:53)
Re: [Teneo] Newbie question: Do I really have to register all my packages to Teneo manually? (using [message #70245 is a reply to message #70084] Fri, 02 February 2007 16:37 Go to previous messageGo to next message
Aleksander Bandelj is currently offline Aleksander BandeljFriend
Messages: 98
Registered: July 2009
Member
It seems that he had references with file paths for ecore models, for
example src/srd/impl/srd.ecore#//EnumType and that something went wrong
with resolving these when loading ecore resources. I don't see how, with
correct relative path everything should be OK and if path was wrong,
exception would be thrown. Anyway, in my case, all references are
without file paths and ecore files are in same directory.

To express problem more clearly: I think that while creating
PAnnotations for EReference, Annotator tries to get name of Entity
PAnnotation. But this name is null, since referenced class hasn't been
processed yet, hence NullPointerException. If I add explicit @OneToMany
to EReference, NullPointerException is not thrown.

There are differences between processing dynamic and static models which
I don't understand clearly at this moment. I think the issue applies to
both, so dynamic in bugzilla title is probably a misnomer.

Martin Taal wrote:
> Yes I saw your bugzilla. The same npe was reported before, is your
> problem similar to this post:
> http://dev.eclipse.org/newslists/news.eclipse.technology.emf t/msg01760.html
>
>
> He made this change:
> http://dev.eclipse.org/newslists/news.eclipse.technology.emf t/msg01786.html
>
>
> Does this (possibly) also apply to your case?
>
> gr. Martin
>
> Aleksander Bandelj wrote:
>> Just to chime in, this seems similar to:
>>
>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=172645
>>
>> Martin Taal wrote:
>>> Hi Jurgen,
>>> No there is currently no option to do that. Using the code posted by
>>> Ed in the other post I think you can solve this on your side.
>>> How many epackages do you have? And how many epackages do you
>>> add/remove per week?
>>>
>>> Can you post the npe stacktrace or enter a bugzilla for it? Then I
>>> can improve the error handling.
>>>
>>> gr. Martin
>>>
>>> JG wrote:
>>>> Hello,
>>>>
>>>> I am just looking at Teneo, since I was looking for an elegant
>>>> solution
>>>> to get a relational persistence solution for my rather complex
>>>> model. It
>>>> consists of numerous nested packages. When I did my first simple
>>>> test to
>>>> persist a small example model (I just used the setup code from the
>>>> Teneo
>>>> library example and replaced writer/author/etc. with my classes,
>>>> all of
>>>> which are within a single package, which I set to the DataStore using
>>>> setEPackages), I received a NullPointerException when the Mapping was
>>>> created. From the output code I figured that the culprit was a
>>>> reference
>>>> to a class in another package (which I had to added with setEPackage).
>>>> So i did, and now the mapping generation stuck at another external
>>>> reference. Since all my packages are connected in one way or
>>>> another, I
>>>> would have to add them all. Since I add to the model regularly, that
>>>> would require modifying the code whenever I introduce a new
>>>> package. Is
>>>> there a way around this problem, i.e., can I tell Teneo to include the
>>>> "transitive closure" of packages?
>>>>
>>>> Regards
>>>>
>>>> J�rgen
>>>
>>>
>>
>
>
Re: [Teneo] Newbie question: Do I really have to register all my packages to Teneo manually? (using [message #70265 is a reply to message #70084] Fri, 02 February 2007 17:28 Go to previous messageGo to next message
Aleksander Bandelj is currently offline Aleksander BandeljFriend
Messages: 98
Registered: July 2009
Member
I can also confirm that very similar NPE also occurs if loading several
interconnected dynamic packages is not done exactly like this:

- all package resources are in same ResourceSet
- URIs for package resources are created with URI.createFileURI()
- All paths given to URI.createFileURI() are absolute

This could be put in FAQ or in exception message, even though it's more
EMF issue than Teneo one. Similar problem seems to be addressed in EMF FAQ:

What can cause some of the resources in a resource set, which correspond
to schema documents referenced by <include> <import> or <redefine>, to
return null from (XSDResourceImpl)resource.getSchema()?

* This could be seen if you iterate through the resource in a
ResourceSet, for example:| for (Iterator resources =
resourceSet.getResources().iterator(); resources.hasNext();) {
Resource resource = (Resource)resources.next(); /* Now use
getSchema() */ }|
If the <include> <import> or <redefine> contained a schemaLocation
which has a relative file path, the library will not resolve it,
and this can be a symptom.

To get around this problem, have code which is guaranteed to turn
the URI into an absolute URI. For example:| File file = new
File(schemaURL); if (file.isFile()) { schemaURL =
URI.createFileURI(file.getCanonicalFile().toString()).toStri ng(); }|


And it makes me wonder: how is it possible to load interrelated packages
from non-file URIs ?

Martin Taal wrote:
> Yes I saw your bugzilla. The same npe was reported before, is your
> problem similar to this post:
> http://dev.eclipse.org/newslists/news.eclipse.technology.emf t/msg01760.html
>
>
> He made this change:
> http://dev.eclipse.org/newslists/news.eclipse.technology.emf t/msg01786.html
>
>
> Does this (possibly) also apply to your case?
>
> gr. Martin
>
>
Re: [Teneo] Newbie question: Do I really have to register all my packages to Teneo manually? (using [message #70285 is a reply to message #70265] Fri, 02 February 2007 18:20 Go to previous message
Aleksander Bandelj is currently offline Aleksander BandeljFriend
Messages: 98
Registered: July 2009
Member
To answer my own question: ResourceSet has URIConverter which can be
overriden or given URIMap to specify mapping. However, it would be nice
to put this in Teneo FAQ and/or add something like "You also need to use
ResourceSet for loading package resources and either a) specify absolute
URIs or b) customize URIConverter of the ResourceSet " to exception message.

Aleksander Bandelj wrote:
>
> And it makes me wonder: how is it possible to load interrelated
> packages from non-file URIs ?
>
Re: [Teneo] Newbie question: Do I really have to register all my packages to Teneo manually? (using [message #601991 is a reply to message #69983] Fri, 02 February 2007 12:28 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 31770
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------060502050403010907090401
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit

J


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: [Teneo] Newbie question: Do I really have to register all my packages to Teneo manually? (using [message #601999 is a reply to message #69983] Fri, 02 February 2007 12:53 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Jurgen,
No there is currently no option to do that. Using the code posted by Ed in the other post I think
you can solve this on your side.
How many epackages do you have? And how many epackages do you add/remove per week?

Can you post the npe stacktrace or enter a bugzilla for it? Then I can improve the error handling.

gr. Martin

JG wrote:
> Hello,
>
> I am just looking at Teneo, since I was looking for an elegant solution
> to get a relational persistence solution for my rather complex model. It
> consists of numerous nested packages. When I did my first simple test to
> persist a small example model (I just used the setup code from the Teneo
> library example and replaced writer/author/etc. with my classes, all of
> which are within a single package, which I set to the DataStore using
> setEPackages), I received a NullPointerException when the Mapping was
> created. From the output code I figured that the culprit was a reference
> to a class in another package (which I had to added with setEPackage).
> So i did, and now the mapping generation stuck at another external
> reference. Since all my packages are connected in one way or another, I
> would have to add them all. Since I add to the model regularly, that
> would require modifying the code whenever I introduce a new package. Is
> there a way around this problem, i.e., can I tell Teneo to include the
> "transitive closure" of packages?
>
> Regards
>
> Jürgen


--

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] Newbie question: Do I really have to register all my packages to Teneo manually? (using [message #602004 is a reply to message #70025] Fri, 02 February 2007 13:48 Go to previous message
Aleksander Bandelj is currently offline Aleksander BandeljFriend
Messages: 98
Registered: July 2009
Member
Just to chime in, this seems similar to:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=172645

Martin Taal wrote:
> Hi Jurgen,
> No there is currently no option to do that. Using the code posted by
> Ed in the other post I think you can solve this on your side.
> How many epackages do you have? And how many epackages do you
> add/remove per week?
>
> Can you post the npe stacktrace or enter a bugzilla for it? Then I can
> improve the error handling.
>
> gr. Martin
>
> JG wrote:
>> Hello,
>>
>> I am just looking at Teneo, since I was looking for an elegant solution
>> to get a relational persistence solution for my rather complex model. It
>> consists of numerous nested packages. When I did my first simple test to
>> persist a small example model (I just used the setup code from the Teneo
>> library example and replaced writer/author/etc. with my classes, all of
>> which are within a single package, which I set to the DataStore using
>> setEPackages), I received a NullPointerException when the Mapping was
>> created. From the output code I figured that the culprit was a reference
>> to a class in another package (which I had to added with setEPackage).
>> So i did, and now the mapping generation stuck at another external
>> reference. Since all my packages are connected in one way or another, I
>> would have to add them all. Since I add to the model regularly, that
>> would require modifying the code whenever I introduce a new package. Is
>> there a way around this problem, i.e., can I tell Teneo to include the
>> "transitive closure" of packages?
>>
>> Regards
>>
>> J�rgen
>
>
Re: [Teneo] Newbie question: Do I really have to register all my packages to Teneo manually? (using [message #602011 is a reply to message #70006] Fri, 02 February 2007 13:52 Go to previous message
JG is currently offline JGFriend
Messages: 51
Registered: July 2009
Member
Ed Merks wrote:
> Jürgen,
>
> It's relatively easy to compute the closure. This code
> (fromGenModelImpl.diagnose), given a list "all" of known EPackages
> should do the trick.
>
[...]
>
> It's perhaps best that this type of computation be done on the client
> side. Note that the above code won't find models that aren't actually
> referenced in some way and I would expect that it's common to have
> "derived" models that extend a base model but aren't referenced by the
> base model...

Thanks Ed, I will try this out. It is not too big an issue for me, it
just made me wonder whether my approach to modeling/EMF development
(having lots of packages and doing changes to the structure all the
time) is flawed, as no one had provided a convenience method like this
yet, or whether I was just missing something.

Regards

Jürgen
Re: [Teneo] Newbie question: Do I really have to register all my packages to Teneo manually? (using [message #602016 is a reply to message #70045] Fri, 02 February 2007 14:00 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Yes I saw your bugzilla. The same npe was reported before, is your problem similar to this post:
http://dev.eclipse.org/newslists/news.eclipse.technology.emf t/msg01760.html

He made this change:
http://dev.eclipse.org/newslists/news.eclipse.technology.emf t/msg01786.html

Does this (possibly) also apply to your case?

gr. Martin

Aleksander Bandelj wrote:
> Just to chime in, this seems similar to:
>
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=172645
>
> Martin Taal wrote:
>> Hi Jurgen,
>> No there is currently no option to do that. Using the code posted by
>> Ed in the other post I think you can solve this on your side.
>> How many epackages do you have? And how many epackages do you
>> add/remove per week?
>>
>> Can you post the npe stacktrace or enter a bugzilla for it? Then I can
>> improve the error handling.
>>
>> gr. Martin
>>
>> JG wrote:
>>> Hello,
>>>
>>> I am just looking at Teneo, since I was looking for an elegant solution
>>> to get a relational persistence solution for my rather complex model. It
>>> consists of numerous nested packages. When I did my first simple test to
>>> persist a small example model (I just used the setup code from the Teneo
>>> library example and replaced writer/author/etc. with my classes, all of
>>> which are within a single package, which I set to the DataStore using
>>> setEPackages), I received a NullPointerException when the Mapping was
>>> created. From the output code I figured that the culprit was a reference
>>> to a class in another package (which I had to added with setEPackage).
>>> So i did, and now the mapping generation stuck at another external
>>> reference. Since all my packages are connected in one way or another, I
>>> would have to add them all. Since I add to the model regularly, that
>>> would require modifying the code whenever I introduce a new package. Is
>>> there a way around this problem, i.e., can I tell Teneo to include the
>>> "transitive closure" of packages?
>>>
>>> Regards
>>>
>>> J�rgen
>>
>>
>


--

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] Newbie question: Do I really have to register all my packages to Teneo manually? (using [message #602022 is a reply to message #70025] Fri, 02 February 2007 14:08 Go to previous message
JG is currently offline JGFriend
Messages: 51
Registered: July 2009
Member
Martin Taal wrote:
> Hi Jurgen,
> No there is currently no option to do that. Using the code posted by Ed
> in the other post I think you can solve this on your side.
> How many epackages do you have? And how many epackages do you add/remove
> per week?

Its not so much an issue if *I* have to do that, but what I am building
right now is supposed to be extensible by other people, ideally by only
designing a model that extends my "core" model. So I would like to keep
dependencies on the actual packages present minimal -- zero at best.


> Can you post the npe stacktrace or enter a bugzilla for it? Then I can
> improve the error handling.

I got a lot of different errors. When I first encountered the problem,
looked at Teneo's debug output, telling me that it was just handling an
inbound "package-external" (don't know a better word) reference. So I
added this package. On the next run, I would get a very different stack
trace. So I added more packages. And was greeted with another, so I
decided to "just for now" add all packages. That's when I wrote the posting.

I appended the first two stack traces. ModelElement is that pivotal
class of mine, toMatches is the name of a reference to ModelElement
coming from another package.

[DEBUG] Adding manytomany annotations to ereference:
virtualContainer/ModelElement
[DEBUG] Setting indexed and unique from ereference.isOrdered/isUnique
because mtm was not set manually!
[DEBUG] Adding manytomany annotations to ereference: toMatches/ModelElement
Exception in thread "main" java.lang.NullPointerException
at
org.eclipse.emf.teneo.annotations.mapper.DefaultAnnotator.pr ocessBidirectionalManyToManyReference(DefaultAnnotator.java: 877)
at
org.eclipse.emf.teneo.annotations.mapper.DefaultAnnotator.pr ocessEFeature(DefaultAnnotator.java:516)
at
org.eclipse.emf.teneo.annotations.mapper.DefaultAnnotator.pr ocessClass(DefaultAnnotator.java:400)
at
org.eclipse.emf.teneo.hibernate.hbannotation.util.HibernateD efaultAnnotator.processClass(HibernateDefaultAnnotator.java: 140)
at
org.eclipse.emf.teneo.annotations.mapper.DefaultAnnotator.pr ocessClass(DefaultAnnotator.java:277)
at
org.eclipse.emf.teneo.hibernate.hbannotation.util.HibernateD efaultAnnotator.processClass(HibernateDefaultAnnotator.java: 140)
at
org.eclipse.emf.teneo.annotations.mapper.DefaultAnnotator.pr ocessClass(DefaultAnnotator.java:277)
at
org.eclipse.emf.teneo.hibernate.hbannotation.util.HibernateD efaultAnnotator.processClass(HibernateDefaultAnnotator.java: 140)
at
org.eclipse.emf.teneo.annotations.mapper.DefaultAnnotator.pr ocessClass(DefaultAnnotator.java:277)
at
org.eclipse.emf.teneo.hibernate.hbannotation.util.HibernateD efaultAnnotator.processClass(HibernateDefaultAnnotator.java: 140)
at
org.eclipse.emf.teneo.annotations.mapper.DefaultAnnotator.pr ocessPackage(DefaultAnnotator.java:239)
at
org.eclipse.emf.teneo.annotations.mapper.DefaultAnnotator.ma p(DefaultAnnotator.java:155)
at
org.eclipse.emf.teneo.annotations.mapper.PersistenceMappingB uilder.buildMapping(PersistenceMappingBuilder.java:157)
at
org.eclipse.emf.teneo.hibernate.HbDataStore.mapEPackages(HbD ataStore.java:377)
at
org.eclipse.emf.teneo.hibernate.HbDataStore.mapModel(HbDataS tore.java:366)
at
org.eclipse.emf.teneo.hibernate.HbDataStore.initialize(HbDat aStore.java:156)
at paladin.TeneoTest.main(TeneoTest.java:52)



After adding this one package, I get this one.

[DEBUG] Setting unique because is bidirectional (has eopposite) otm
[DEBUG] EReference + Reference/Clazz does not have a onetomany
annotation, adding one
[DEBUG] Setting indexed and unique from ereference because otm was not
set manually!
[DEBUG] Setting unique because is bidirectional (has eopposite) otm
Exception in thread "main" java.lang.NullPointerException
at
org.eclipse.emf.teneo.annotations.mapper.DefaultAnnotator.ge tIDFeaturesNames(DefaultAnnotator.java:1306)
at
org.eclipse.emf.teneo.annotations.mapper.DefaultAnnotator.ge tJoinColumns(DefaultAnnotator.java:1126)
at
org.eclipse.emf.teneo.annotations.mapper.DefaultAnnotator.ad dJoinColumns(DefaultAnnotator.java:1119)
at
org.eclipse.emf.teneo.annotations.mapper.DefaultAnnotator.pr ocessOneToManyReference(DefaultAnnotator.java:828)
at
org.eclipse.emf.teneo.hibernate.hbannotation.util.HibernateD efaultAnnotator.processOneToManyReference(HibernateDefaultAn notator.java:176)
at
org.eclipse.emf.teneo.annotations.mapper.DefaultAnnotator.pr ocessEFeature(DefaultAnnotator.java:520)
at
org.eclipse.emf.teneo.annotations.mapper.DefaultAnnotator.pr ocessClass(DefaultAnnotator.java:400)
at
org.eclipse.emf.teneo.hibernate.hbannotation.util.HibernateD efaultAnnotator.processClass(HibernateDefaultAnnotator.java: 140)
at
org.eclipse.emf.teneo.annotations.mapper.DefaultAnnotator.pr ocessPackage(DefaultAnnotator.java:239)
at
org.eclipse.emf.teneo.annotations.mapper.DefaultAnnotator.ma p(DefaultAnnotator.java:155)
at
org.eclipse.emf.teneo.annotations.mapper.PersistenceMappingB uilder.buildMapping(PersistenceMappingBuilder.java:157)
at
org.eclipse.emf.teneo.hibernate.HbDataStore.mapEPackages(HbD ataStore.java:377)
at
org.eclipse.emf.teneo.hibernate.HbDataStore.mapModel(HbDataS tore.java:366)
at
org.eclipse.emf.teneo.hibernate.HbDataStore.initialize(HbDat aStore.java:156)
at paladin.TeneoTest.main(TeneoTest.java:53)
Re: [Teneo] Newbie question: Do I really have to register all my packages to Teneo manually? (using [message #602065 is a reply to message #70084] Fri, 02 February 2007 16:37 Go to previous message
Aleksander Bandelj is currently offline Aleksander BandeljFriend
Messages: 98
Registered: July 2009
Member
It seems that he had references with file paths for ecore models, for
example src/srd/impl/srd.ecore#//EnumType and that something went wrong
with resolving these when loading ecore resources. I don't see how, with
correct relative path everything should be OK and if path was wrong,
exception would be thrown. Anyway, in my case, all references are
without file paths and ecore files are in same directory.

To express problem more clearly: I think that while creating
PAnnotations for EReference, Annotator tries to get name of Entity
PAnnotation. But this name is null, since referenced class hasn't been
processed yet, hence NullPointerException. If I add explicit @OneToMany
to EReference, NullPointerException is not thrown.

There are differences between processing dynamic and static models which
I don't understand clearly at this moment. I think the issue applies to
both, so dynamic in bugzilla title is probably a misnomer.

Martin Taal wrote:
> Yes I saw your bugzilla. The same npe was reported before, is your
> problem similar to this post:
> http://dev.eclipse.org/newslists/news.eclipse.technology.emf t/msg01760.html
>
>
> He made this change:
> http://dev.eclipse.org/newslists/news.eclipse.technology.emf t/msg01786.html
>
>
> Does this (possibly) also apply to your case?
>
> gr. Martin
>
> Aleksander Bandelj wrote:
>> Just to chime in, this seems similar to:
>>
>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=172645
>>
>> Martin Taal wrote:
>>> Hi Jurgen,
>>> No there is currently no option to do that. Using the code posted by
>>> Ed in the other post I think you can solve this on your side.
>>> How many epackages do you have? And how many epackages do you
>>> add/remove per week?
>>>
>>> Can you post the npe stacktrace or enter a bugzilla for it? Then I
>>> can improve the error handling.
>>>
>>> gr. Martin
>>>
>>> JG wrote:
>>>> Hello,
>>>>
>>>> I am just looking at Teneo, since I was looking for an elegant
>>>> solution
>>>> to get a relational persistence solution for my rather complex
>>>> model. It
>>>> consists of numerous nested packages. When I did my first simple
>>>> test to
>>>> persist a small example model (I just used the setup code from the
>>>> Teneo
>>>> library example and replaced writer/author/etc. with my classes,
>>>> all of
>>>> which are within a single package, which I set to the DataStore using
>>>> setEPackages), I received a NullPointerException when the Mapping was
>>>> created. From the output code I figured that the culprit was a
>>>> reference
>>>> to a class in another package (which I had to added with setEPackage).
>>>> So i did, and now the mapping generation stuck at another external
>>>> reference. Since all my packages are connected in one way or
>>>> another, I
>>>> would have to add them all. Since I add to the model regularly, that
>>>> would require modifying the code whenever I introduce a new
>>>> package. Is
>>>> there a way around this problem, i.e., can I tell Teneo to include the
>>>> "transitive closure" of packages?
>>>>
>>>> Regards
>>>>
>>>> J�rgen
>>>
>>>
>>
>
>
Re: [Teneo] Newbie question: Do I really have to register all my packages to Teneo manually? (using [message #602076 is a reply to message #70084] Fri, 02 February 2007 17:28 Go to previous message
Aleksander Bandelj is currently offline Aleksander BandeljFriend
Messages: 98
Registered: July 2009
Member
I can also confirm that very similar NPE also occurs if loading several
interconnected dynamic packages is not done exactly like this:

- all package resources are in same ResourceSet
- URIs for package resources are created with URI.createFileURI()
- All paths given to URI.createFileURI() are absolute

This could be put in FAQ or in exception message, even though it's more
EMF issue than Teneo one. Similar problem seems to be addressed in EMF FAQ:

What can cause some of the resources in a resource set, which correspond
to schema documents referenced by <include> <import> or <redefine>, to
return null from (XSDResourceImpl)resource.getSchema()?

* This could be seen if you iterate through the resource in a
ResourceSet, for example:| for (Iterator resources =
resourceSet.getResources().iterator(); resources.hasNext();) {
Resource resource = (Resource)resources.next(); /* Now use
getSchema() */ }|
If the <include> <import> or <redefine> contained a schemaLocation
which has a relative file path, the library will not resolve it,
and this can be a symptom.

To get around this problem, have code which is guaranteed to turn
the URI into an absolute URI. For example:| File file = new
File(schemaURL); if (file.isFile()) { schemaURL =
URI.createFileURI(file.getCanonicalFile().toString()).toStri ng(); }|


And it makes me wonder: how is it possible to load interrelated packages
from non-file URIs ?

Martin Taal wrote:
> Yes I saw your bugzilla. The same npe was reported before, is your
> problem similar to this post:
> http://dev.eclipse.org/newslists/news.eclipse.technology.emf t/msg01760.html
>
>
> He made this change:
> http://dev.eclipse.org/newslists/news.eclipse.technology.emf t/msg01786.html
>
>
> Does this (possibly) also apply to your case?
>
> gr. Martin
>
>
Re: [Teneo] Newbie question: Do I really have to register all my packages to Teneo manually? (using [message #602079 is a reply to message #70265] Fri, 02 February 2007 18:20 Go to previous message
Aleksander Bandelj is currently offline Aleksander BandeljFriend
Messages: 98
Registered: July 2009
Member
To answer my own question: ResourceSet has URIConverter which can be
overriden or given URIMap to specify mapping. However, it would be nice
to put this in Teneo FAQ and/or add something like "You also need to use
ResourceSet for loading package resources and either a) specify absolute
URIs or b) customize URIConverter of the ResourceSet " to exception message.

Aleksander Bandelj wrote:
>
> And it makes me wonder: how is it possible to load interrelated
> packages from non-file URIs ?
>
Previous Topic:"Repeated column in mapping for entity"
Next Topic:Teneo: Identity (ID) scope conflicts
Goto Forum:
  


Current Time: Sat Feb 27 22:46:02 GMT 2021

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

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

Back to the top