-->
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: Hibernate + JTree
PostPosted: Tue Dec 16, 2008 4:52 pm 
Beginner
Beginner

Joined: Wed Dec 10, 2008 5:59 am
Posts: 47
Hi,

I've been working on this for 2 days now, without getting anywhere on it. I will greatly appreciate any help!

My problem is as follows:

I have a JTree which is used to show a hierarchy of Folders (just like a regular file system). Each folder which is represented through one of three node types (which all extends HierarchyNode). My problem is that while adding and deleting nodes from the JTree works just fine before i implemented Hibernate, things just doesn't play that well with Hibernate.

It seems like everything is fine. New child objects are perfectly added to the children list at its parent, TreePaths work fine - but somehow JTree just can't seem to figure out when i modify/add/delete objects from one of the Tree nodes.

As you may notice, i'm having trouble explaining the problem excactly, because i can't find one single thing to put my finger on. TreeModelEvents are issued correctly, all indexes look fine, all object references look good...but still the Tree will not update correctly.

Would anyone have experience using JTree and Hibernate together?

My HierarchyNode is mapped as follows:

Code:
<hibernate-mapping>
    <class name="hierarchy.entities.HierarchyNode" table="hierarchynode" >
        <id name="id" type="java.lang.Integer" column="id" >
            <generator class="increment" />
        </id>
        <discriminator column="type" type="java.lang.String"/>
       
        <property name="name" type="java.lang.String" column="name" length="200" />       
        <many-to-one name="parent" column="parent_id" class="hierarchy.entities.HierarchyNode" />   

        <!-- By setting cascade="none", we prevent the referenced agreement in the agreement table
        from being deleted when an association in the track_agreement table is deleted -->
        <bag name="children" inverse="true" lazy="false" cascade="all">
            <key column="parent_id"/>
            <one-to-many class="hierarchy.entities.HierarchyNode" />
   </bag>
       
        <subclass name="hierarchy.entities.HierarchyRootNode" discriminator-value="ROOT" />
       
        <subclass name="hierarchy.entities.TrackHierarchyNode" discriminator-value="TRACK" />

        <subclass name="hierarchy.entities.AlbumHierarchyNode" discriminator-value="ALBUM" />
       
    </class>
</hibernate-mapping>


Any help will be greatly appreciated!


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.