Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NHibernate elt field

Does anyone know why NHibernate generates a field named 'elt' of type int for a many to many mapping? I'm wondering why I need it. Thanks

like image 208
user17510 Avatar asked Jan 25 '09 04:01

user17510


2 Answers

The "elt" field is the foreign key to the element in the many-to-many mapping. In the join table, you should see two foreign key columns, id (for the parent) and elt (for the element). You can use different names if you like; these are defaults.

like image 65
David Crow Avatar answered Nov 07 '22 10:11

David Crow


Thanks, yes you are right with a little more playing I found that if I don't explicitly name the column it defaults to elt.

<bag name="equipment" table="tb_room_equipment" lazy="false">
  <key column="roomID"/>
  <many-to-many class="Equipment" column="equipmentID"/>
</bag>

Like here, I have now named the column equipmentID; If I don't it will be named elt.

like image 27
user17510 Avatar answered Nov 07 '22 10:11

user17510