-->
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: Write map for Graphs
PostPosted: Thu Aug 13, 2009 2:05 pm 
Newbie

Joined: Mon Jun 11, 2007 5:58 am
Posts: 1
Hi!

In my database is 2 tables:
Keywords
----------
ID INTEGER
Keyword VARCHAR

and
Links
----------
Keyword1 INTEGER
Keyword2 INTEGER

So there is a keywords and some keywords are synonymous (they are linked in Link table). The trouble is that synonyms can be linked in two directions.
Example there is keywords A and B, (they are synonyms). In Links table they can linked by two directions:

Keyword 1 | Keyword 2
-----------------------
A | B

Or

Keyword 1 | Keyword 2
-----------------------
B | A


Both variants are equals.

There is class Keyword with method
Code:
public Set<Keyword> getSynonyms()


Is needed to write a map file! getSynonyms() must return a set of synonyms (Keyword instances) wich linked with current keyword by any directions.

I have write this in map file...

Code:
    <class name="Keyword" table="keywords">
        <id name="id" column="id">
            <generator class="org.hibernate.id.IdentityGenerator"/>
        </id>
        <property name="keyword" column="keyword"/>

        <set name="synonyms" table="links" lazy="true" cascade="save-update">
            <key column="keyword1"/>
            <many-to-many column="keyword2"
                          class="Keyword"/>
        </set>
    </class>

But it is wrong, because will loaded only part of all related keywords... Have any ideas?


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.