This might be a simple question but I have no idea how to face it.
I want a class to have a collection ( list ) of String elements.
Already did the same having own classes as elements since a bunch of tutorials show the e.g. as ...
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping>
<class
name="net.sourceforge.forum.Forum"
table="TBL_FORUM"
dynamic-update="false"
dynamic-insert="false"
>
<id
name="id"
column="PK_CATEGORY_ID"
type="java.lang.Long"
unsaved-value="-1"
>
<generator class="native">
</generator>
</id>
<bag
name="threads"
lazy="true"
inverse="true"
cascade="save-update"
>
<key
column="FK_FORUM_ID"
/>
<one-to-many
class="net.sourceforge.forum.Thread"
/>
</bag>
</class>
</hibernate-mapping>
But what about if I want that also have a List of String elements ?
Should be something like ... ?
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping>
<class
name="net.sourceforge.forum.Forum"
table="TBL_FORUM"
dynamic-update="false"
dynamic-insert="false"
>
<id
name="id"
column="PK_CATEGORY_ID"
type="java.lang.Long"
unsaved-value="-1"
>
<generator class="native">
</generator>
</id>
<bag
name="descriptions"
lazy="true"
inverse="true"
cascade="save-update"
>
<key
column="FK_FORUM_ID"
/>
<one-to-many
class="string"
/>
</bag>
</class>
</hibernate-mapping>
[/code]
Is that OK ?
Thanks !