-->
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.  [ 1 post ] 
Author Message
 Post subject: easy(!) directory/folder example in hibernate not possible?
PostPosted: Sun Nov 18, 2007 2:00 pm 
Newbie

Joined: Thu Nov 15, 2007 9:52 am
Posts: 8
I failed with this easy directory/folder example, because I don't know how to write the mapping if first level folders of the directory have the root as parent and all other folders have a folder as parent.

So the data-structure ist the same as you know it from a directory.

There are 2 objects to persist:
- the directory-root, which contains folders (all folders without a parentFolder)
- folders, which can contain other folders

The table Folders looks like this:

Code:
ID_Folder, ID_Parent_Folder, Name


If a folder has no parentFolder it is child of the root-object.

This is the mapping for the Collection-Set "childFolders" of a Folder :
Code:
<set name="childFolders" cascade="all" lazy="false">
     <key column="ID_PARENT_FOLDER"/>
     <one-to-many class="Folder"/>
</set>


But I don't know how to write the mapping for the childFolders of the root?
Because therefor I would have to select all folders which don't have a parentfolder.

Can you please help me?


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

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.