-->
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: unidirectional one-to-many on xml associations
PostPosted: Wed Mar 05, 2008 10:13 am 
Newbie

Joined: Tue Mar 04, 2008 10:19 am
Posts: 1
Hibernate version: 3.2.5

using DB2 9.5 with XML which allows me to have embedded XML documents (which are searchable via SQL) in special XML columns. have only two operative tables (plus 2 supporting type tables with foreign keys on the type id):


Code:
Element
---------
elementid
elementtypeid
(booking keeping columns)
management (xml column)

Relationship
--------------
relationshipid
relationshiptypeid
(booking keeping columns)
management (xml column)


i want to represent a unidirectional one-to-many association från the elementid (in the Element table) to xml nodes in the management column of the Relationship table. for example:

Code:
Element (elementid) ----> Relationship ($management://Source/Identification/Id)


read about patch (HHH-2086) from Xavier Brénuchon allowing formulas with one-to-many associations. might do the trick (but that patch doesn't work on 3.2.5 and as stated in the JIRI likely only works with 3.2.0.cr4). the association in the Element.hbm.xml file would be as:

Code:
<set name="sourceRelationships" lazy="true" cascade="save-update" where="TOTIMESTAMP is null">
         <key column="ELEMENTID" formula="XMLCAST (XMLQUERY('declare namespace rel=&quot;http://fk.se/matrix/management/baseRelationship&quot; declare namespace core=&quot;http://fk.se/matrix/management/core&quot; $doc//rel:Source/rel:Identification/core:Id' passing management as &quot;doc&quot;) as INTEGER)" on-delete="noaction" not-null="false"/>
         <one-to-many class="matrix.v.test.pojo.cmdb.Relationship" />
   </set>



can't confirm the above until applying the patch to 3.2.0.cr4. wondering if anybody has a better idea how the association can be mapped? in the database model there is no foreign key between element/relationship tables but the association is important for using Hibernate Criteria queries. a formula of some kind with raw SQL is a must likely any solution.


thanks in advance / Matthew


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.