For the benefit of everybody, these are the 2 solutions that I have
found.
(http://www.hibernate.org/hib_docs/nhibernate/1.2/reference/en/html/
collections.html#collections-sorted)
**** Solution 1 mapping:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<class name="Domain.BalanceSheet, Domain" table="BalanceSheet">
<id name="Id" ...></id>
<property name="BalanceSheetName" type="string" />
<list name="OrderedCategories" table="BalanceSheetCategory"
lazy="true" access="field.camelcase-underscore">
<key column="BalanceSheetID"/>
<index column="CategoryIDIndex" />
<composite-element class="Domain.OrderedCategory">
<property name="CategoryName" type="string" not-null="true" />
</composite-element>
</list>
</class>
</hibernate-mapping>
And the code:
Public Class BalanceSheet
...
Public ReadOnly Property BalanceSheetID() As Integer
Public Property BalanceSheetName() As String
Public Property OrderedCategories() As IList(Of
OrderedCatagory)
End Class
Public Class OrderedCategory
...
Public Property CategoryName() As String
End Class
In that solution, the "composite-element" is an independant class,
complex or not.
**** Solution 2 mapping:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<class name="Domain.BalanceSheet, Domain" table="BalanceSheet">
<id name="Id" ...></id>
<property name="BalanceSheetName" type="string" />
<list name="OrderedCategories" table="BalanceSheetCategory"
lazy="true" access="field.camelcase-underscore">
<key column="BalanceSheetID"/>
<index column="CategoryIDIndex" />
<element type="string" column="CategoryName" not-null="true" />
</list>
</class>
</hibernate-mapping>
And the code:
Public Class BalanceSheet
...
Public ReadOnly Property BalanceSheetID() As Integer
Public Property BalanceSheetName() As String
Public Property OrderedCategories() As IList(Of String)
End Class
Because my need is a simple list of string, I don't need an
independant class.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---