[Teneo] Using char with non-default size causes problems [message #1184790] |
Wed, 13 November 2013 12:49  |
Eclipse User |
|
|
|
Hello,
I have a model which contains two EClass. EClass A refers to EClass B.
A has a string attribute as key with the annotation:
@Column(columnDefinition="CHAR(64)")
B has a non-containment reference on A.
Using this model with MySQL works and the reference is generated correctly.
Oracle 11c can't create the constraint (ORA-02267):
alter table "B" add constraint b_a foreign key ("a_a_key") references "A"
It creates the column a_a_key as VARCHAR2(255 CHAR) instead of CHAR(64 BYTES).
I have tried to use the column annotation from above, but it doesn't work.
Can anyone help me?
It seems to be a teneo specific issue isn't it?
|
|
|
|
|
|
|
|
|
|
|
Re: [Teneo] Using char with non-default size causes problems [message #1188312 is a reply to message #1187884] |
Fri, 15 November 2013 10:14   |
Eclipse User |
|
|
|
Hi John,
Yes I agree that this would be best, but it is an ORM responsibility to do that imho.
I am surprised that the ORM does not do this automatically, maybe it is because the ColumnDefinition allows much
flexibility which is difficult to parse (like not null, which you maybe not want for the foreign key column).
gr. Martin
On 11/15/2013 11:27 AM, John M. wrote:
> Hello Martin,
>
> I didn't try it before. When I add that annotation it works.
> But it means that I need to maintain the size at two different points, right?
>
> I think it isn't the "best" way. Perhaps it would be possible to detect the datatype of the referenced column in class A
> automatically and adjust the foreign key column in class B.
--
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: [Teneo] Using char with non-default size causes problems [message #1194568 is a reply to message #1194457] |
Mon, 18 November 2013 10:28   |
Eclipse User |
|
|
|
Hey John,
Hmm, not sure I fully follow you, it would mean parsing the columndefinition I think, but sounds like a great feature
for sponsored development ;-) or a contribution! :-)
gr. Martin
On 11/18/2013 03:16 PM, John M. wrote:
> Hello Martin,
>
> yes could be possible, but I think you can restrict as ORM developer, which parameters are transferred. :)
> For example the datatype would be important.
--
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: [Teneo] Using char with non-default size causes problems [message #1194696 is a reply to message #1194632] |
Mon, 18 November 2013 11:47  |
Eclipse User |
|
|
|
Yes it would be, but I guess the columndefinition can be anything and can differ on the type of database you use, so it
would be dangeruous for the ORM to automatically derive column properties/types from that.
But in any case it doesn't work as of now :-)
gr. Martin
On 11/18/2013 05:10 PM, John M. wrote:
> Hello Martin,
>
> but it would be better to implement such a function in Hibernate wouldn't it?
> The idea is just to look for specific things which are interesting for the join column like data type and ignore
> properties like "not null" and similar mentioned above.
--
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
|
|
|
Powered by
FUDForum. Page generated in 0.11910 seconds