<class name="Address">
  <id name="id">
    <generator class="guid"/>
  </id>
  <many-to-one class="Customer" foreign-key="FK_Customer_Address"/></class>

James
--
James Kovacs, B.Sc., M.Sc., MCSD, MCT
Microsoft MVP - C# Architecture
http://www.jameskovacs.com
[EMAIL PROTECTED]
403-397-3177 (mobile)


On Fri, Oct 3, 2008 at 8:30 AM, Victor Toni <[EMAIL PROTECTED]> wrote:

>  Thanks a lot. I could get rid of some of the unhandy FK names.
> Is there a way to do the same for <many-to-one>?
>
> Kindest regards,
> Victor
>
>
> On 03.10.2008 01:09, James Kovacs wrote:
>
> You can define explicit names for your foreign key relationships via the
> foreign-key attribute. For example:
>    <class name="Customer" table="Customer" >
>     <id name="Id" column="ID">
>       <generator class="guid" />
>     </id>
>     <property name="Name" not-null="true" />
>     <set name="Addresses" cascade="all">
>       <key column="CustomerID" foreign-key="FK_Customer_Address" />
>       <one-to-many class="Address"/>
>     </set>
>   </class>
>
>  James
> --
> James Kovacs, B.Sc., M.Sc., MCSD, MCT
> Microsoft MVP - C# Architecture
> http://www.jameskovacs.com
> [EMAIL PROTECTED]
> 403-397-3177 (mobile)
>
>
> On Thu, Oct 2, 2008 at 5:03 PM, Victor Toni <[EMAIL PROTECTED]> wrote:
>
>>
>> Hi All,
>>
>> is it possible to influence the naming of foreign keys / constraints?
>> These would "look better" if one could provide a more meaningful name
>> than FKxxxxxxxxxxxx ...
>>
>> Kindest regards,
>> Victor
>>
>
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to