Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » Teneo - NamedQuery annotation support
Teneo - NamedQuery annotation support [message #115394] Sun, 23 March 2008 06:37 Go to next message
Phaneesh is currently offline PhaneeshFriend
Messages: 16
Registered: July 2009
Junior Member
Hi,

I am trying to extend the hibernate annotation support for NamedQuery. I
have added a new NamedQuery element to hbannotation.ecore. Then I am trying
to extend the HibernateMappingGenerator with a new NamedQueryMapper. But I
am not able to understand how I can process the NamedQuery annotation from
the new Mapper I am trying to create. Please help me understand this so that
I can implement NamedQuery support hibernate.
Thanks
Phaneesh
Re: Teneo - NamedQuery annotation support [message #115420 is a reply to message #115394] Sun, 23 March 2008 09:28 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Phaneesh,
After adding the namedquery annotation to the hbannotation.ecore: Then you should add the NamedQuery
element (Upper Bound==-1) as an ereference to the HbAnnotatedEPackage and the HbAnnotatedEClass.
Then reload the hbannotation.genmodel and regenerate the source code.

The next step is to create the correct hibernate mapping.

The global namedqueries can be processed as follows: see the processPersistentClasses method in the
HibernateMappingGenerator. As the namedquery should be placed at the end of the mapping file I would
add a for loop (at the end of the try block) which walks through the paModel.getPaEPackages and
for each package gets the namedqueries and create the correct elements and add to the mapping
document (see other mappers for examples).

The namedqueries on class level can be processed as follows: see the method processEntity in the
EntityMapper class. As the namedquery should be added to the end I would add the handling of the
namedquery to the end of this method. The namedqueries can be handled in the same way as on package
level (so it makes probably sense to have a separate global method somewhere handling these).

If you don't want to change the standard then the above changes in the HibernateMappingGenerator and
EntityMapper can be made in custom subclasses. Teneo can be directed to use your subclasses using
the Teneo ExtensionManager approach (http://www.elver.org/hibernate/extensions.html).

To be complete, the NamedQuery element in hbannotation.ecore should have a Target eannotation
pointing to EClass and one pointing to EPackage (see the other annotations for an example). Then the
xsd generator (see HbMappingSchemaGenerator) knows where to create an xsd element. Note that the
HbMappingSchemaGenerator currently is set to create an xsd in a path which is specific for my
computer so you would need to change that before running the xsd generator.

Afaics the above description is complete, let me know if I missed something. And ofcourse feel free
to contribute any changes to Teneo when it works for you (just send me a patch)...

gr. Martin

Phaneesh wrote:
> Hi,
>
> I am trying to extend the hibernate annotation support for NamedQuery. I
> have added a new NamedQuery element to hbannotation.ecore. Then I am
> trying to extend the HibernateMappingGenerator with a new
> NamedQueryMapper. But I am not able to understand how I can process the
> NamedQuery annotation from the new Mapper I am trying to create. Please
> help me understand this so that I can implement NamedQuery support
> hibernate.
> Thanks
> Phaneesh


--

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 - NamedQuery annotation support [message #115463 is a reply to message #115420] Sun, 23 March 2008 15:14 Go to previous messageGo to next message
Phaneesh is currently offline PhaneeshFriend
Messages: 16
Registered: July 2009
Junior Member
Hi Martin,

Thanks for a very descriptive explanation. As soon as I get it working I
will send you the patch. If I have any queries regarding this will ping you
back.

Regards
Phaneesh

"Martin Taal" <mtaal@elver.org> wrote in message
news:fs57t1$79l$1@build.eclipse.org...
> Hi Phaneesh,
> After adding the namedquery annotation to the hbannotation.ecore: Then you
> should add the NamedQuery element (Upper Bound==-1) as an ereference to
> the HbAnnotatedEPackage and the HbAnnotatedEClass. Then reload the
> hbannotation.genmodel and regenerate the source code.
>
> The next step is to create the correct hibernate mapping.
>
> The global namedqueries can be processed as follows: see the
> processPersistentClasses method in the
> HibernateMappingGenerator. As the namedquery should be placed at the end
> of the mapping file I would add a for loop (at the end of the try block)
> which walks through the paModel.getPaEPackages and for each package gets
> the namedqueries and create the correct elements and add to the mapping
> document (see other mappers for examples).
>
> The namedqueries on class level can be processed as follows: see the
> method processEntity in the EntityMapper class. As the namedquery should
> be added to the end I would add the handling of the namedquery to the end
> of this method. The namedqueries can be handled in the same way as on
> package level (so it makes probably sense to have a separate global method
> somewhere handling these).
>
> If you don't want to change the standard then the above changes in the
> HibernateMappingGenerator and EntityMapper can be made in custom
> subclasses. Teneo can be directed to use your subclasses using the Teneo
> ExtensionManager approach
> (http://www.elver.org/hibernate/extensions.html).
>
> To be complete, the NamedQuery element in hbannotation.ecore should have a
> Target eannotation pointing to EClass and one pointing to EPackage (see
> the other annotations for an example). Then the xsd generator (see
> HbMappingSchemaGenerator) knows where to create an xsd element. Note that
> the HbMappingSchemaGenerator currently is set to create an xsd in a path
> which is specific for my computer so you would need to change that before
> running the xsd generator.
>
> Afaics the above description is complete, let me know if I missed
> something. And ofcourse feel free to contribute any changes to Teneo when
> it works for you (just send me a patch)...
>
> gr. Martin
>
> Phaneesh wrote:
>> Hi,
>>
>> I am trying to extend the hibernate annotation support for NamedQuery. I
>> have added a new NamedQuery element to hbannotation.ecore. Then I am
>> trying to extend the HibernateMappingGenerator with a new
>> NamedQueryMapper. But I am not able to understand how I can process the
>> NamedQuery annotation from the new Mapper I am trying to create. Please
>> help me understand this so that I can implement NamedQuery support
>> hibernate.
>> Thanks
>> Phaneesh
>
>
> --
>
> 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 - NamedQuery annotation support [message #115552 is a reply to message #115463] Mon, 24 March 2008 07:34 Go to previous messageGo to next message
Phaneesh is currently offline PhaneeshFriend
Messages: 16
Registered: July 2009
Junior Member
Hi Martin,

Please find the attached patch. I have added NamedQuery annotation support
for Hibernate mapper. I have followed the first approach.
Please let me know if you face problems integrating the patch.

Regards
Phaneesh

"Phaneesh" <n_phaneesh17010@yahoo.com> wrote in message
news:fs5s4p$ka$1@build.eclipse.org...
> Hi Martin,
>
> Thanks for a very descriptive explanation. As soon as I get it working I
> will send you the patch. If I have any queries regarding this will ping
> you
> back.
>
> Regards
> Phaneesh
>
> "Martin Taal" <mtaal@elver.org> wrote in message
> news:fs57t1$79l$1@build.eclipse.org...
>> Hi Phaneesh,
>> After adding the namedquery annotation to the hbannotation.ecore: Then
>> you
>> should add the NamedQuery element (Upper Bound==-1) as an ereference to
>> the HbAnnotatedEPackage and the HbAnnotatedEClass. Then reload the
>> hbannotation.genmodel and regenerate the source code.
>>
>> The next step is to create the correct hibernate mapping.
>>
>> The global namedqueries can be processed as follows: see the
>> processPersistentClasses method in the
>> HibernateMappingGenerator. As the namedquery should be placed at the end
>> of the mapping file I would add a for loop (at the end of the try block)
>> which walks through the paModel.getPaEPackages and for each package gets
>> the namedqueries and create the correct elements and add to the mapping
>> document (see other mappers for examples).
>>
>> The namedqueries on class level can be processed as follows: see the
>> method processEntity in the EntityMapper class. As the namedquery should
>> be added to the end I would add the handling of the namedquery to the end
>> of this method. The namedqueries can be handled in the same way as on
>> package level (so it makes probably sense to have a separate global
>> method
>> somewhere handling these).
>>
>> If you don't want to change the standard then the above changes in the
>> HibernateMappingGenerator and EntityMapper can be made in custom
>> subclasses. Teneo can be directed to use your subclasses using the Teneo
>> ExtensionManager approach
>> (http://www.elver.org/hibernate/extensions.html).
>>
>> To be complete, the NamedQuery element in hbannotation.ecore should have
>> a
>> Target eannotation pointing to EClass and one pointing to EPackage (see
>> the other annotations for an example). Then the xsd generator (see
>> HbMappingSchemaGenerator) knows where to create an xsd element. Note that
>> the HbMappingSchemaGenerator currently is set to create an xsd in a path
>> which is specific for my computer so you would need to change that before
>> running the xsd generator.
>>
>> Afaics the above description is complete, let me know if I missed
>> something. And ofcourse feel free to contribute any changes to Teneo when
>> it works for you (just send me a patch)...
>>
>> gr. Martin
>>
>> Phaneesh wrote:
>>> Hi,
>>>
>>> I am trying to extend the hibernate annotation support for NamedQuery. I
>>> have added a new NamedQuery element to hbannotation.ecore. Then I am
>>> trying to extend the HibernateMappingGenerator with a new
>>> NamedQueryMapper. But I am not able to understand how I can process the
>>> NamedQuery annotation from the new Mapper I am trying to create. Please
>>> help me understand this so that I can implement NamedQuery support
>>> hibernate.
>>> Thanks
>>> Phaneesh
>>
>>
>> --
>>
>> 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 - NamedQuery annotation support [message #115578 is a reply to message #115552] Mon, 24 March 2008 21:10 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Phaneesh,
Thanks, I will take a look at/apply it within a few days.

gr. Martin

Phaneesh wrote:
> Hi Martin,
>
> Please find the attached patch. I have added NamedQuery annotation support
> for Hibernate mapper. I have followed the first approach.
> Please let me know if you face problems integrating the patch.
>
> Regards
> Phaneesh
>
> "Phaneesh" <n_phaneesh17010@yahoo.com> wrote in message
> news:fs5s4p$ka$1@build.eclipse.org...
>> Hi Martin,
>>
>> Thanks for a very descriptive explanation. As soon as I get it working I
>> will send you the patch. If I have any queries regarding this will ping
>> you
>> back.
>>
>> Regards
>> Phaneesh
>>
>> "Martin Taal" <mtaal@elver.org> wrote in message
>> news:fs57t1$79l$1@build.eclipse.org...
>>> Hi Phaneesh,
>>> After adding the namedquery annotation to the hbannotation.ecore: Then
>>> you
>>> should add the NamedQuery element (Upper Bound==-1) as an ereference to
>>> the HbAnnotatedEPackage and the HbAnnotatedEClass. Then reload the
>>> hbannotation.genmodel and regenerate the source code.
>>>
>>> The next step is to create the correct hibernate mapping.
>>>
>>> The global namedqueries can be processed as follows: see the
>>> processPersistentClasses method in the
>>> HibernateMappingGenerator. As the namedquery should be placed at the end
>>> of the mapping file I would add a for loop (at the end of the try block)
>>> which walks through the paModel.getPaEPackages and for each package gets
>>> the namedqueries and create the correct elements and add to the mapping
>>> document (see other mappers for examples).
>>>
>>> The namedqueries on class level can be processed as follows: see the
>>> method processEntity in the EntityMapper class. As the namedquery should
>>> be added to the end I would add the handling of the namedquery to the end
>>> of this method. The namedqueries can be handled in the same way as on
>>> package level (so it makes probably sense to have a separate global
>>> method
>>> somewhere handling these).
>>>
>>> If you don't want to change the standard then the above changes in the
>>> HibernateMappingGenerator and EntityMapper can be made in custom
>>> subclasses. Teneo can be directed to use your subclasses using the Teneo
>>> ExtensionManager approach
>>> (http://www.elver.org/hibernate/extensions.html).
>>>
>>> To be complete, the NamedQuery element in hbannotation.ecore should have
>>> a
>>> Target eannotation pointing to EClass and one pointing to EPackage (see
>>> the other annotations for an example). Then the xsd generator (see
>>> HbMappingSchemaGenerator) knows where to create an xsd element. Note that
>>> the HbMappingSchemaGenerator currently is set to create an xsd in a path
>>> which is specific for my computer so you would need to change that before
>>> running the xsd generator.
>>>
>>> Afaics the above description is complete, let me know if I missed
>>> something. And ofcourse feel free to contribute any changes to Teneo when
>>> it works for you (just send me a patch)...
>>>
>>> gr. Martin
>>>
>>> Phaneesh wrote:
>>>> Hi,
>>>>
>>>> I am trying to extend the hibernate annotation support for NamedQuery. I
>>>> have added a new NamedQuery element to hbannotation.ecore. Then I am
>>>> trying to extend the HibernateMappingGenerator with a new
>>>> NamedQueryMapper. But I am not able to understand how I can process the
>>>> NamedQuery annotation from the new Mapper I am trying to create. Please
>>>> help me understand this so that I can implement NamedQuery support
>>>> hibernate.
>>>> Thanks
>>>> Phaneesh
>>>
>>> --
>>>
>>> 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
>
>


--

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 - NamedQuery annotation support [message #116065 is a reply to message #115552] Thu, 27 March 2008 09:05 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Phaneesh,
One administrative question, can you open a bugzilla and attach your patch to it? Afaik because of
licensing reasons contributions should be send in as part of a bugzilla.

Thanks!

gr. Martin

Phaneesh wrote:
> Hi Martin,
>
> Please find the attached patch. I have added NamedQuery annotation support
> for Hibernate mapper. I have followed the first approach.
> Please let me know if you face problems integrating the patch.
>
> Regards
> Phaneesh
>
> "Phaneesh" <n_phaneesh17010@yahoo.com> wrote in message
> news:fs5s4p$ka$1@build.eclipse.org...
>> Hi Martin,
>>
>> Thanks for a very descriptive explanation. As soon as I get it working I
>> will send you the patch. If I have any queries regarding this will ping
>> you
>> back.
>>
>> Regards
>> Phaneesh
>>
>> "Martin Taal" <mtaal@elver.org> wrote in message
>> news:fs57t1$79l$1@build.eclipse.org...
>>> Hi Phaneesh,
>>> After adding the namedquery annotation to the hbannotation.ecore: Then
>>> you
>>> should add the NamedQuery element (Upper Bound==-1) as an ereference to
>>> the HbAnnotatedEPackage and the HbAnnotatedEClass. Then reload the
>>> hbannotation.genmodel and regenerate the source code.
>>>
>>> The next step is to create the correct hibernate mapping.
>>>
>>> The global namedqueries can be processed as follows: see the
>>> processPersistentClasses method in the
>>> HibernateMappingGenerator. As the namedquery should be placed at the end
>>> of the mapping file I would add a for loop (at the end of the try block)
>>> which walks through the paModel.getPaEPackages and for each package gets
>>> the namedqueries and create the correct elements and add to the mapping
>>> document (see other mappers for examples).
>>>
>>> The namedqueries on class level can be processed as follows: see the
>>> method processEntity in the EntityMapper class. As the namedquery should
>>> be added to the end I would add the handling of the namedquery to the end
>>> of this method. The namedqueries can be handled in the same way as on
>>> package level (so it makes probably sense to have a separate global
>>> method
>>> somewhere handling these).
>>>
>>> If you don't want to change the standard then the above changes in the
>>> HibernateMappingGenerator and EntityMapper can be made in custom
>>> subclasses. Teneo can be directed to use your subclasses using the Teneo
>>> ExtensionManager approach
>>> (http://www.elver.org/hibernate/extensions.html).
>>>
>>> To be complete, the NamedQuery element in hbannotation.ecore should have
>>> a
>>> Target eannotation pointing to EClass and one pointing to EPackage (see
>>> the other annotations for an example). Then the xsd generator (see
>>> HbMappingSchemaGenerator) knows where to create an xsd element. Note that
>>> the HbMappingSchemaGenerator currently is set to create an xsd in a path
>>> which is specific for my computer so you would need to change that before
>>> running the xsd generator.
>>>
>>> Afaics the above description is complete, let me know if I missed
>>> something. And ofcourse feel free to contribute any changes to Teneo when
>>> it works for you (just send me a patch)...
>>>
>>> gr. Martin
>>>
>>> Phaneesh wrote:
>>>> Hi,
>>>>
>>>> I am trying to extend the hibernate annotation support for NamedQuery. I
>>>> have added a new NamedQuery element to hbannotation.ecore. Then I am
>>>> trying to extend the HibernateMappingGenerator with a new
>>>> NamedQueryMapper. But I am not able to understand how I can process the
>>>> NamedQuery annotation from the new Mapper I am trying to create. Please
>>>> help me understand this so that I can implement NamedQuery support
>>>> hibernate.
>>>> Thanks
>>>> Phaneesh
>>>
>>> --
>>>
>>> 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
>
>


--

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 - NamedQuery annotation support [message #615955 is a reply to message #115394] Sun, 23 March 2008 09:28 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Phaneesh,
After adding the namedquery annotation to the hbannotation.ecore: Then you should add the NamedQuery
element (Upper Bound==-1) as an ereference to the HbAnnotatedEPackage and the HbAnnotatedEClass.
Then reload the hbannotation.genmodel and regenerate the source code.

The next step is to create the correct hibernate mapping.

The global namedqueries can be processed as follows: see the processPersistentClasses method in the
HibernateMappingGenerator. As the namedquery should be placed at the end of the mapping file I would
add a for loop (at the end of the try block) which walks through the paModel.getPaEPackages and
for each package gets the namedqueries and create the correct elements and add to the mapping
document (see other mappers for examples).

The namedqueries on class level can be processed as follows: see the method processEntity in the
EntityMapper class. As the namedquery should be added to the end I would add the handling of the
namedquery to the end of this method. The namedqueries can be handled in the same way as on package
level (so it makes probably sense to have a separate global method somewhere handling these).

If you don't want to change the standard then the above changes in the HibernateMappingGenerator and
EntityMapper can be made in custom subclasses. Teneo can be directed to use your subclasses using
the Teneo ExtensionManager approach (http://www.elver.org/hibernate/extensions.html).

To be complete, the NamedQuery element in hbannotation.ecore should have a Target eannotation
pointing to EClass and one pointing to EPackage (see the other annotations for an example). Then the
xsd generator (see HbMappingSchemaGenerator) knows where to create an xsd element. Note that the
HbMappingSchemaGenerator currently is set to create an xsd in a path which is specific for my
computer so you would need to change that before running the xsd generator.

Afaics the above description is complete, let me know if I missed something. And ofcourse feel free
to contribute any changes to Teneo when it works for you (just send me a patch)...

gr. Martin

Phaneesh wrote:
> Hi,
>
> I am trying to extend the hibernate annotation support for NamedQuery. I
> have added a new NamedQuery element to hbannotation.ecore. Then I am
> trying to extend the HibernateMappingGenerator with a new
> NamedQueryMapper. But I am not able to understand how I can process the
> NamedQuery annotation from the new Mapper I am trying to create. Please
> help me understand this so that I can implement NamedQuery support
> hibernate.
> Thanks
> Phaneesh


--

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 - NamedQuery annotation support [message #615958 is a reply to message #115420] Sun, 23 March 2008 15:14 Go to previous message
Phaneesh is currently offline PhaneeshFriend
Messages: 16
Registered: July 2009
Junior Member
Hi Martin,

Thanks for a very descriptive explanation. As soon as I get it working I
will send you the patch. If I have any queries regarding this will ping you
back.

Regards
Phaneesh

"Martin Taal" <mtaal@elver.org> wrote in message
news:fs57t1$79l$1@build.eclipse.org...
> Hi Phaneesh,
> After adding the namedquery annotation to the hbannotation.ecore: Then you
> should add the NamedQuery element (Upper Bound==-1) as an ereference to
> the HbAnnotatedEPackage and the HbAnnotatedEClass. Then reload the
> hbannotation.genmodel and regenerate the source code.
>
> The next step is to create the correct hibernate mapping.
>
> The global namedqueries can be processed as follows: see the
> processPersistentClasses method in the
> HibernateMappingGenerator. As the namedquery should be placed at the end
> of the mapping file I would add a for loop (at the end of the try block)
> which walks through the paModel.getPaEPackages and for each package gets
> the namedqueries and create the correct elements and add to the mapping
> document (see other mappers for examples).
>
> The namedqueries on class level can be processed as follows: see the
> method processEntity in the EntityMapper class. As the namedquery should
> be added to the end I would add the handling of the namedquery to the end
> of this method. The namedqueries can be handled in the same way as on
> package level (so it makes probably sense to have a separate global method
> somewhere handling these).
>
> If you don't want to change the standard then the above changes in the
> HibernateMappingGenerator and EntityMapper can be made in custom
> subclasses. Teneo can be directed to use your subclasses using the Teneo
> ExtensionManager approach
> (http://www.elver.org/hibernate/extensions.html).
>
> To be complete, the NamedQuery element in hbannotation.ecore should have a
> Target eannotation pointing to EClass and one pointing to EPackage (see
> the other annotations for an example). Then the xsd generator (see
> HbMappingSchemaGenerator) knows where to create an xsd element. Note that
> the HbMappingSchemaGenerator currently is set to create an xsd in a path
> which is specific for my computer so you would need to change that before
> running the xsd generator.
>
> Afaics the above description is complete, let me know if I missed
> something. And ofcourse feel free to contribute any changes to Teneo when
> it works for you (just send me a patch)...
>
> gr. Martin
>
> Phaneesh wrote:
>> Hi,
>>
>> I am trying to extend the hibernate annotation support for NamedQuery. I
>> have added a new NamedQuery element to hbannotation.ecore. Then I am
>> trying to extend the HibernateMappingGenerator with a new
>> NamedQueryMapper. But I am not able to understand how I can process the
>> NamedQuery annotation from the new Mapper I am trying to create. Please
>> help me understand this so that I can implement NamedQuery support
>> hibernate.
>> Thanks
>> Phaneesh
>
>
> --
>
> 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 - NamedQuery annotation support [message #615965 is a reply to message #115463] Mon, 24 March 2008 07:34 Go to previous message
Phaneesh is currently offline PhaneeshFriend
Messages: 16
Registered: July 2009
Junior Member
Hi Martin,

Please find the attached patch. I have added NamedQuery annotation support
for Hibernate mapper. I have followed the first approach.
Please let me know if you face problems integrating the patch.

Regards
Phaneesh

"Phaneesh" <n_phaneesh17010@yahoo.com> wrote in message
news:fs5s4p$ka$1@build.eclipse.org...
> Hi Martin,
>
> Thanks for a very descriptive explanation. As soon as I get it working I
> will send you the patch. If I have any queries regarding this will ping
> you
> back.
>
> Regards
> Phaneesh
>
> "Martin Taal" <mtaal@elver.org> wrote in message
> news:fs57t1$79l$1@build.eclipse.org...
>> Hi Phaneesh,
>> After adding the namedquery annotation to the hbannotation.ecore: Then
>> you
>> should add the NamedQuery element (Upper Bound==-1) as an ereference to
>> the HbAnnotatedEPackage and the HbAnnotatedEClass. Then reload the
>> hbannotation.genmodel and regenerate the source code.
>>
>> The next step is to create the correct hibernate mapping.
>>
>> The global namedqueries can be processed as follows: see the
>> processPersistentClasses method in the
>> HibernateMappingGenerator. As the namedquery should be placed at the end
>> of the mapping file I would add a for loop (at the end of the try block)
>> which walks through the paModel.getPaEPackages and for each package gets
>> the namedqueries and create the correct elements and add to the mapping
>> document (see other mappers for examples).
>>
>> The namedqueries on class level can be processed as follows: see the
>> method processEntity in the EntityMapper class. As the namedquery should
>> be added to the end I would add the handling of the namedquery to the end
>> of this method. The namedqueries can be handled in the same way as on
>> package level (so it makes probably sense to have a separate global
>> method
>> somewhere handling these).
>>
>> If you don't want to change the standard then the above changes in the
>> HibernateMappingGenerator and EntityMapper can be made in custom
>> subclasses. Teneo can be directed to use your subclasses using the Teneo
>> ExtensionManager approach
>> (http://www.elver.org/hibernate/extensions.html).
>>
>> To be complete, the NamedQuery element in hbannotation.ecore should have
>> a
>> Target eannotation pointing to EClass and one pointing to EPackage (see
>> the other annotations for an example). Then the xsd generator (see
>> HbMappingSchemaGenerator) knows where to create an xsd element. Note that
>> the HbMappingSchemaGenerator currently is set to create an xsd in a path
>> which is specific for my computer so you would need to change that before
>> running the xsd generator.
>>
>> Afaics the above description is complete, let me know if I missed
>> something. And ofcourse feel free to contribute any changes to Teneo when
>> it works for you (just send me a patch)...
>>
>> gr. Martin
>>
>> Phaneesh wrote:
>>> Hi,
>>>
>>> I am trying to extend the hibernate annotation support for NamedQuery. I
>>> have added a new NamedQuery element to hbannotation.ecore. Then I am
>>> trying to extend the HibernateMappingGenerator with a new
>>> NamedQueryMapper. But I am not able to understand how I can process the
>>> NamedQuery annotation from the new Mapper I am trying to create. Please
>>> help me understand this so that I can implement NamedQuery support
>>> hibernate.
>>> Thanks
>>> Phaneesh
>>
>>
>> --
>>
>> 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 - NamedQuery annotation support [message #615967 is a reply to message #115552] Mon, 24 March 2008 21:10 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Phaneesh,
Thanks, I will take a look at/apply it within a few days.

gr. Martin

Phaneesh wrote:
> Hi Martin,
>
> Please find the attached patch. I have added NamedQuery annotation support
> for Hibernate mapper. I have followed the first approach.
> Please let me know if you face problems integrating the patch.
>
> Regards
> Phaneesh
>
> "Phaneesh" <n_phaneesh17010@yahoo.com> wrote in message
> news:fs5s4p$ka$1@build.eclipse.org...
>> Hi Martin,
>>
>> Thanks for a very descriptive explanation. As soon as I get it working I
>> will send you the patch. If I have any queries regarding this will ping
>> you
>> back.
>>
>> Regards
>> Phaneesh
>>
>> "Martin Taal" <mtaal@elver.org> wrote in message
>> news:fs57t1$79l$1@build.eclipse.org...
>>> Hi Phaneesh,
>>> After adding the namedquery annotation to the hbannotation.ecore: Then
>>> you
>>> should add the NamedQuery element (Upper Bound==-1) as an ereference to
>>> the HbAnnotatedEPackage and the HbAnnotatedEClass. Then reload the
>>> hbannotation.genmodel and regenerate the source code.
>>>
>>> The next step is to create the correct hibernate mapping.
>>>
>>> The global namedqueries can be processed as follows: see the
>>> processPersistentClasses method in the
>>> HibernateMappingGenerator. As the namedquery should be placed at the end
>>> of the mapping file I would add a for loop (at the end of the try block)
>>> which walks through the paModel.getPaEPackages and for each package gets
>>> the namedqueries and create the correct elements and add to the mapping
>>> document (see other mappers for examples).
>>>
>>> The namedqueries on class level can be processed as follows: see the
>>> method processEntity in the EntityMapper class. As the namedquery should
>>> be added to the end I would add the handling of the namedquery to the end
>>> of this method. The namedqueries can be handled in the same way as on
>>> package level (so it makes probably sense to have a separate global
>>> method
>>> somewhere handling these).
>>>
>>> If you don't want to change the standard then the above changes in the
>>> HibernateMappingGenerator and EntityMapper can be made in custom
>>> subclasses. Teneo can be directed to use your subclasses using the Teneo
>>> ExtensionManager approach
>>> (http://www.elver.org/hibernate/extensions.html).
>>>
>>> To be complete, the NamedQuery element in hbannotation.ecore should have
>>> a
>>> Target eannotation pointing to EClass and one pointing to EPackage (see
>>> the other annotations for an example). Then the xsd generator (see
>>> HbMappingSchemaGenerator) knows where to create an xsd element. Note that
>>> the HbMappingSchemaGenerator currently is set to create an xsd in a path
>>> which is specific for my computer so you would need to change that before
>>> running the xsd generator.
>>>
>>> Afaics the above description is complete, let me know if I missed
>>> something. And ofcourse feel free to contribute any changes to Teneo when
>>> it works for you (just send me a patch)...
>>>
>>> gr. Martin
>>>
>>> Phaneesh wrote:
>>>> Hi,
>>>>
>>>> I am trying to extend the hibernate annotation support for NamedQuery. I
>>>> have added a new NamedQuery element to hbannotation.ecore. Then I am
>>>> trying to extend the HibernateMappingGenerator with a new
>>>> NamedQueryMapper. But I am not able to understand how I can process the
>>>> NamedQuery annotation from the new Mapper I am trying to create. Please
>>>> help me understand this so that I can implement NamedQuery support
>>>> hibernate.
>>>> Thanks
>>>> Phaneesh
>>>
>>> --
>>>
>>> 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
>
>


--

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 - NamedQuery annotation support [message #616004 is a reply to message #115552] Thu, 27 March 2008 09:05 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Phaneesh,
One administrative question, can you open a bugzilla and attach your patch to it? Afaik because of
licensing reasons contributions should be send in as part of a bugzilla.

Thanks!

gr. Martin

Phaneesh wrote:
> Hi Martin,
>
> Please find the attached patch. I have added NamedQuery annotation support
> for Hibernate mapper. I have followed the first approach.
> Please let me know if you face problems integrating the patch.
>
> Regards
> Phaneesh
>
> "Phaneesh" <n_phaneesh17010@yahoo.com> wrote in message
> news:fs5s4p$ka$1@build.eclipse.org...
>> Hi Martin,
>>
>> Thanks for a very descriptive explanation. As soon as I get it working I
>> will send you the patch. If I have any queries regarding this will ping
>> you
>> back.
>>
>> Regards
>> Phaneesh
>>
>> "Martin Taal" <mtaal@elver.org> wrote in message
>> news:fs57t1$79l$1@build.eclipse.org...
>>> Hi Phaneesh,
>>> After adding the namedquery annotation to the hbannotation.ecore: Then
>>> you
>>> should add the NamedQuery element (Upper Bound==-1) as an ereference to
>>> the HbAnnotatedEPackage and the HbAnnotatedEClass. Then reload the
>>> hbannotation.genmodel and regenerate the source code.
>>>
>>> The next step is to create the correct hibernate mapping.
>>>
>>> The global namedqueries can be processed as follows: see the
>>> processPersistentClasses method in the
>>> HibernateMappingGenerator. As the namedquery should be placed at the end
>>> of the mapping file I would add a for loop (at the end of the try block)
>>> which walks through the paModel.getPaEPackages and for each package gets
>>> the namedqueries and create the correct elements and add to the mapping
>>> document (see other mappers for examples).
>>>
>>> The namedqueries on class level can be processed as follows: see the
>>> method processEntity in the EntityMapper class. As the namedquery should
>>> be added to the end I would add the handling of the namedquery to the end
>>> of this method. The namedqueries can be handled in the same way as on
>>> package level (so it makes probably sense to have a separate global
>>> method
>>> somewhere handling these).
>>>
>>> If you don't want to change the standard then the above changes in the
>>> HibernateMappingGenerator and EntityMapper can be made in custom
>>> subclasses. Teneo can be directed to use your subclasses using the Teneo
>>> ExtensionManager approach
>>> (http://www.elver.org/hibernate/extensions.html).
>>>
>>> To be complete, the NamedQuery element in hbannotation.ecore should have
>>> a
>>> Target eannotation pointing to EClass and one pointing to EPackage (see
>>> the other annotations for an example). Then the xsd generator (see
>>> HbMappingSchemaGenerator) knows where to create an xsd element. Note that
>>> the HbMappingSchemaGenerator currently is set to create an xsd in a path
>>> which is specific for my computer so you would need to change that before
>>> running the xsd generator.
>>>
>>> Afaics the above description is complete, let me know if I missed
>>> something. And ofcourse feel free to contribute any changes to Teneo when
>>> it works for you (just send me a patch)...
>>>
>>> gr. Martin
>>>
>>> Phaneesh wrote:
>>>> Hi,
>>>>
>>>> I am trying to extend the hibernate annotation support for NamedQuery. I
>>>> have added a new NamedQuery element to hbannotation.ecore. Then I am
>>>> trying to extend the HibernateMappingGenerator with a new
>>>> NamedQueryMapper. But I am not able to understand how I can process the
>>>> NamedQuery annotation from the new Mapper I am trying to create. Please
>>>> help me understand this so that I can implement NamedQuery support
>>>> hibernate.
>>>> Thanks
>>>> Phaneesh
>>>
>>> --
>>>
>>> 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
>
>


--

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:Extra Primary Key Join Column
Next Topic:[Teneo] NoSuchMethodError exception when trying to add element to an EList
Goto Forum:
  


Current Time: Wed Jun 23 07:55:28 GMT 2021

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

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

Back to the top