Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [Teneo] Hiberante and Hbxml resource
[Teneo] Hiberante and Hbxml resource [message #122894] Thu, 22 May 2008 19:21 Go to next message
Matthias Treitler is currently offline Matthias TreitlerFriend
Messages: 117
Registered: July 2009
Senior Member
Hello!

My application uses a GMF based editor with Teneo to store the model
instances to the database. Currently i am using two resources, the HBXML
resource for the editor and the hibernate resource for my other model
entities.

Attributes of the GMF related model entities have non-containment
references to model entities in the hibernate resource. When opening my
diagram editor I load the hibernate resource, but when I create a new
model instance and save it, then I also have to reopen my GMF diagram
editor to be able to reference it.

So my question is: Would it be a disadvantage if I use the HBXML resource
for all of my model entities?!? Would it work?! Would there be any
limitiations?!
If yes, then how can I manage my problem?!?

Best regards,
Matthias
Re: [Teneo] Hiberante and Hbxml resource [message #122898 is a reply to message #122894] Thu, 22 May 2008 22:05 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Matthias,
The HibernateXMLResource inherits from the HibernateResource and only adds minimal xml specifics. So
afaics you can use the HibernateXMLResource for all your data.

gr. Martin

Matthias wrote:
> Hello!
>
> My application uses a GMF based editor with Teneo to store the model
> instances to the database. Currently i am using two resources, the HBXML
> resource for the editor and the hibernate resource for my other model
> entities.
>
> Attributes of the GMF related model entities have non-containment
> references to model entities in the hibernate resource. When opening my
> diagram editor I load the hibernate resource, but when I create a new
> model instance and save it, then I also have to reopen my GMF diagram
> editor to be able to reference it.
>
> So my question is: Would it be a disadvantage if I use the HBXML
> resource for all of my model entities?!? Would it work?! Would there be
> any limitiations?!
> If yes, then how can I manage my problem?!?
>
> Best regards,
> Matthias
>


--

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] Hiberante and Hbxml resource [message #122965 is a reply to message #122898] Mon, 26 May 2008 07:34 Go to previous messageGo to next message
Matthias Treitler is currently offline Matthias TreitlerFriend
Messages: 117
Registered: July 2009
Senior Member
Hello Martin,
thank you for your answer.

I have some additional questions (honestly I do not know Hibernate very
well so these questions might also be related to Hibernate in general).

1. My persisted model instances have ids like 987845 and 345152 so on. Why
does not counting start at 1 even on an empty database?!?

2. I have a plugin that registers a "persistence" service, that provides
storage to databases with Teneo. The service provides the interface method
"getResource" that returns in fact the HibernateXMLResource. This
resources gets loaded on startup of the plug-in and unloaded at the end of
the plug-in lifecycle. Is this good practice (because in the GMF tutorial
you load and un-load a new resource when you need it.). Saving the
resource also does a commit, right?!

3. In terms of performance and best practice: I want to search a model
object with a specific name in my database. What do you think, iterating
the resource and making instanceofs and equals calls or creating a HSQL on
the session object?!?

4. I have a GMF based model instance editor and I am using Teneo for
diagram and model persistence. My meta-model defines for instance that the
model object "Company" must have a (ONE) name. When I create a Company in
the diagram editor and do not set a name, I get an error message. Is there
any mechanism to provide a self defined error message (because the default
one might be to technical and implementation specific for the end user).

Thank you for any response...

Best regards,
Matthias
Re: [Teneo] Hiberante and Hbxml resource [message #122967 is a reply to message #122965] Mon, 26 May 2008 12:31 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Matthias,
See comments inline.

gr. Martin

Matthias wrote:
> Hello Martin,
> thank you for your answer.
>
> I have some additional questions (honestly I do not know Hibernate very
> well so these questions might also be related to Hibernate in general).
>
> 1. My persisted model instances have ids like 987845 and 345152 so on.
> Why does not counting start at 1 even on an empty database?!?
MT>> It should start with 1, you can check the database configuration, you can also try to remove
the database and start from fresh again. Are you sure that your id's are autosequence id's?
>
> 2. I have a plugin that registers a "persistence" service, that provides
> storage to databases with Teneo. The service provides the interface
> method "getResource" that returns in fact the HibernateXMLResource. This
> resources gets loaded on startup of the plug-in and unloaded at the end
> of the plug-in lifecycle. Is this good practice (because in the GMF
> tutorial you load and un-load a new resource when you need it.). Saving
> the resource also does a commit, right?!
MT>> Yes save does a commit, the resource only opens a transaction during the load/save. So in
between it does not put load on the database. So this is good practice.

>
> 3. In terms of performance and best practice: I want to search a model
> object with a specific name in my database. What do you think, iterating
> the resource and making instanceofs and equals calls or creating a HSQL
> on the session object?!?
MT>> It all depends on your database size. I prefer querying because it always works (also with
larger databases).

>
> 4. I have a GMF based model instance editor and I am using Teneo for
> diagram and model persistence. My meta-model defines for instance that
> the model object "Company" must have a (ONE) name. When I create a
> Company in the diagram editor and do not set a name, I get an error
> message. Is there any mechanism to provide a self defined error message
> (because the default one might be to technical and implementation
> specific for the end user).
MT>> I would have expected that EMF validation would have caught this one upfront. Can you check if
validation is done before/during save? (see the StoreResource.validateContents method).

>
> Thank you for any response...
>
> Best regards,
> Matthias
>


--

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] Hiberante and Hbxml resource [message #618149 is a reply to message #122894] Thu, 22 May 2008 22:05 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Matthias,
The HibernateXMLResource inherits from the HibernateResource and only adds minimal xml specifics. So
afaics you can use the HibernateXMLResource for all your data.

gr. Martin

Matthias wrote:
> Hello!
>
> My application uses a GMF based editor with Teneo to store the model
> instances to the database. Currently i am using two resources, the HBXML
> resource for the editor and the hibernate resource for my other model
> entities.
>
> Attributes of the GMF related model entities have non-containment
> references to model entities in the hibernate resource. When opening my
> diagram editor I load the hibernate resource, but when I create a new
> model instance and save it, then I also have to reopen my GMF diagram
> editor to be able to reference it.
>
> So my question is: Would it be a disadvantage if I use the HBXML
> resource for all of my model entities?!? Would it work?! Would there be
> any limitiations?!
> If yes, then how can I manage my problem?!?
>
> Best regards,
> Matthias
>


--

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] Hiberante and Hbxml resource [message #618966 is a reply to message #122898] Mon, 26 May 2008 07:34 Go to previous message
Matthias Treitler is currently offline Matthias TreitlerFriend
Messages: 117
Registered: July 2009
Senior Member
Hello Martin,
thank you for your answer.

I have some additional questions (honestly I do not know Hibernate very
well so these questions might also be related to Hibernate in general).

1. My persisted model instances have ids like 987845 and 345152 so on. Why
does not counting start at 1 even on an empty database?!?

2. I have a plugin that registers a "persistence" service, that provides
storage to databases with Teneo. The service provides the interface method
"getResource" that returns in fact the HibernateXMLResource. This
resources gets loaded on startup of the plug-in and unloaded at the end of
the plug-in lifecycle. Is this good practice (because in the GMF tutorial
you load and un-load a new resource when you need it.). Saving the
resource also does a commit, right?!

3. In terms of performance and best practice: I want to search a model
object with a specific name in my database. What do you think, iterating
the resource and making instanceofs and equals calls or creating a HSQL on
the session object?!?

4. I have a GMF based model instance editor and I am using Teneo for
diagram and model persistence. My meta-model defines for instance that the
model object "Company" must have a (ONE) name. When I create a Company in
the diagram editor and do not set a name, I get an error message. Is there
any mechanism to provide a self defined error message (because the default
one might be to technical and implementation specific for the end user).

Thank you for any response...

Best regards,
Matthias
Re: [Teneo] Hiberante and Hbxml resource [message #618968 is a reply to message #122965] Mon, 26 May 2008 12:31 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Matthias,
See comments inline.

gr. Martin

Matthias wrote:
> Hello Martin,
> thank you for your answer.
>
> I have some additional questions (honestly I do not know Hibernate very
> well so these questions might also be related to Hibernate in general).
>
> 1. My persisted model instances have ids like 987845 and 345152 so on.
> Why does not counting start at 1 even on an empty database?!?
MT>> It should start with 1, you can check the database configuration, you can also try to remove
the database and start from fresh again. Are you sure that your id's are autosequence id's?
>
> 2. I have a plugin that registers a "persistence" service, that provides
> storage to databases with Teneo. The service provides the interface
> method "getResource" that returns in fact the HibernateXMLResource. This
> resources gets loaded on startup of the plug-in and unloaded at the end
> of the plug-in lifecycle. Is this good practice (because in the GMF
> tutorial you load and un-load a new resource when you need it.). Saving
> the resource also does a commit, right?!
MT>> Yes save does a commit, the resource only opens a transaction during the load/save. So in
between it does not put load on the database. So this is good practice.

>
> 3. In terms of performance and best practice: I want to search a model
> object with a specific name in my database. What do you think, iterating
> the resource and making instanceofs and equals calls or creating a HSQL
> on the session object?!?
MT>> It all depends on your database size. I prefer querying because it always works (also with
larger databases).

>
> 4. I have a GMF based model instance editor and I am using Teneo for
> diagram and model persistence. My meta-model defines for instance that
> the model object "Company" must have a (ONE) name. When I create a
> Company in the diagram editor and do not set a name, I get an error
> message. Is there any mechanism to provide a self defined error message
> (because the default one might be to technical and implementation
> specific for the end user).
MT>> I would have expected that EMF validation would have caught this one upfront. Can you check if
validation is done before/during save? (see the StoreResource.validateContents method).

>
> Thank you for any response...
>
> Best regards,
> Matthias
>


--

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:How to create a copy of an EObject with non-null Resource
Next Topic:[EMF Compare] Does EMF Compare really need to know about IFile and so on?
Goto Forum:
  


Current Time: Fri Apr 19 11:34:01 GMT 2024

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

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

Back to the top