Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [TEXO] Failed to create the FK(Texo doesn't create the FK in the database)
[TEXO] Failed to create the FK [message #1142354] Thu, 17 October 2013 15:15 Go to next message
Simone Dionisi is currently offline Simone DionisiFriend
Messages: 2
Registered: October 2013
Junior Member
Hi,

I was trying to re-use the example in Texo (org.eclipse.emf.texo.web.example) substituting the library model with my model and I saw that when I try to generate the test data the application creates the database without creating the foreign keys.

Here is my code:

@Table(name = "SYS_ELMT")
public class SystemElement extends SpaceSystemObject {
@Id()
@Column(name = "sys_elmt_id")
private String id = null

@Basic()
@Column(name = "parent_sys_elmt_id")
@ManyToOne()
@JoinColumns({ @JoinColumn(name = "parent_sys_elmt_id", referencedColumnName = "sys_elmt_id", table = "SYS_ELMT", updatable = true) })
private String parentSystemElement = null;

.....

}

Could anyone please help me?

Thanks in advance

Re: [TEXO] Failed to create the FK [message #1142441 is a reply to message #1142354] Thu, 17 October 2013 16:23 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Simone,
Normally the ORM takes care of creating the database schema on the basis of the annotations. The annotations look fine
to me.

Which ORM are you using?

gr. Martin

On 10/17/2013 05:53 PM, Simone Dionisi wrote:
> Hi,
>
> I was trying to re-use the example in Texo (org.eclipse.emf.texo.web.example) substituting the library model with my
> model and I saw that when I try to generate the test data the application creates the database without creating the
> foreign keys.
>
> Here is my code:
> @Table(name = "SYS_ELMT")
> public class SystemElement extends SpaceSystemObject {
> @Id()
> @Column(name = "sys_elmt_id")
> private String id = null
>
> @Basic()
> @Column(name = "parent_sys_elmt_id")
> @ManyToOne()
> @JoinColumns({ @JoinColumn(name = "parent_sys_elmt_id", referencedColumnName = "sys_elmt_id", table = "SYS_ELMT",
> updatable = true) })
> private String parentSystemElement = null;
>
> .....
>
> }
>
> Could anyone please help me?
>
> Thanks in advance
>
>


--

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
Re: [TEXO] Failed to create the FK [message #1142453 is a reply to message #1142441] Thu, 17 October 2013 16:33 Go to previous messageGo to next message
Simone Dionisi is currently offline Simone DionisiFriend
Messages: 2
Registered: October 2013
Junior Member
Hi Martin,

thanks for your reply.
I am using JPA with Postgres as RDBMS.

Best regards
Re: [TEXO] Failed to create the FK [message #1142814 is a reply to message #1142453] Thu, 17 October 2013 21:48 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hey Simone,
My question is more what JPA solution you use, hibernate or eclipselink or something else?
Also, you say that no FK's are generated, did you check in the database itself for this?
(I ask because on the basis of the annotation you showed the FK should be generated by the ORM layer)

gr. Martin

On 10/17/2013 06:33 PM, Simone Dionisi wrote:
> Hi Martin,
> thanks for your reply.
> I am using JPA with Postgres as RDBMS.
>
> Best regards


--

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:Create EMF model
Next Topic:[texo] [teneo]? Support for opposites
Goto Forum:
  


Current Time: Fri Apr 19 18:21:10 GMT 2024

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

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

Back to the top