Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [Teneo] MappingBuilder customization
[Teneo] MappingBuilder customization [message #81906] Fri, 04 May 2007 09:43 Go to next message
Matthieu Helleboid is currently offline Matthieu HelleboidFriend
Messages: 18
Registered: July 2009
Junior Member
Hello,

Is there a way to provide a custom MappingBuilder ? The aim is to be able
to overload getDefaultAnnotator(), and to change HibernateDefaultAnnotator
behavior.

A quick and dirty way to do this would be to remove the "final" in
MappingBuilder for the "static final MappingBuilder INSTANCE" statement.

Thanks,

Matthieu
Re: [Teneo] MappingBuilder customization [message #81920 is a reply to message #81906] Fri, 04 May 2007 09:59 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Matthieu,
Currently the only way is to override the mapEPackages method in the datastore. It is pretty simple:

/** Generate a hibernate mapping xml string from a set of epackages */
protected String mapEPackages() {
log.debug("Generating mapping file from in-mem ecore");
// DCB: Use Hibernate-specific annotation processing mechanism. This
// allows use of
// Hibernate-specific annotations.
final PersistenceOptions po = getPersistenceOptions();
paModel = MappingBuilder.INSTANCE.buildMapping(getEPackages(), po);
HibernateMappingGenerator hmg = new HibernateMappingGenerator(po);
return hmg.generateToString(paModel);
}

Probably it is nicer to also override getPamodel (there is no setPamodel yet).

Overall the extendability can be improved here. As you say providing a getter/setter around the
MappingBuilder.INSTANCE is an approach.
I will think about this and improve this for the next release. If you have other/more
ease-of-extendability ideas then let me know.

gr. Martin

Matthieu Helleboid wrote:
> Hello,
>
> Is there a way to provide a custom MappingBuilder ? The aim is to be able
> to overload getDefaultAnnotator(), and to change HibernateDefaultAnnotator
> behavior.
>
> A quick and dirty way to do this would be to remove the "final" in
> MappingBuilder for the "static final MappingBuilder INSTANCE" statement.
>
> Thanks,
>
> Matthieu


--

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] MappingBuilder customization [message #82719 is a reply to message #81920] Thu, 10 May 2007 09:01 Go to previous message
Matthieu Helleboid is currently offline Matthieu HelleboidFriend
Messages: 18
Registered: July 2009
Junior Member
Hello Martin,

Your method suits all my needs ! Thanks a lot.

Matthieu

Le Fri, 04 May 2007 11:59:48 +0200, Martin Taal a écrit:

> Hi Matthieu,
> Currently the only way is to override the mapEPackages method in the datastore. It is pretty simple:
>
> /** Generate a hibernate mapping xml string from a set of epackages */
> protected String mapEPackages() {
> log.debug("Generating mapping file from in-mem ecore");
> // DCB: Use Hibernate-specific annotation processing mechanism. This
> // allows use of
> // Hibernate-specific annotations.
> final PersistenceOptions po = getPersistenceOptions();
> paModel = MappingBuilder.INSTANCE.buildMapping(getEPackages(), po);
> HibernateMappingGenerator hmg = new HibernateMappingGenerator(po);
> return hmg.generateToString(paModel);
> }
>
> Probably it is nicer to also override getPamodel (there is no setPamodel yet).
>
> Overall the extendability can be improved here. As you say providing a getter/setter around the
> MappingBuilder.INSTANCE is an approach.
> I will think about this and improve this for the next release. If you have other/more
> ease-of-extendability ideas then let me know.
>
> gr. Martin
>
> Matthieu Helleboid wrote:
>> Hello,
>>
>> Is there a way to provide a custom MappingBuilder ? The aim is to be able
>> to overload getDefaultAnnotator(), and to change HibernateDefaultAnnotator
>> behavior.
>>
>> A quick and dirty way to do this would be to remove the "final" in
>> MappingBuilder for the "static final MappingBuilder INSTANCE" statement.
>>
>> Thanks,
>>
>> Matthieu
>
>
Re: [Teneo] MappingBuilder customization [message #605238 is a reply to message #81906] Fri, 04 May 2007 09:59 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Matthieu,
Currently the only way is to override the mapEPackages method in the datastore. It is pretty simple:

/** Generate a hibernate mapping xml string from a set of epackages */
protected String mapEPackages() {
log.debug("Generating mapping file from in-mem ecore");
// DCB: Use Hibernate-specific annotation processing mechanism. This
// allows use of
// Hibernate-specific annotations.
final PersistenceOptions po = getPersistenceOptions();
paModel = MappingBuilder.INSTANCE.buildMapping(getEPackages(), po);
HibernateMappingGenerator hmg = new HibernateMappingGenerator(po);
return hmg.generateToString(paModel);
}

Probably it is nicer to also override getPamodel (there is no setPamodel yet).

Overall the extendability can be improved here. As you say providing a getter/setter around the
MappingBuilder.INSTANCE is an approach.
I will think about this and improve this for the next release. If you have other/more
ease-of-extendability ideas then let me know.

gr. Martin

Matthieu Helleboid wrote:
> Hello,
>
> Is there a way to provide a custom MappingBuilder ? The aim is to be able
> to overload getDefaultAnnotator(), and to change HibernateDefaultAnnotator
> behavior.
>
> A quick and dirty way to do this would be to remove the "final" in
> MappingBuilder for the "static final MappingBuilder INSTANCE" statement.
>
> Thanks,
>
> Matthieu


--

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] MappingBuilder customization [message #606643 is a reply to message #81920] Thu, 10 May 2007 09:01 Go to previous message
Matthieu Helleboid is currently offline Matthieu HelleboidFriend
Messages: 18
Registered: July 2009
Junior Member
Hello Martin,

Your method suits all my needs ! Thanks a lot.

Matthieu

Le Fri, 04 May 2007 11:59:48 +0200, Martin Taal a écrit:

> Hi Matthieu,
> Currently the only way is to override the mapEPackages method in the datastore. It is pretty simple:
>
> /** Generate a hibernate mapping xml string from a set of epackages */
> protected String mapEPackages() {
> log.debug("Generating mapping file from in-mem ecore");
> // DCB: Use Hibernate-specific annotation processing mechanism. This
> // allows use of
> // Hibernate-specific annotations.
> final PersistenceOptions po = getPersistenceOptions();
> paModel = MappingBuilder.INSTANCE.buildMapping(getEPackages(), po);
> HibernateMappingGenerator hmg = new HibernateMappingGenerator(po);
> return hmg.generateToString(paModel);
> }
>
> Probably it is nicer to also override getPamodel (there is no setPamodel yet).
>
> Overall the extendability can be improved here. As you say providing a getter/setter around the
> MappingBuilder.INSTANCE is an approach.
> I will think about this and improve this for the next release. If you have other/more
> ease-of-extendability ideas then let me know.
>
> gr. Martin
>
> Matthieu Helleboid wrote:
>> Hello,
>>
>> Is there a way to provide a custom MappingBuilder ? The aim is to be able
>> to overload getDefaultAnnotator(), and to change HibernateDefaultAnnotator
>> behavior.
>>
>> A quick and dirty way to do this would be to remove the "final" in
>> MappingBuilder for the "static final MappingBuilder INSTANCE" statement.
>>
>> Thanks,
>>
>> Matthieu
>
>
Previous Topic:HbDataStore.close() throwing SQLException
Next Topic:[Teneo]lazy collection pagination
Goto Forum:
  


Current Time: Fri Apr 26 17:48:12 GMT 2024

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

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

Back to the top