Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » TENEO: StoreResource.LOAD_STRATEGY_PARAM
TENEO: StoreResource.LOAD_STRATEGY_PARAM [message #76385] Fri, 23 March 2007 14:54 Go to next message
Eclipse UserFriend
Originally posted by: christian.donhofer.net

hi all!

i need to configure teneo to load all references of a loaded object into
a resource.

on the elver website
( http://www.elver.org/hibernate/hibernateresources.html#Load+ of+referenced+Objects),
it is said that i need to set the StoreResource.LOAD_STRATEGY_PARAM to
StoreResource.ADD_TO_CONTENTS.

unfortunately, i can find neither of these constants in the
org.eclipse.emf.teneo.resource.StoreResource class.

where do i find them? since many variable names etc. on the elver website
are out of date, i believe they might have been moved&renamed. quick
answers would be very appreciated =)

TIA, cheers, chris
Re: TENEO: StoreResource.LOAD_STRATEGY_PARAM [message #76402 is a reply to message #76385] Fri, 23 March 2007 15:00 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Christian,
In the version I have all these constants are present (in the StoreResource class). Which version of
Teneo are you using?

The variable names on the website should be all valid for the 0.8.0 release with many also being
valid for the 0.7.5 release.

gr. Martin

Christian Donhofer wrote:
> hi all!
>
> i need to configure teneo to load all references of a loaded object into
> a resource.
>
> on the elver website
> ( http://www.elver.org/hibernate/hibernateresources.html#Load+ of+referenced+Objects),
> it is said that i need to set the StoreResource.LOAD_STRATEGY_PARAM to
> StoreResource.ADD_TO_CONTENTS.
>
> unfortunately, i can find neither of these constants in the
> org.eclipse.emf.teneo.resource.StoreResource class.
>
> where do i find them? since many variable names etc. on the elver website
> are out of date, i believe they might have been moved&renamed. quick
> answers would be very appreciated =)
>
> TIA, cheers, chris


--

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: StoreResource.LOAD_STRATEGY_PARAM [message #76416 is a reply to message #76402] Fri, 23 March 2007 15:11 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: christian.donhofer.net

hi martin!

thx for the quick answer! nice to see someone being so motivated and
supportive =)
at the moment im using 0.7.5, so i'll try and use 0.8.0 now.

cheers, chris

On Fri, 23 Mar 2007 16:00:53 +0100 wrote Martin Taal:

> Hi Christian,
> In the version I have all these constants are present (in the StoreResource class). Which version of
> Teneo are you using?
>
> The variable names on the website should be all valid for the 0.8.0 release with many also being
> valid for the 0.7.5 release.
>
> gr. Martin
Re: TENEO: StoreResource.LOAD_STRATEGY_PARAM [message #76431 is a reply to message #76416] Fri, 23 March 2007 15:15 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
These constants should also be in 0.7.5.
The 0.8.0 release requires emf 2.3 (and eclipse 3.3/jdk 1.5).

gr. Martin

Christian Donhofer wrote:
> hi martin!
>
> thx for the quick answer! nice to see someone being so motivated and
> supportive =)
> at the moment im using 0.7.5, so i'll try and use 0.8.0 now.
>
> cheers, chris
>
> On Fri, 23 Mar 2007 16:00:53 +0100 wrote Martin Taal:
>
>> Hi Christian,
>> In the version I have all these constants are present (in the StoreResource class). Which version of
>> Teneo are you using?
>>
>> The variable names on the website should be all valid for the 0.8.0 release with many also being
>> valid for the 0.7.5 release.
>>
>> gr. Martin
>
>


--

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: StoreResource.LOAD_STRATEGY_PARAM [message #76448 is a reply to message #76431] Fri, 23 March 2007 15:38 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: christian.donhofer.net

hmmm, somehow i cant find them in 0.7.5, but i just upgraded to 0.8.0 and
everything works fine now!

cheers, chris

On Fri, 23 Mar 2007 16:15:33 +0100 wrote Martin Taal:

> These constants should also be in 0.7.5.
> The 0.8.0 release requires emf 2.3 (and eclipse 3.3/jdk 1.5).
>
> gr. Martin
>
> Christian Donhofer wrote:
>> hi martin!
>>
>> thx for the quick answer! nice to see someone being so motivated and
>> supportive =)
>> at the moment im using 0.7.5, so i'll try and use 0.8.0 now.
>>
>> cheers, chris
>>
>> On Fri, 23 Mar 2007 16:00:53 +0100 wrote Martin Taal:
>>
>>> Hi Christian,
>>> In the version I have all these constants are present (in the StoreResource class). Which version of
>>> Teneo are you using?
>>>
>>> The variable names on the website should be all valid for the 0.8.0 release with many also being
>>> valid for the 0.7.5 release.
>>>
>>> gr. Martin
>>
>>
Re: TENEO: StoreResource.LOAD_STRATEGY_PARAM [message #76463 is a reply to message #76448] Fri, 23 March 2007 16:10 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: christian.donhofer.net

hi again!

accessing the constants now works, which leads to the following query:
hibernate://?dsname=AuthortoolDataStore&loadStrategy=add ToContents&query1=from
ModuleFolder where id='modfo-27C47B58-71F7-6F08-DDCE-E40D4EBA305C'

still, the "lazily linked" objects are not being loaded into a resource.
instead, the serialized string contains an empty tag with a href:

<lobj:learningUnit> hibernate://?dsname=AuthortoolDataStore&loadStrategy=add ToContents&query1=from
ModuleFolder where
id='modfo-27C47B58-71F7-6F08-DDCE-E40D4EBA305C'#learn-1C3917 34-EF05-CABA-2E9E-7933863BCE4B </lobj:learningUnit>

here's the code im using:
session = getSession();
Transaction tx = session.getTransaction();
ResourceSet resourceSet = getResourceSet();
Resource rs = resourceSet.createResource(URI.createFileURI("soEinDummy.lobj "));

// create an uri using the SessionController name
URI uri1 = URI.createURI("hibernate://?dsname=" + dataStore.getName() + "&" +
StoreResource.LOAD_STRATEGY_PARAM + "=" + StoreResource.ADD_TO_CONTENTS +
"&query1=from "+eclassname+" where id='"+id+"'");

System.out.println("Loading with this QUERY: "+uri1.toString());

final Resource res1 = resourceSet.createResource(uri1);

tx.begin();

// now load the resources
try {
res1.load(Collections.EMPTY_MAP);
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
tx.commit();
System.out.println("LOADED RESOURCE CONTAINS "+res1.getContents().size()+"OBJECTS!");
System.out.println("LOADED RESOURCESET CONTAINS "+res1.getResourceSet().getResources().size()+" RESOURCES!");

for(Iterator iter = res1.getResourceSet().getResources().iterator(); iter.hasNext();){
Resource resource = (Resource)iter.next();
if(resource.getContents().size() > 0){
EObject eo = EcoreUtil.copy((EObject)resource.getContents().get(0));
rs.getContents().add(eo);
}
}
-------------------
after that, all needed objects should be in rs, shouldn't they?

TIA, chris
p.s.:
i also tried:
for (Iterator iter = res1.getContents().iterator(); iter.hasNext();) {
EObject element = (EObject) iter.next();
System.out.println("adding "+element.toString());
EObject eo = EcoreUtil.copy(element);
System.out.println("resource contains:" +eo.toString());
rs.getContents().add(eo);
}
but that throws a ConcurrentModificationException.
Re: TENEO: StoreResource.LOAD_STRATEGY_PARAM [message #76480 is a reply to message #76463] Fri, 23 March 2007 16:35 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi,
Yes I would say that the copy action should load all the objects, can you debug through the copy
action and see if it traverses the containment tree?
A teneo resource has a special iterator which does not load unloaded lists but I do not think that
the copy action makes use of that.

gr. Martin

Christian Donhofer wrote:
> hi again!
>
> accessing the constants now works, which leads to the following query:
> hibernate://?dsname=AuthortoolDataStore&loadStrategy=add ToContents&query1=from
> ModuleFolder where id='modfo-27C47B58-71F7-6F08-DDCE-E40D4EBA305C'
>
> still, the "lazily linked" objects are not being loaded into a resource.
> instead, the serialized string contains an empty tag with a href:
>
> <lobj:learningUnit> hibernate://?dsname=AuthortoolDataStore&loadStrategy=add ToContents&query1=from
> ModuleFolder where
> id='modfo-27C47B58-71F7-6F08-DDCE-E40D4EBA305C'#learn-1C3917 34-EF05-CABA-2E9E-7933863BCE4B </lobj:learningUnit>
>
> here's the code im using:
> session = getSession();
> Transaction tx = session.getTransaction();
> ResourceSet resourceSet = getResourceSet();
> Resource rs = resourceSet.createResource(URI.createFileURI("soEinDummy.lobj "));
>
> // create an uri using the SessionController name
> URI uri1 = URI.createURI("hibernate://?dsname=" + dataStore.getName() + "&" +
> StoreResource.LOAD_STRATEGY_PARAM + "=" + StoreResource.ADD_TO_CONTENTS +
> "&query1=from "+eclassname+" where id='"+id+"'");
>
> System.out.println("Loading with this QUERY: "+uri1.toString());
>
> final Resource res1 = resourceSet.createResource(uri1);
>
> tx.begin();
>
> // now load the resources
> try {
> res1.load(Collections.EMPTY_MAP);
> } catch (IOException e1) {
> // TODO Auto-generated catch block
> e1.printStackTrace();
> }
> tx.commit();
> System.out.println("LOADED RESOURCE CONTAINS "+res1.getContents().size()+"OBJECTS!");
> System.out.println("LOADED RESOURCESET CONTAINS "+res1.getResourceSet().getResources().size()+" RESOURCES!");
>
> for(Iterator iter = res1.getResourceSet().getResources().iterator(); iter.hasNext();){
> Resource resource = (Resource)iter.next();
> if(resource.getContents().size() > 0){
> EObject eo = EcoreUtil.copy((EObject)resource.getContents().get(0));
> rs.getContents().add(eo);
> }
> }
> -------------------
> after that, all needed objects should be in rs, shouldn't they?
>
> TIA, chris
> p.s.:
> i also tried:
> for (Iterator iter = res1.getContents().iterator(); iter.hasNext();) {
> EObject element = (EObject) iter.next();
> System.out.println("adding "+element.toString());
> EObject eo = EcoreUtil.copy(element);
> System.out.println("resource contains:" +eo.toString());
> rs.getContents().add(eo);
> }
> but that throws a ConcurrentModificationException.
>
>


--

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: StoreResource.LOAD_STRATEGY_PARAM [message #76561 is a reply to message #76480] Fri, 23 March 2007 17:22 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: christian.donhofer.net

the copy function seems to use
HibernateResource(StoreResource).getContents() line: 455


without this method, f.i. using
EObject eo =
(EObject)resource.getContents().get(0);

i get a dangling href exception anyway.

but the problem seems to be that the loaded resource doesn't contain
anything else but the contained objects of the requested one.

cheers, chris


On Fri, 23 Mar 2007 17:35:32 +0100 wrote Martin Taal:

> Hi,
> Yes I would say that the copy action should load all the objects, can you debug through the copy
> action and see if it traverses the containment tree?
> A teneo resource has a special iterator which does not load unloaded lists but I do not think that
> the copy action makes use of that.
>
> gr. Martin
>
Re: TENEO: StoreResource.LOAD_STRATEGY_PARAM [message #76577 is a reply to message #76561] Fri, 23 March 2007 17:43 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: christian.donhofer.net

just to add all necessary information:

http://donhofer.net/mirror/hibernate/hibernate.hbm.xml

im loading a modulefolder.

missing in the loaded resource(&set): LearningUnit (and contained)

(strangely) present in the resource: Language

cheers, chris
Re: TENEO: StoreResource.LOAD_STRATEGY_PARAM [message #76609 is a reply to message #76577] Fri, 23 March 2007 18:11 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Christian,
Can you send me the ecore? You posted the test program so I can try to reproduce it.

gr. Martin

Christian Donhofer wrote:
> just to add all necessary information:
>
> http://donhofer.net/mirror/hibernate/hibernate.hbm.xml
>
> im loading a modulefolder.
>
> missing in the loaded resource(&set): LearningUnit (and contained)
>
> (strangely) present in the resource: Language
>
> cheers, chris


--

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: StoreResource.LOAD_STRATEGY_PARAM [message #76625 is a reply to message #76609] Sun, 25 March 2007 13:30 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: christian.donhofer.net

hi!

here's the file:
http://donhofer.net/mirror/hibernate/lobj.ecore

TIA, chris

On Fri, 23 Mar 2007 19:11:13 +0100 Martin Taal wrote:

> Hi Christian,
> Can you send me the ecore? You posted the test program so I can try to reproduce it.
>
> gr. Martin
>
> Christian Donhofer wrote:
>> just to add all necessary information:
>>
>> http://donhofer.net/mirror/hibernate/hibernate.hbm.xml
>>
>> im loading a modulefolder.
>>
>> missing in the loaded resource(&set): LearningUnit (and contained)
>>
>> (strangely) present in the resource: Language
>>
>> cheers, chris
>
>
Re: TENEO: StoreResource.LOAD_STRATEGY_PARAM [message #77675 is a reply to message #76625] Fri, 30 March 2007 15:24 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Christian,
Okay it runs. Your original call was:
>>>>>>>

still, the "lazily linked" objects are not being loaded into a resource.
instead, the serialized string contains an empty tag with a href:

<lobj:learningUnit> hibernate://?dsname=AuthortoolDataStore&loadStrategy=add ToContents&query1=from
ModuleFolder where
id='modfo-27C47B58-71F7-6F08-DDCE-E40D4EBA305C'#learn-1C3917 34-EF05-CABA-2E9E-7933863BCE4B </lobj:learningUnit>

>>>>>>>>

What the copy action does is copy the containment structure, so if an eobject is copied then only
its contained children are copied. All non-containment relations still point to objects from the
original tree (which is in a different resource). When you then serialize the new resource these
pointers to the 'original db' resource are serialized to a href as you can see. As far as I can see
it works correctly.

Here is the output I get:
<?xml version="1.0" encoding="UTF-8"?>
<lobj:ModuleFolder xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:lobj="lobj.ecore"
id="modfo-27C47B58-71F7-6F08-DDCE-E40D4EBA305C" timestamp="2007-03-21T12:22:20.000+0100">
<lobj:folderMeta id="folme-B9B50DAC-4C93-6C2C-906C-27CC08836C32"
timestamp="2007-03-21T12:22:20.000+0100">
<title>- kein Titel -</title>
</lobj:folderMeta>
<lobj:moduleFolder id="modfo-252FEE5B-DD17-8AAA-95EC-2F183B681088"
timestamp="2007-03-21T12:22:22.000+0100">
<lobj:folderMeta id="folme-2D60FC6B-255D-6757-1AAE-443557D3C043"
timestamp="2007-03-21T12:22:29.000+0100">
<title>- kein Titel -</title>
</lobj:folderMeta>
<lobj:module id="modul-B3682DBC-4214-5079-5AFA-D1442772E611"
timestamp="2007-03-21T12:22:29.000+0100">
<lobj:moduleMeta id="modme-1746A529-4DD0-0712-B3FA-EEA5FA1D6BFD"
timestamp="2007-03-21T12:22:31.000+0100">
<lobj:didacMeta id="didme-29DD1E0D-F4D9-A4C9-9FB8-CB1BB8716B39">

<lobj:language> hibernate://?dsname=AuthortoolDataStore&loadStrategy=add ToContents&query1=from
ModuleFolder where id='modfo-27C47B58-71F7-6F08-DDCE-E40D4EBA305C'#de</lobj:language >
<title>- kein Titel -</title>
</lobj:didacMeta>
<creationDate>2007-03-21T12:22:31.000+0100</creationDate>
</lobj:moduleMeta>
<lobj:rootNode xsi:type="lobj:ThemeNode" id="theno-E6ECA384-CBC8-05D5-45EE-EF7D4B439932">
<lobj:childnodes xsi:type="lobj:ThemeNode" id="theno-3919AAAF-2CB9-AFB2-12EB-59F114262B4D">
<lobj:theme id="theme-8F5F78E5-80A2-C5E6-549A-A74EA345B6AF"
timestamp="2007-03-21T12:22:33.000+0100">
<lobj:simpleDidacMeta id="simme-A35AC636-3DB6-5817-90D4-B46843E5136E">

<lobj:language> hibernate://?dsname=AuthortoolDataStore&loadStrategy=add ToContents&query1=from
ModuleFolder where id='modfo-27C47B58-71F7-6F08-DDCE-E40D4EBA305C'#de</lobj:language >
<title>- kein Titel -</title>
</lobj:simpleDidacMeta>
</lobj:theme>
<lobj:childnodes xsi:type="lobj:LuNode" id="lunod-927DAFBB-EBBC-864D-7C29-9CA78A9699B5">

<lobj:learningUnit> hibernate://?dsname=AuthortoolDataStore&loadStrategy=add ToContents&query1=from
ModuleFolder where
id='modfo-27C47B58-71F7-6F08-DDCE-E40D4EBA305C'#learn-1C3917 34-EF05-CABA-2E9E-7933863BCE4B </lobj:learningUnit>
</lobj:childnodes>
<lobj:childnodes xsi:type="lobj:LuNode" id="lunod-0900BE6A-D0B1-B88C-0B8C-83C07C34261A">

<lobj:learningUnit> hibernate://?dsname=AuthortoolDataStore&loadStrategy=add ToContents&query1=from
ModuleFolder where
id='modfo-27C47B58-71F7-6F08-DDCE-E40D4EBA305C'#learn-DCDF4C 0A-088A-F507-E839-DC264DF1A66B </lobj:learningUnit>
</lobj:childnodes>
</lobj:childnodes>
</lobj:rootNode>
</lobj:module>
</lobj:moduleFolder>
</lobj:ModuleFolder>

Christian Donhofer wrote:
> hi!
>
> here's the file:
> http://donhofer.net/mirror/hibernate/lobj.ecore
>
> TIA, chris
>
> On Fri, 23 Mar 2007 19:11:13 +0100 Martin Taal wrote:
>
>> Hi Christian,
>> Can you send me the ecore? You posted the test program so I can try to reproduce it.
>>
>> gr. Martin
>>
>> Christian Donhofer wrote:
>>> just to add all necessary information:
>>>
>>> http://donhofer.net/mirror/hibernate/hibernate.hbm.xml
>>>
>>> im loading a modulefolder.
>>>
>>> missing in the loaded resource(&set): LearningUnit (and contained)
>>>
>>> (strangely) present in the resource: Language
>>>
>>> cheers, chris
>>


--

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: StoreResource.LOAD_STRATEGY_PARAM [message #603823 is a reply to message #76385] Fri, 23 March 2007 15:00 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Christian,
In the version I have all these constants are present (in the StoreResource class). Which version of
Teneo are you using?

The variable names on the website should be all valid for the 0.8.0 release with many also being
valid for the 0.7.5 release.

gr. Martin

Christian Donhofer wrote:
> hi all!
>
> i need to configure teneo to load all references of a loaded object into
> a resource.
>
> on the elver website
> ( http://www.elver.org/hibernate/hibernateresources.html#Load+ of+referenced+Objects),
> it is said that i need to set the StoreResource.LOAD_STRATEGY_PARAM to
> StoreResource.ADD_TO_CONTENTS.
>
> unfortunately, i can find neither of these constants in the
> org.eclipse.emf.teneo.resource.StoreResource class.
>
> where do i find them? since many variable names etc. on the elver website
> are out of date, i believe they might have been moved&renamed. quick
> answers would be very appreciated =)
>
> TIA, cheers, chris


--

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: StoreResource.LOAD_STRATEGY_PARAM [message #603826 is a reply to message #76402] Fri, 23 March 2007 15:11 Go to previous message
Christian Donhofer is currently offline Christian DonhoferFriend
Messages: 94
Registered: July 2009
Member
hi martin!

thx for the quick answer! nice to see someone being so motivated and
supportive =)
at the moment im using 0.7.5, so i'll try and use 0.8.0 now.

cheers, chris

On Fri, 23 Mar 2007 16:00:53 +0100 wrote Martin Taal:

> Hi Christian,
> In the version I have all these constants are present (in the StoreResource class). Which version of
> Teneo are you using?
>
> The variable names on the website should be all valid for the 0.8.0 release with many also being
> valid for the 0.7.5 release.
>
> gr. Martin
Re: TENEO: StoreResource.LOAD_STRATEGY_PARAM [message #603829 is a reply to message #76416] Fri, 23 March 2007 15:15 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
These constants should also be in 0.7.5.
The 0.8.0 release requires emf 2.3 (and eclipse 3.3/jdk 1.5).

gr. Martin

Christian Donhofer wrote:
> hi martin!
>
> thx for the quick answer! nice to see someone being so motivated and
> supportive =)
> at the moment im using 0.7.5, so i'll try and use 0.8.0 now.
>
> cheers, chris
>
> On Fri, 23 Mar 2007 16:00:53 +0100 wrote Martin Taal:
>
>> Hi Christian,
>> In the version I have all these constants are present (in the StoreResource class). Which version of
>> Teneo are you using?
>>
>> The variable names on the website should be all valid for the 0.8.0 release with many also being
>> valid for the 0.7.5 release.
>>
>> gr. Martin
>
>


--

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: StoreResource.LOAD_STRATEGY_PARAM [message #603830 is a reply to message #76431] Fri, 23 March 2007 15:38 Go to previous message
Christian Donhofer is currently offline Christian DonhoferFriend
Messages: 94
Registered: July 2009
Member
hmmm, somehow i cant find them in 0.7.5, but i just upgraded to 0.8.0 and
everything works fine now!

cheers, chris

On Fri, 23 Mar 2007 16:15:33 +0100 wrote Martin Taal:

> These constants should also be in 0.7.5.
> The 0.8.0 release requires emf 2.3 (and eclipse 3.3/jdk 1.5).
>
> gr. Martin
>
> Christian Donhofer wrote:
>> hi martin!
>>
>> thx for the quick answer! nice to see someone being so motivated and
>> supportive =)
>> at the moment im using 0.7.5, so i'll try and use 0.8.0 now.
>>
>> cheers, chris
>>
>> On Fri, 23 Mar 2007 16:00:53 +0100 wrote Martin Taal:
>>
>>> Hi Christian,
>>> In the version I have all these constants are present (in the StoreResource class). Which version of
>>> Teneo are you using?
>>>
>>> The variable names on the website should be all valid for the 0.8.0 release with many also being
>>> valid for the 0.7.5 release.
>>>
>>> gr. Martin
>>
>>
Re: TENEO: StoreResource.LOAD_STRATEGY_PARAM [message #603832 is a reply to message #76448] Fri, 23 March 2007 16:10 Go to previous message
Christian Donhofer is currently offline Christian DonhoferFriend
Messages: 94
Registered: July 2009
Member
hi again!

accessing the constants now works, which leads to the following query:
hibernate://?dsname=AuthortoolDataStore&loadStrategy=add ToContents&query1=from
ModuleFolder where id='modfo-27C47B58-71F7-6F08-DDCE-E40D4EBA305C'

still, the "lazily linked" objects are not being loaded into a resource.
instead, the serialized string contains an empty tag with a href:

<lobj:learningUnit> hibernate://?dsname=AuthortoolDataStore&loadStrategy=add ToContents&query1=from
ModuleFolder where
id='modfo-27C47B58-71F7-6F08-DDCE-E40D4EBA305C'#learn-1C3917 34-EF05-CABA-2E9E-7933863BCE4B </lobj:learningUnit>

here's the code im using:
session = getSession();
Transaction tx = session.getTransaction();
ResourceSet resourceSet = getResourceSet();
Resource rs = resourceSet.createResource(URI.createFileURI("soEinDummy.lobj "));

// create an uri using the SessionController name
URI uri1 = URI.createURI("hibernate://?dsname=" + dataStore.getName() + "&" +
StoreResource.LOAD_STRATEGY_PARAM + "=" + StoreResource.ADD_TO_CONTENTS +
"&query1=from "+eclassname+" where id='"+id+"'");

System.out.println("Loading with this QUERY: "+uri1.toString());

final Resource res1 = resourceSet.createResource(uri1);

tx.begin();

// now load the resources
try {
res1.load(Collections.EMPTY_MAP);
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
tx.commit();
System.out.println("LOADED RESOURCE CONTAINS "+res1.getContents().size()+"OBJECTS!");
System.out.println("LOADED RESOURCESET CONTAINS "+res1.getResourceSet().getResources().size()+" RESOURCES!");

for(Iterator iter = res1.getResourceSet().getResources().iterator(); iter.hasNext();){
Resource resource = (Resource)iter.next();
if(resource.getContents().size() > 0){
EObject eo = EcoreUtil.copy((EObject)resource.getContents().get(0));
rs.getContents().add(eo);
}
}
-------------------
after that, all needed objects should be in rs, shouldn't they?

TIA, chris
p.s.:
i also tried:
for (Iterator iter = res1.getContents().iterator(); iter.hasNext();) {
EObject element = (EObject) iter.next();
System.out.println("adding "+element.toString());
EObject eo = EcoreUtil.copy(element);
System.out.println("resource contains:" +eo.toString());
rs.getContents().add(eo);
}
but that throws a ConcurrentModificationException.
Re: TENEO: StoreResource.LOAD_STRATEGY_PARAM [message #603833 is a reply to message #76463] Fri, 23 March 2007 16:35 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi,
Yes I would say that the copy action should load all the objects, can you debug through the copy
action and see if it traverses the containment tree?
A teneo resource has a special iterator which does not load unloaded lists but I do not think that
the copy action makes use of that.

gr. Martin

Christian Donhofer wrote:
> hi again!
>
> accessing the constants now works, which leads to the following query:
> hibernate://?dsname=AuthortoolDataStore&loadStrategy=add ToContents&query1=from
> ModuleFolder where id='modfo-27C47B58-71F7-6F08-DDCE-E40D4EBA305C'
>
> still, the "lazily linked" objects are not being loaded into a resource.
> instead, the serialized string contains an empty tag with a href:
>
> <lobj:learningUnit> hibernate://?dsname=AuthortoolDataStore&loadStrategy=add ToContents&query1=from
> ModuleFolder where
> id='modfo-27C47B58-71F7-6F08-DDCE-E40D4EBA305C'#learn-1C3917 34-EF05-CABA-2E9E-7933863BCE4B </lobj:learningUnit>
>
> here's the code im using:
> session = getSession();
> Transaction tx = session.getTransaction();
> ResourceSet resourceSet = getResourceSet();
> Resource rs = resourceSet.createResource(URI.createFileURI("soEinDummy.lobj "));
>
> // create an uri using the SessionController name
> URI uri1 = URI.createURI("hibernate://?dsname=" + dataStore.getName() + "&" +
> StoreResource.LOAD_STRATEGY_PARAM + "=" + StoreResource.ADD_TO_CONTENTS +
> "&query1=from "+eclassname+" where id='"+id+"'");
>
> System.out.println("Loading with this QUERY: "+uri1.toString());
>
> final Resource res1 = resourceSet.createResource(uri1);
>
> tx.begin();
>
> // now load the resources
> try {
> res1.load(Collections.EMPTY_MAP);
> } catch (IOException e1) {
> // TODO Auto-generated catch block
> e1.printStackTrace();
> }
> tx.commit();
> System.out.println("LOADED RESOURCE CONTAINS "+res1.getContents().size()+"OBJECTS!");
> System.out.println("LOADED RESOURCESET CONTAINS "+res1.getResourceSet().getResources().size()+" RESOURCES!");
>
> for(Iterator iter = res1.getResourceSet().getResources().iterator(); iter.hasNext();){
> Resource resource = (Resource)iter.next();
> if(resource.getContents().size() > 0){
> EObject eo = EcoreUtil.copy((EObject)resource.getContents().get(0));
> rs.getContents().add(eo);
> }
> }
> -------------------
> after that, all needed objects should be in rs, shouldn't they?
>
> TIA, chris
> p.s.:
> i also tried:
> for (Iterator iter = res1.getContents().iterator(); iter.hasNext();) {
> EObject element = (EObject) iter.next();
> System.out.println("adding "+element.toString());
> EObject eo = EcoreUtil.copy(element);
> System.out.println("resource contains:" +eo.toString());
> rs.getContents().add(eo);
> }
> but that throws a ConcurrentModificationException.
>
>


--

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: StoreResource.LOAD_STRATEGY_PARAM [message #603845 is a reply to message #76480] Fri, 23 March 2007 17:22 Go to previous message
Christian Donhofer is currently offline Christian DonhoferFriend
Messages: 94
Registered: July 2009
Member
the copy function seems to use
HibernateResource(StoreResource).getContents() line: 455


without this method, f.i. using
EObject eo =
(EObject)resource.getContents().get(0);

i get a dangling href exception anyway.

but the problem seems to be that the loaded resource doesn't contain
anything else but the contained objects of the requested one.

cheers, chris


On Fri, 23 Mar 2007 17:35:32 +0100 wrote Martin Taal:

> Hi,
> Yes I would say that the copy action should load all the objects, can you debug through the copy
> action and see if it traverses the containment tree?
> A teneo resource has a special iterator which does not load unloaded lists but I do not think that
> the copy action makes use of that.
>
> gr. Martin
>
Re: TENEO: StoreResource.LOAD_STRATEGY_PARAM [message #603847 is a reply to message #76561] Fri, 23 March 2007 17:43 Go to previous message
Christian Donhofer is currently offline Christian DonhoferFriend
Messages: 94
Registered: July 2009
Member
just to add all necessary information:

http://donhofer.net/mirror/hibernate/hibernate.hbm.xml

im loading a modulefolder.

missing in the loaded resource(&set): LearningUnit (and contained)

(strangely) present in the resource: Language

cheers, chris
Re: TENEO: StoreResource.LOAD_STRATEGY_PARAM [message #603849 is a reply to message #76577] Fri, 23 March 2007 18:11 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Christian,
Can you send me the ecore? You posted the test program so I can try to reproduce it.

gr. Martin

Christian Donhofer wrote:
> just to add all necessary information:
>
> http://donhofer.net/mirror/hibernate/hibernate.hbm.xml
>
> im loading a modulefolder.
>
> missing in the loaded resource(&set): LearningUnit (and contained)
>
> (strangely) present in the resource: Language
>
> cheers, chris


--

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: StoreResource.LOAD_STRATEGY_PARAM [message #603852 is a reply to message #76609] Sun, 25 March 2007 13:30 Go to previous message
Christian Donhofer is currently offline Christian DonhoferFriend
Messages: 94
Registered: July 2009
Member
hi!

here's the file:
http://donhofer.net/mirror/hibernate/lobj.ecore

TIA, chris

On Fri, 23 Mar 2007 19:11:13 +0100 Martin Taal wrote:

> Hi Christian,
> Can you send me the ecore? You posted the test program so I can try to reproduce it.
>
> gr. Martin
>
> Christian Donhofer wrote:
>> just to add all necessary information:
>>
>> http://donhofer.net/mirror/hibernate/hibernate.hbm.xml
>>
>> im loading a modulefolder.
>>
>> missing in the loaded resource(&set): LearningUnit (and contained)
>>
>> (strangely) present in the resource: Language
>>
>> cheers, chris
>
>
Re: TENEO: StoreResource.LOAD_STRATEGY_PARAM [message #604078 is a reply to message #76625] Fri, 30 March 2007 15:24 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Christian,
Okay it runs. Your original call was:
>>>>>>>

still, the "lazily linked" objects are not being loaded into a resource.
instead, the serialized string contains an empty tag with a href:

<lobj:learningUnit> hibernate://?dsname=AuthortoolDataStore&loadStrategy=add ToContents&query1=from
ModuleFolder where
id='modfo-27C47B58-71F7-6F08-DDCE-E40D4EBA305C'#learn-1C3917 34-EF05-CABA-2E9E-7933863BCE4B </lobj:learningUnit>

>>>>>>>>

What the copy action does is copy the containment structure, so if an eobject is copied then only
its contained children are copied. All non-containment relations still point to objects from the
original tree (which is in a different resource). When you then serialize the new resource these
pointers to the 'original db' resource are serialized to a href as you can see. As far as I can see
it works correctly.

Here is the output I get:
<?xml version="1.0" encoding="UTF-8"?>
<lobj:ModuleFolder xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:lobj="lobj.ecore"
id="modfo-27C47B58-71F7-6F08-DDCE-E40D4EBA305C" timestamp="2007-03-21T12:22:20.000+0100">
<lobj:folderMeta id="folme-B9B50DAC-4C93-6C2C-906C-27CC08836C32"
timestamp="2007-03-21T12:22:20.000+0100">
<title>- kein Titel -</title>
</lobj:folderMeta>
<lobj:moduleFolder id="modfo-252FEE5B-DD17-8AAA-95EC-2F183B681088"
timestamp="2007-03-21T12:22:22.000+0100">
<lobj:folderMeta id="folme-2D60FC6B-255D-6757-1AAE-443557D3C043"
timestamp="2007-03-21T12:22:29.000+0100">
<title>- kein Titel -</title>
</lobj:folderMeta>
<lobj:module id="modul-B3682DBC-4214-5079-5AFA-D1442772E611"
timestamp="2007-03-21T12:22:29.000+0100">
<lobj:moduleMeta id="modme-1746A529-4DD0-0712-B3FA-EEA5FA1D6BFD"
timestamp="2007-03-21T12:22:31.000+0100">
<lobj:didacMeta id="didme-29DD1E0D-F4D9-A4C9-9FB8-CB1BB8716B39">

<lobj:language> hibernate://?dsname=AuthortoolDataStore&loadStrategy=add ToContents&query1=from
ModuleFolder where id='modfo-27C47B58-71F7-6F08-DDCE-E40D4EBA305C'#de</lobj:language >
<title>- kein Titel -</title>
</lobj:didacMeta>
<creationDate>2007-03-21T12:22:31.000+0100</creationDate>
</lobj:moduleMeta>
<lobj:rootNode xsi:type="lobj:ThemeNode" id="theno-E6ECA384-CBC8-05D5-45EE-EF7D4B439932">
<lobj:childnodes xsi:type="lobj:ThemeNode" id="theno-3919AAAF-2CB9-AFB2-12EB-59F114262B4D">
<lobj:theme id="theme-8F5F78E5-80A2-C5E6-549A-A74EA345B6AF"
timestamp="2007-03-21T12:22:33.000+0100">
<lobj:simpleDidacMeta id="simme-A35AC636-3DB6-5817-90D4-B46843E5136E">

<lobj:language> hibernate://?dsname=AuthortoolDataStore&loadStrategy=add ToContents&query1=from
ModuleFolder where id='modfo-27C47B58-71F7-6F08-DDCE-E40D4EBA305C'#de</lobj:language >
<title>- kein Titel -</title>
</lobj:simpleDidacMeta>
</lobj:theme>
<lobj:childnodes xsi:type="lobj:LuNode" id="lunod-927DAFBB-EBBC-864D-7C29-9CA78A9699B5">

<lobj:learningUnit> hibernate://?dsname=AuthortoolDataStore&loadStrategy=add ToContents&query1=from
ModuleFolder where
id='modfo-27C47B58-71F7-6F08-DDCE-E40D4EBA305C'#learn-1C3917 34-EF05-CABA-2E9E-7933863BCE4B </lobj:learningUnit>
</lobj:childnodes>
<lobj:childnodes xsi:type="lobj:LuNode" id="lunod-0900BE6A-D0B1-B88C-0B8C-83C07C34261A">

<lobj:learningUnit> hibernate://?dsname=AuthortoolDataStore&loadStrategy=add ToContents&query1=from
ModuleFolder where
id='modfo-27C47B58-71F7-6F08-DDCE-E40D4EBA305C'#learn-DCDF4C 0A-088A-F507-E839-DC264DF1A66B </lobj:learningUnit>
</lobj:childnodes>
</lobj:childnodes>
</lobj:rootNode>
</lobj:module>
</lobj:moduleFolder>
</lobj:ModuleFolder>

Christian Donhofer wrote:
> hi!
>
> here's the file:
> http://donhofer.net/mirror/hibernate/lobj.ecore
>
> TIA, chris
>
> On Fri, 23 Mar 2007 19:11:13 +0100 Martin Taal wrote:
>
>> Hi Christian,
>> Can you send me the ecore? You posted the test program so I can try to reproduce it.
>>
>> gr. Martin
>>
>> Christian Donhofer wrote:
>>> just to add all necessary information:
>>>
>>> http://donhofer.net/mirror/hibernate/hibernate.hbm.xml
>>>
>>> im loading a modulefolder.
>>>
>>> missing in the loaded resource(&set): LearningUnit (and contained)
>>>
>>> (strangely) present in the resource: Language
>>>
>>> cheers, chris
>>


--

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:JET: How to obtain GenClass?
Next Topic:New build for Teneo, release notes (0.8.0 - 0.7.5)
Goto Forum:
  


Current Time: Thu Mar 28 13:59:25 GMT 2024

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

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

Back to the top