Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc) » [Teneo] Setting a 'unique' constraint on a many-to-one reference in hibernate
[Teneo] Setting a 'unique' constraint on a many-to-one reference in hibernate [message #69943] |
Fri, 02 February 2007 01:17  |
Eclipse User |
|
|
|
Originally posted by: Stephen.Egan.csiro.au
Hi,
I'm trying to add a unique constraint to a many-to-one Ereference in my =
=
ecore model using Eannotaions. I've added the following Eannotation to =
=
the Ereference:
<eStructuralFeatures xsi:type=3D"ecore:EReference" name=3D"userAc=
count" =
eType=3D"#//Support/UserAccount">
<eAnnotations source=3D"teneo.hibernate">
<details key=3D"appinfo" value=3D"@Column(unique=3D"true=
")"/>
</eAnnotations>
</eStructuralFeatures>
This works fine for an Eattribute, but doesn't seem to have any effect o=
n =
the generated hibernate mappings for an EReference:
<many-to-one name=3D"userAccount" entity-name=3D"UserAccount" =
cascade=3D"merge,persist,save-update,lock,refresh" lazy=3D"false" =
insert=3D"true" update=3D"true" not-null=3D"false">
<column not-null=3D"false" unique=3D"false" =
name=3D"`useraccount_useraccount_id`"/>
</many-to-one>
I'm still new to fiddling about with the Eannotations, so please forgive=
=
me if this is a dumb question.
//Stephen
|
|
|
Re: [Teneo] Setting a 'unique' constraint on a many-to-one reference in hibernate [message #69963 is a reply to message #69943] |
Fri, 02 February 2007 02:53   |
Eclipse User |
|
|
|
Hi Stephen,
No dumb question, on an ereference you can use the JoinColumn annotation for this (so just replace
Column with JoinColumn).
gr. Martin
Stephen Egan wrote:
> Hi,
> I'm trying to add a unique constraint to a many-to-one Ereference in my
> ecore model using Eannotaions. I've added the following Eannotation to
> the Ereference:
>
> <eStructuralFeatures xsi:type="ecore:EReference"
> name="userAccount" eType="#//Support/UserAccount">
> <eAnnotations source="teneo.hibernate">
> <details key="appinfo" value="@Column(unique="true")"/>
> </eAnnotations>
> </eStructuralFeatures>
>
> This works fine for an Eattribute, but doesn't seem to have any effect
> on the generated hibernate mappings for an EReference:
>
> <many-to-one name="userAccount" entity-name="UserAccount"
> cascade="merge,persist,save-update,lock,refresh" lazy="false"
> insert="true" update="true" not-null="false">
> <column not-null="false" unique="false"
> name="`useraccount_useraccount_id`"/>
> </many-to-one>
>
> I'm still new to fiddling about with the Eannotations, so please forgive
> me if this is a dumb question.
>
> //Stephen
--
With Regards, Martin Taal
Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
|
|
|
Re: [Teneo] Setting a 'unique' constraint on a many-to-one reference in hibernate [message #70508 is a reply to message #69963] |
Mon, 05 February 2007 19:48  |
Eclipse User |
|
|
|
Originally posted by: Stephen.Egan.csiro.au
Thanks Martin,
Prompt and accurate as usual!
///Stephen
On Fri, 02 Feb 2007 18:53:27 +1100, Martin Taal <mtaal@elver.org> wrote:=
> Hi Stephen,
> No dumb question, on an ereference you can use the JoinColumn annotati=
on =
> for this (so just replace Column with JoinColumn).
>
> gr. Martin
>
> Stephen Egan wrote:
>> Hi,
>> I'm trying to add a unique constraint to a many-to-one Ereference in =
my =
>> ecore model using Eannotaions. I've added the following Eannotation =
to =
>> the Ereference:
>> <eStructuralFeatures xsi:type=3D"ecore:EReference" =
>> name=3D"userAccount" eType=3D"#//Support/UserAccount">
>> <eAnnotations source=3D"teneo.hibernate">
>> <details key=3D"appinfo" =
>> value=3D"@Column(unique=3D"true")"/>
>> </eAnnotations>
>> </eStructuralFeatures>
>> This works fine for an Eattribute, but doesn't seem to have any effe=
ct =
>> on the generated hibernate mappings for an EReference:
>> <many-to-one name=3D"userAccount" entity-name=3D"UserAccount=
" =
>> cascade=3D"merge,persist,save-update,lock,refresh" lazy=3D"false" =
>> insert=3D"true" update=3D"true" not-null=3D"false">
>> <column not-null=3D"false" unique=3D"false" =
>> name=3D"`useraccount_useraccount_id`"/>
>> </many-to-one>
>> I'm still new to fiddling about with the Eannotations, so please =
>> forgive me if this is a dumb question.
>> //Stephen
>
>
-- =
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
|
|
|
Re: [Teneo] Setting a 'unique' constraint on a many-to-one reference in hibernate [message #601973 is a reply to message #69943] |
Fri, 02 February 2007 02:53  |
Eclipse User |
|
|
|
Hi Stephen,
No dumb question, on an ereference you can use the JoinColumn annotation for this (so just replace
Column with JoinColumn).
gr. Martin
Stephen Egan wrote:
> Hi,
> I'm trying to add a unique constraint to a many-to-one Ereference in my
> ecore model using Eannotaions. I've added the following Eannotation to
> the Ereference:
>
> <eStructuralFeatures xsi:type="ecore:EReference"
> name="userAccount" eType="#//Support/UserAccount">
> <eAnnotations source="teneo.hibernate">
> <details key="appinfo" value="@Column(unique="true")"/>
> </eAnnotations>
> </eStructuralFeatures>
>
> This works fine for an Eattribute, but doesn't seem to have any effect
> on the generated hibernate mappings for an EReference:
>
> <many-to-one name="userAccount" entity-name="UserAccount"
> cascade="merge,persist,save-update,lock,refresh" lazy="false"
> insert="true" update="true" not-null="false">
> <column not-null="false" unique="false"
> name="`useraccount_useraccount_id`"/>
> </many-to-one>
>
> I'm still new to fiddling about with the Eannotations, so please forgive
> me if this is a dumb question.
>
> //Stephen
--
With Regards, Martin Taal
Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
|
|
|
Re: [Teneo] Setting a 'unique' constraint on a many-to-one reference in hibernate [message #602179 is a reply to message #69963] |
Mon, 05 February 2007 19:48  |
Eclipse User |
|
|
|
Originally posted by: Stephen.Egan.csiro.au
Thanks Martin,
Prompt and accurate as usual!
///Stephen
On Fri, 02 Feb 2007 18:53:27 +1100, Martin Taal <mtaal@elver.org> wrote:=
> Hi Stephen,
> No dumb question, on an ereference you can use the JoinColumn annotati=
on =
> for this (so just replace Column with JoinColumn).
>
> gr. Martin
>
> Stephen Egan wrote:
>> Hi,
>> I'm trying to add a unique constraint to a many-to-one Ereference in =
my =
>> ecore model using Eannotaions. I've added the following Eannotation =
to =
>> the Ereference:
>> <eStructuralFeatures xsi:type=3D"ecore:EReference" =
>> name=3D"userAccount" eType=3D"#//Support/UserAccount">
>> <eAnnotations source=3D"teneo.hibernate">
>> <details key=3D"appinfo" =
>> value=3D"@Column(unique=3D"true")"/>
>> </eAnnotations>
>> </eStructuralFeatures>
>> This works fine for an Eattribute, but doesn't seem to have any effe=
ct =
>> on the generated hibernate mappings for an EReference:
>> <many-to-one name=3D"userAccount" entity-name=3D"UserAccount=
" =
>> cascade=3D"merge,persist,save-update,lock,refresh" lazy=3D"false" =
>> insert=3D"true" update=3D"true" not-null=3D"false">
>> <column not-null=3D"false" unique=3D"false" =
>> name=3D"`useraccount_useraccount_id`"/>
>> </many-to-one>
>> I'm still new to fiddling about with the Eannotations, so please =
>> forgive me if this is a dumb question.
>> //Stephen
>
>
-- =
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
|
|
|
Goto Forum:
Current Time: Sun Apr 27 01:57:05 EDT 2025
Powered by FUDForum. Page generated in 0.25780 seconds
|