Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » HibernateResource loading behaviour
HibernateResource loading behaviour [message #76673] Tue, 27 March 2007 06:33 Go to next message
Markus Bischof is currently offline Markus BischofFriend
Messages: 72
Registered: July 2009
Member
This is a multi-part message in MIME format.

------=_NextPart_000_0006_01C7704A.AA1963F0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hi!

I'm having some trouble handling the resource loading (and perhaps =
saving).=20

Here is the method I'm using for saving a resource (which includes only =
one top level object named "Package"). First I create a new resource =
with a specific URI, then I'm adding some contents to that resource, and =
after that I call the save-method.

Resource hibernateResource =3D =
resourceSet.createResource(URI.createPlatformResourceURI(ran domName+ ".mye=
xtension"));

[adding some contents ]

hibernateResource.save(Collections.EMPTY_MAP);

My problem is, when I want to load a specific Resource again, I receive =
all the to plevel objects (meaning I have all the top level "Packages" =
in that one resource), but my intention was to only load that one =
package, which I saved under the specific URI. Here's the code for that: =


Resource hibernateResource =3D =
resourceSet.createResource(URI.createPlatformResourceURI(sam eRandomNameAs=
Above+".myextension"));hibernateResource.load(Collections.EMPTY_MAP);





------=_NextPart_000_0006_01C7704A.AA1963F0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.6000.16414" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV><FONT face=3DArial size=3D2>Hi!</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I'm having some trouble handling the =
resource=20
loading (and perhaps saving). </FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Here is the method I'm using for saving =
a resource=20
(which includes&nbsp;only one&nbsp;top level object named "Package"). =
First I=20
create a new resource with a specific URI, then I'm adding some contents =
to that=20
resource, and after that I call the save-method.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV>
<P><FONT face=3DArial size=3D2>Resource hibernateResource =3D=20
resourceSet.createResource(URI.createPlatformResourceURI(ran domName+ ".mye=
xtension"));</FONT></P>
<P><FONT face=3DArial size=3D2>[adding some contents ]</FONT></P>
<P><FONT face=3DArial=20
size=3D2>hibernateResource.save(Collections.EMPTY_MAP);</FONT ></P>
<P><FONT face=3DArial size=3D2>My problem is, when I want to load a =
specific=20
Resource again, I receive all the to plevel objects (meaning I have all =
the top=20
level "Packages" in that one resource), but my intention was to only =
load that=20
one package, which I saved under the specific URI. Here's the code for=20
that:</FONT><FONT face=3DArial size=3D2>&nbsp;</FONT></P>
<P><FONT face=3DArial size=3D2>Resource hibernateResource =3D=20
resourceSet.createResource(URI.createPlatformResourceURI(sam eRandomNameAs=
Above+".myextension"));</FONT><FONT=20
face=3DArial =
size=3D2>hibernateResource.load(Collections.EMPTY_MAP);</FONT ></P>
<P><FONT face=3DArial size=3D2></FONT>&nbsp;</P>
<P><FONT face=3DArial size=3D2></FONT><FONT face=3DArial=20
size=3D2></FONT>&nbsp;</P></DIV></BODY></HTML>

------=_NextPart_000_0006_01C7704A.AA1963F0--
Re: HibernateResource loading behaviour [message #76693 is a reply to message #76673] Tue, 27 March 2007 06:41 Go to previous messageGo to next message
Markus Bischof is currently offline Markus BischofFriend
Messages: 72
Registered: July 2009
Member
This is a multi-part message in MIME format.

------=_NextPart_000_0041_01C7704B.B565E340
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

....I pressed STRG+S too early! :)

Ok...the loaded resource then contains all the top-level "Packages", =
which I saved earlier, (even when I saved them within a resource under a =
different URI).=20

Do I have to add some options to the load-method or am I missing a step?

Regards,
Markus Bischof
------=_NextPart_000_0041_01C7704B.B565E340
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.6000.16414" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>...I pressed STRG+S too early! =
:)</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Ok...the loaded resource then contains =
all the=20
top-level "Packages", which I saved earlier, (even when I saved them =
within a=20
resource&nbsp;under a different URI). </FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Do I have to add some options to the =
load-method or=20
am I missing a step?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Regards,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Markus =
Bischof</FONT></DIV></BODY></HTML>

------=_NextPart_000_0041_01C7704B.B565E340--
Re: HibernateResource loading behaviour [message #76709 is a reply to message #76693] Tue, 27 March 2007 06:57 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Markus,
This page gives more information:
http://www.elver.org/hibernate/hibernateresources.html
and then the part about toptypes. I think you did not call load before the save first.
The page also gives information on using queries to load the resource.

gr. Martin

Markus Bischof wrote:
> ...I pressed STRG+S too early! :)
>
> Ok...the loaded resource then contains all the top-level "Packages",
> which I saved earlier, (even when I saved them within a resource under a
> different URI).
>
> Do I have to add some options to the load-method or am I missing a step?
>
> Regards,
> Markus Bischof


--

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: HibernateResource loading behaviour [message #76725 is a reply to message #76709] Tue, 27 March 2007 08:10 Go to previous messageGo to next message
Markus Bischof is currently offline Markus BischofFriend
Messages: 72
Registered: July 2009
Member
Hi!

Ok, I think I have to use special uri-parameters (queries) to load a
resource.

How can I specify, that I only want to load that contents (in my case
"Packages") in the resource, which were saved under the same URI before
(created with URI.createPlatformResourceURI(someURI.myextension))?

Markus
Re: HibernateResource loading behaviour [message #76740 is a reply to message #76725] Tue, 27 March 2007 08:26 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Markus,
Yes, correct.
You mean that you want to keep track which objects were saved under which uri. This is not directly
supported by Teneo. With Teneo a resource is really a view on a database and an uri defines a
selection on that dataset.
You could also solve this in your application model by giving every object a resource-name (or uri
or whatever) member. But it is probable that one object can be saved using different uri's.

You can also extend the hibernateresource and implement your own specific load/save behavior.

gr. Martin


Markus Bischof wrote:
> Hi!
>
> Ok, I think I have to use special uri-parameters (queries) to load a
> resource.
>
> How can I specify, that I only want to load that contents (in my case
> "Packages") in the resource, which were saved under the same URI before
> (created with URI.createPlatformResourceURI(someURI.myextension))?
>
> Markus
>
>


--

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: HibernateResource loading behaviour [message #76788 is a reply to message #76740] Tue, 27 March 2007 15:37 Go to previous message
Markus Bischof is currently offline Markus BischofFriend
Messages: 72
Registered: July 2009
Member
Hi!

Now I'm assinging each top-level object an unique name (the objects already
got a field 'name', but it was not used until now), so that I can load them
separately into a resource.

For that purpose I'm using URIs with a query like this one:

Resource res = resourceSet.createResource(
URI.createURI(hibernate://?dsname=EXTENSIONNAME&query1=from
TOPLEVELCLASS where name='"+NAME_TO_LOAD+"'"));
res.load(Collections,EMPTY_MAP);

Regards,
Markus Bischof
Re: HibernateResource loading behaviour [message #603865 is a reply to message #76673] Tue, 27 March 2007 06:41 Go to previous message
Markus Bischof is currently offline Markus BischofFriend
Messages: 72
Registered: July 2009
Member
This is a multi-part message in MIME format.

------=_NextPart_000_0041_01C7704B.B565E340
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

....I pressed STRG+S too early! :)

Ok...the loaded resource then contains all the top-level "Packages", =
which I saved earlier, (even when I saved them within a resource under a =
different URI).=20

Do I have to add some options to the load-method or am I missing a step?

Regards,
Markus Bischof
------=_NextPart_000_0041_01C7704B.B565E340
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.6000.16414" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>...I pressed STRG+S too early! =
:)</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Ok...the loaded resource then contains =
all the=20
top-level "Packages", which I saved earlier, (even when I saved them =
within a=20
resource&nbsp;under a different URI). </FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Do I have to add some options to the =
load-method or=20
am I missing a step?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Regards,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Markus =
Bischof</FONT></DIV></BODY></HTML>

------=_NextPart_000_0041_01C7704B.B565E340--
Re: HibernateResource loading behaviour [message #603868 is a reply to message #76693] Tue, 27 March 2007 06:57 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Markus,
This page gives more information:
http://www.elver.org/hibernate/hibernateresources.html
and then the part about toptypes. I think you did not call load before the save first.
The page also gives information on using queries to load the resource.

gr. Martin

Markus Bischof wrote:
> ...I pressed STRG+S too early! :)
>
> Ok...the loaded resource then contains all the top-level "Packages",
> which I saved earlier, (even when I saved them within a resource under a
> different URI).
>
> Do I have to add some options to the load-method or am I missing a step?
>
> Regards,
> Markus Bischof


--

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: HibernateResource loading behaviour [message #603869 is a reply to message #76709] Tue, 27 March 2007 08:10 Go to previous message
Markus Bischof is currently offline Markus BischofFriend
Messages: 72
Registered: July 2009
Member
Hi!

Ok, I think I have to use special uri-parameters (queries) to load a
resource.

How can I specify, that I only want to load that contents (in my case
"Packages") in the resource, which were saved under the same URI before
(created with URI.createPlatformResourceURI(someURI.myextension))?

Markus
Re: HibernateResource loading behaviour [message #603872 is a reply to message #76725] Tue, 27 March 2007 08:26 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Markus,
Yes, correct.
You mean that you want to keep track which objects were saved under which uri. This is not directly
supported by Teneo. With Teneo a resource is really a view on a database and an uri defines a
selection on that dataset.
You could also solve this in your application model by giving every object a resource-name (or uri
or whatever) member. But it is probable that one object can be saved using different uri's.

You can also extend the hibernateresource and implement your own specific load/save behavior.

gr. Martin


Markus Bischof wrote:
> Hi!
>
> Ok, I think I have to use special uri-parameters (queries) to load a
> resource.
>
> How can I specify, that I only want to load that contents (in my case
> "Packages") in the resource, which were saved under the same URI before
> (created with URI.createPlatformResourceURI(someURI.myextension))?
>
> Markus
>
>


--

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: HibernateResource loading behaviour [message #603883 is a reply to message #76740] Tue, 27 March 2007 15:37 Go to previous message
Markus Bischof is currently offline Markus BischofFriend
Messages: 72
Registered: July 2009
Member
Hi!

Now I'm assinging each top-level object an unique name (the objects already
got a field 'name', but it was not used until now), so that I can load them
separately into a resource.

For that purpose I'm using URIs with a query like this one:

Resource res = resourceSet.createResource(
URI.createURI(hibernate://?dsname=EXTENSIONNAME&query1=from
TOPLEVELCLASS where name='"+NAME_TO_LOAD+"'"));
res.load(Collections,EMPTY_MAP);

Regards,
Markus Bischof
Previous Topic:oAW Xtend - workflow help
Next Topic:[Teneo] HibernateResource with mapping file
Goto Forum:
  


Current Time: Sat Apr 20 03:22:24 GMT 2024

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

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

Back to the top