Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » How to add parameters to texo annotations(How to add parameters to texo annotations)
How to add parameters to texo annotations [message #1751386] Mon, 09 January 2017 16:11 Go to next message
Sandeep Joseph is currently offline Sandeep JosephFriend
Messages: 5
Registered: January 2017
Junior Member
Hi All,
I'm using Texo to generate JPA entities from eCore models. I need to add some extra annotations to the generated classes, so I use EAnnotation. But I don't figure out a way to generate the parameters for the annotations. Example below:

To add the annotation table, I use the value of the EAnnotation as follows:
@javax.persistence.Table

How can specify this in order to generate the code as follows:

@Table(name="Student")
public class Student{
}

The parameter should be the class name.

Thanks,
Sandeep Joseph
Re: How to add parameters to texo annotations [message #1751495 is a reply to message #1751386] Tue, 10 January 2017 19:14 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Sandeep,
I guess you have seen this page:
https://wiki.eclipse.org/Texo/Direct_Java_Annotations

So setting something like this in the eannotation should work:
@javax.persistence.Table(name="Student")

For this specific annotation Texo will generate it for you, so you don't need to add it manually. You should only need to add a specific annotation if you want to override the Texo generated annotation.

Let me know if this helps (or not ofcourse).

gr. Martin
Re: How to add parameters to texo annotations [message #1751542 is a reply to message #1751495] Wed, 11 January 2017 10:28 Go to previous messageGo to next message
Sandeep Joseph is currently offline Sandeep JosephFriend
Messages: 5
Registered: January 2017
Junior Member
Hello Martin,

Thanks for your response. I already tried successfully what you have suggested. My use case is a bit different. The value to the parameter 'name' should be dynamic. I want to get it from the ECore model, for example the class name («this.simpleClassName-»).

@javax.persistence.Table(name=<CLASS_NAME_FROM_MODEL>)

Is this possible?

Thanks,
Sandeep
Re: How to add parameters to texo annotations [message #1751558 is a reply to message #1751542] Wed, 11 January 2017 13:34 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hey Sandeep,
It should work out of the box like that, Texo as a default creates unique entity names, but you can override this with an option on your dev project:
https://wiki.eclipse.org/Texo/ORM_JPA_Options

Can you try without a table annotation, what do you get then?

gr. Martin
Previous Topic:[EMF Forms] Custom Databinding converters
Next Topic:[EMFForms] Tweak spacing of renderers
Goto Forum:
  


Current Time: Tue Apr 23 06:33:08 GMT 2024

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

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

Back to the top