Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc) » [Texo] overwrite @CollectionTable with the ORM file(How to override @CollectionTable)
| | |
Re: [Texo] overwrite @CollectionTable with the ORM file [message #1173442 is a reply to message #1173138] |
Wed, 06 November 2013 14:23 |
Martin Taal Messages: 5468 Registered: July 2009 |
Senior Member |
|
|
Hi Gabriele,
I think there is an option/setting on the epackage orm annotation: generateFullDbSchemaNames
the default is true, can you set it at false?
gr. Martin
On 11/06/2013 11:06 AM, gabriele boldrin wrote:
> Hi Martin,
>
>
> I have not found an example.
> I've done some generation tests.
>
> By default in the "att2", the generator puts: "@ElementCollection" and "@ CollectionTable" to define the name of the
> table.
>
> Generated code :
>
>
> A1 { ...
> @ ElementCollection ( )
> @ CollectionTable ( name = " test1_A0_att2 " )
> private List <long> att2 <long> = new ArrayList ();
> ...}
>
>
> A2 { ...
> @ ElementCollection ( )
> @ CollectionTable ( name = " test1_A0_att2 " )
> private List <long> att2 <long> = new ArrayList ();
> ...}
>
>
> In this case JPA fails to create the database because there is a name conflict: A1 and A2 share the same table created
> for the attribute att2.
>
> TABLE :
> table_a1
> table_a0_att2 <---- conflict. The tables are not created
> table_a2
> table_a0_att2 <---- conflict. The tables are not created
>
>
> If you delete the annotation "@CollectionTable" from the code, then JPA successfully creates the tables:
>
>
>
> A1 { ...
> @ ElementCollection ( )
> //@CollectionTable ( name = "test1_A0_att2") <--remove or rename in "test1_A1_att2" private List <long> att2 <long> =
> new ArrayList ();
> ...}
>
>
> A2 { ...
> @ ElementCollection ( )
> //@CollectionTable ( name = "test1_A0_att2") <--remove or rename in "test1_A2_att2" private List <long> att2 <long> =
> new ArrayList ();
> ...}
>
>
> TABLE :
> table_a1
> table_a1_att2
> table_a2
> table_a2_att2
>
>
> I think that by default, texo must not put the @CollectionTable.
>
>
>
>
>
>
--
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] overwrite @CollectionTable with the ORM file [message #1186370 is a reply to message #1174759] |
Thu, 14 November 2013 17:12 |
Martin Taal Messages: 5468 Registered: July 2009 |
Senior Member |
|
|
Hi Gabriele,
There was a bug in Texo which ment that for collectiontable always a table name was set. I have corrected this and
pushed a new bug.
Still this only solves part of the issue, nl. when no name is set the ORM layer will choose it. I don't have a solution
that 2 impl classes can use different annotations for an inherited feature. Other than using associationoverride which
does not support collectiontable, and I am not sure if the interface is viewed as the superclass of the impl classes either.
In any case I hope it already helps if you don't specify the name attribute of the CollectionTable annotation. Btw, to
try it you have to remove the CollectionTable annotation completely and also have generate full db schema to false.
gr. Martin
On 11/07/2013 10:48 AM, gabriele boldrin wrote:
> Hi,
> I'm sorry, without the annotationsmodel file.
--
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] overwrite @CollectionTable with the ORM file [message #1186371 is a reply to message #1186370] |
Thu, 14 November 2013 17:13 |
Martin Taal Messages: 5468 Registered: July 2009 |
Senior Member |
|
|
Hi Gabriele,
I ofcourse pushed a new fix :-), I published a new build containing this fix also.
gr. Martin
On 11/14/2013 06:12 PM, Martin Taal wrote:
> Hi Gabriele,
> There was a bug in Texo which ment that for collectiontable always a table name was set. I have corrected this and
> pushed a new bug.
>
> Still this only solves part of the issue, nl. when no name is set the ORM layer will choose it. I don't have a solution
> that 2 impl classes can use different annotations for an inherited feature. Other than using associationoverride which
> does not support collectiontable, and I am not sure if the interface is viewed as the superclass of the impl classes
> either.
>
> In any case I hope it already helps if you don't specify the name attribute of the CollectionTable annotation. Btw, to
> try it you have to remove the CollectionTable annotation completely and also have generate full db schema to false.
>
> gr. Martin
>
> On 11/07/2013 10:48 AM, gabriele boldrin wrote:
>> Hi,
>> I'm sorry, without the annotationsmodel file.
>
>
--
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
|
|
|
Goto Forum:
Current Time: Fri Apr 26 03:29:51 GMT 2024
Powered by FUDForum. Page generated in 0.03703 seconds
|