[Teneo] Model inheritance [message #429676] |
Wed, 29 April 2009 08:17 |
Eclipse User |
|
|
|
Originally posted by: news.eclipse.org.08.lemmster.de
Hi,
in ECF we have a generic service model (discovery.ecore) that is used to
shows services offered by a given host. For customization it is possible
to inherit from this model and "replace" the generic service node with a
n app specific node. This is done by having the service resource create
a specific node if one is registered with EMF. This has been working
fine so far.
Now I want to write an example where the app specific model uses Teneo
with Hibernate. However, when I try to generate the Hibernate mapping
with Teneo, it complains about the discovery not being registered with
EMF. Do I have to register the generic model?
My idea so far is to generate the mapping without inheritance modeled
and make the HibernateResource look-up corresponding objects by passing
queries from the service resource. Though this appears to be rather
hackish. :o
Thanks
Markus
|
|
|
|
Re: [Teneo] Model inheritance [message #429683 is a reply to message #429680] |
Wed, 29 April 2009 12:20 |
Eclipse User |
|
|
|
Originally posted by: eclipse-news.lemmster.de
Martin Taal wrote:
> Hi Markus,
> How do you generate the mapping? Or initialize the datastore?
I use Teneo itself to generate the mapping from the context menu of an
..ecore file.
I haven't thought about initializing the datastore as I intent to use
the HibernateResource, which as far as I understand it, will take care
of the datastore.
> I am not sure what you mean generate the mapping without inheritance.
By inheritance I mean EClass Foo defined in my app specific model A
towards the EClass Base in the service model S. Objects in model A are
going to be stored persistent, while S (theoretically black box) won't.
Generally speaking, I need to store an object where the base class isn't
persist-able, while the subclass is.
Thanks
Markus
|
|
|
Re: [Teneo] Model inheritance [message #429685 is a reply to message #429683] |
Wed, 29 April 2009 12:28 |
Martin Taal Messages: 5468 Registered: July 2009 |
Senior Member |
|
|
Hi Markus,
Do you right click on the discovery.ecore or on the sub-class ecore?
For the HibernateResource you need to initialize a datastore. Also working through the datastore will give you much more
flexibility regarding passing in options:
http://www.elver.org/hibernate/options.html
Regarding the inheritance topic. You also need to register the base class/package in Teneo. You can prevent that it is
persisted by annotating it as Transient (although I have never tried that for base-classes). Another interesting
annotation might be to use @MappedSuperClass (see the jpa specs for what it means).
gr. Martin
Markus Kuppe wrote:
> Martin Taal wrote:
>> Hi Markus,
>> How do you generate the mapping? Or initialize the datastore?
>
> I use Teneo itself to generate the mapping from the context menu of an
> ..ecore file.
> I haven't thought about initializing the datastore as I intent to use
> the HibernateResource, which as far as I understand it, will take care
> of the datastore.
>
>> I am not sure what you mean generate the mapping without inheritance.
>
> By inheritance I mean EClass Foo defined in my app specific model A
> towards the EClass Base in the service model S. Objects in model A are
> going to be stored persistent, while S (theoretically black box) won't.
> Generally speaking, I need to store an object where the base class isn't
> persist-able, while the subclass is.
>
> Thanks
> Markus
--
With Regards, Martin Taal
Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
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] Model inheritance [message #429686 is a reply to message #429685] |
Wed, 29 April 2009 12:38 |
Eclipse User |
|
|
|
Originally posted by: eclipse-news.lemmster.de
Martin Taal wrote:
> Hi Markus,
> Do you right click on the discovery.ecore or on the sub-class ecore?
Sub-class ecore.
> Regarding the inheritance topic. You also need to register the base
> class/package in Teneo. You can prevent that it is persisted by
> annotating it as Transient (although I have never tried that for
> base-classes). Another interesting annotation might be to use
> @MappedSuperClass (see the jpa specs for what it means).
OK, I will report what I've found later.
Thanks
Markus
|
|
|
Powered by
FUDForum. Page generated in 0.03836 seconds