-->
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: Tree Structure : Windows Registry
PostPosted: Sun Mar 15, 2009 3:38 pm 
Beginner
Beginner

Joined: Wed Jun 28, 2006 2:24 pm
Posts: 30
Location: Brazil
Hi,

I need to implement a persistent tree structure like the Windows Registry. I thought in the following model:

Code:
Node {

    String key;
   
    String value;

    List<Node> nodes;

}

Registry {

  List<Node> nodes;

}


This is the best way? How can I to map?

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 23, 2009 6:15 pm 
Beginner
Beginner

Joined: Wed Jun 28, 2006 2:24 pm
Posts: 30
Location: Brazil
I did the following mapping:

Code:
<hibernate-mapping>

  <class name="Node" table="node">

    <id name="id" column="ID">
      <generator class="native"/>
    </id>

    <many-to-one name="parent" class="Node" column="PARENT_ID"/>

    <property name="key" column="F_KEY" not-null="true"/>

    <property name="value" column="F_VALUE" not-null="true"/>

    <set name="children" inverse="true" cascade="all">
      <key column="PARENT_ID" not-null="true"/>
      <one-to-many class="Node"/>
    </set>

</class>

</hibernate-mapping>


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.