Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [TEXO] JPA Foreign Key
[TEXO] JPA Foreign Key [message #869784] Fri, 04 May 2012 09:59 Go to next message
Gary Godfrey is currently offline Gary GodfreyFriend
Messages: 31
Registered: February 2012
Member
Hi,

Using TEXO to generate JPA annotated code.
In the database the foreign key linking Applicant to Application is called 'applicant_id', using default JPA behaviour to name the index.
Is there a way to populate the @JoinColumns annotation when the Java code is generated from the ecore model?

e.g.

public class Application extends JPAIdentifier
{
	/**
	 * <!-- begin-user-doc --> <!-- end-user-doc -->
	 * 
	 * @generated
	 */
	@IndexedEmbedded
	@OneToMany(cascade =
	{ CascadeType.ALL }, targetEntity = Applicant.class)
	@OrderColumn()
	@JoinColumns(
	{ @JoinColumn() })
	private List<Applicant> applicant = new ArrayList<Applicant>();




Thanks,
Gary
Re: [TEXO] JPA Foreign Key [message #869790 is a reply to message #869784] Fri, 04 May 2012 10:05 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Gary,
Using an annotations model you can annotate the model which will be control the code generation:
http://wiki.eclipse.org/Texo/ORM_JPA_Annotations_Details

gr. Martin

On 05/04/2012 11:59 AM, Gary Godfrey wrote:
> Hi,
>
> Using TEXO to generate JPA annotated code. In the database the foreign key linking Applicant to Application is called
> 'applicant_id', using default JPA behaviour to name the index.
> Is there a way to populate the @JoinColumns annotation when the Java code is generated from the ecore model?
>
> e.g.
>
>
> public class Application extends JPAIdentifier
> {
> /**
> * <!-- begin-user-doc --> <!-- end-user-doc -->
> * * @generated
> */
> @IndexedEmbedded
> @OneToMany(cascade =
> { CascadeType.ALL }, targetEntity = Applicant.class)
> @OrderColumn()
> @JoinColumns(
> { @JoinColumn() })
> private List<Applicant> applicant = new ArrayList<Applicant>();
>
>
>
>
> Thanks,
> Gary


--

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@xxxxxxxx - mtaal@xxxxxxxx
Web: www.springsite.com - www.elver.org
Previous Topic:Invitation for discussion
Next Topic:[EMF Facet] non respect of the API freeze
Goto Forum:
  


Current Time: Fri Apr 26 04:35:07 GMT 2024

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

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

Back to the top