-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: map in a map
PostPosted: Mon Sep 29, 2003 10:25 am 
Newbie

Joined: Mon Sep 29, 2003 10:19 am
Posts: 2
hi there,
is it possible to do the following:

object(user) has an attribute which is a map(dataset), the map consists of keys and values where every value consitsts of another map with keys and values.

i tried to map that: wrapped an object around the 2nd level map but all that worked was when i mapped the first map to a SET.

User.hbm.xml:

<hibernate-mapping>

<class name="de.vfh.tellme.model.UserImpl" table="user">
<id name="ID" type="string" unsaved-value="null">
<column name="id" sql-type="char(32)" not-null="true"/>
<generator class="uuid.hex"/>
</id>

<property name="matrNr" type="string" not-null="true" length="30"/>
<property name="password" type="string" not-null="false" length="30"/>
<property name="administrator" type="boolean" not-null="true"/>

<many-to-one name="parent" outer-join="false" class="de.vfh.tellme.model.UserImpl" cascade="all"/>

<map name="dataSetsMap">
<key column="datasetsmap_id"/>
<one-to-many class="de.vfh.tellme.model.DataSetImpl"/>
</map>

</class>

</hibernate-mapping>

DataSet.hbm.xml:
<hibernate-mapping>

<class name="de.vfh.tellme.model.DataSetImpl" table="dataSet">
<id name="ID" type="string" unsaved-value="null">
<column name="id" sql-type="char(32)" not-null="true"/>
<generator class="uuid.hex"/>
</id>

<map name="dataMap">
<key column="datamap_id" />
<index column="datamap_key" type="string" length="32"/>
<element column="datamap_value" type="string" length="32"/>
</map>
</class>

</hibernate-mapping>

thanks in advance,
andr


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 30, 2003 4:24 am 
Newbie

Joined: Mon Sep 29, 2003 10:19 am
Posts: 2
i found the solution on my own.

just for the record:

User.hbm.xml

<hibernate-mapping>

<class name="de.vfh.tellme.model.UserImpl" table="user">
<id name="ID" type="string" unsaved-value="null">
<column name="id" sql-type="char(32)" not-null="true"/>
<generator class="uuid.hex"/>
</id>

<property name="matrNr" type="string" not-null="true" length="30"/>
<property name="password" type="string" not-null="false" length="30"/>
<property name="administrator" type="boolean" not-null="true"/>

<many-to-one name="parent" outer-join="false" class="de.vfh.tellme.model.UserImpl" cascade="all"/>

<map name="dataSetsMap" table="dataSetsMap">
<key column="datasetsmap_id"/>
<index column="datasetsmap_key" type="string" length="32"/>
<element column="datasetsmapp_value" type="string" length="32"/>
<one-to-many class="de.vfh.tellme.model.DataSetImpl"/>
</map>


</class>

</hibernate-mapping>

-------------------------------------------------------------------------------------

DataSet.hbm.xml

<hibernate-mapping>

<class name="de.vfh.tellme.model.DataSetImpl" table="dataSet">
<id name="ID" type="string" unsaved-value="null">
<column name="id" sql-type="char(32)" not-null="true"/>
<generator class="uuid.hex"/>
</id>

<map name="dataMap">
<key column="datamap_id" />
<index column="datamap_key" type="string" length="32"/>
<element column="datamap_value" type="string" length="32"/>
</map>
</class>

</hibernate-mapping>

i hope its not a hack or something :-)

ciao, andr


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.