-->
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.  [ 3 posts ] 
Author Message
 Post subject: Hibernate-Parent/Child XML Stored Procedure Mapping
PostPosted: Mon Aug 22, 2005 5:47 am 
Newbie

Joined: Mon Aug 22, 2005 5:34 am
Posts: 2
Hi,

I have a question regarding Hibernate mapping configuration. I have tried on this for some time and thought to take opinions if someone has already come across a similar situation. Actually, I need to generate XML file with elements having sub-elements up to various levels.

I tried to map two different tables and could generate sub-elements in resulting XML successfully.

But, my required scenario is that I have a stored procedure which returns an auto generated id column and other columns data which is actually an outer join of many stored procedures. Here, we have a requirement to add few columns as sub-element of other column from the same result set to the resulting XML. i.e. the result of a stored procedure has to form XML with various columns having relations with each other as parent/child tags.

I am badly stuck with this for a long time. I would appreciate a quick help.

Thanks in advance.

Best Regards
Gaurav Thaker


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 22, 2005 6:13 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
you need to show some concrete examples...

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 22, 2005 6:30 am 
Newbie

Joined: Mon Aug 22, 2005 5:34 am
Posts: 2
Max,

Thanks for taking interest. The example mapping that I am trying is something like below:

<hibernate-mapping>
<class entity-name="team_directory_detail" node="team_directory_detail" >

<id name="user_id" column="user_id" type="java.lang.Integer" node="user_id"/>
<property name="fname" column="fname" type="java.lang.String" node ="user-name" insert="false" update="false"/>
<property name="lname" column="lname" type="java.lang.String" node ="org-name" insert="false" update="false"/>
<property name="org_name" column="org_name" type="java.lang.String" node ="session_status" insert="false" update="false"/>
<property name="role_name" column="role_name" type="java.lang.String" node ="role-name" insert="false" update="false"/>
<property name="telephone" column="telephone" type="java.lang.String" node ="telephone" insert="false" update="false"/>
<property name="mobile" column="mobile" type="java.lang.String" node ="mobile" insert="false" update="false"/>
<property name="email" column="email" type="java.lang.String" node ="email" insert="false" update="false"/>
<property name="LastLoginDtTm" column="LastLoginDtTm" type="java.lang.String" node ="LastLoginDtTm" insert="false" update="false"/>

<map name="accounts"
node="myNode"
embed-xml="true">
<key column="fname"
not-null="true"/>
<map-key column="role_name"
node="@role_name"
type="string"/>
<many-to-many entity-name="team_directory_detail1"
embed-xml="false"
node="email"/>
</map>


</class>
<sql-query name="team_dir_detail_SP" callable="true">
<return alias="team_directory_detail" class="team_directory_detail">
<return-property name="user_id" column="user_id"/>
<return-property name="fname" column="fname"/>
<return-property name="lname" column="lname"/>
<return-property name="org_name" column="org_name"/>
<return-property name="role_name" column="role_name"/>
<return-property name="telephone" column="telephone"/>
<return-property name="mobile" column="mobile"/>
<return-property name="email" column="email"/>
<return-property name="LastLoginDtTm" column="LastLoginDtTm"/>
</return>
{ call getTeamDirectory_XML ( :project_id,:role_id,:org_id,:name,:server,:database ) }
</sql-query>
</hibernate-mapping>

Here, I am trying to generate an XML where there will be a tag for user id and then it will have sub element org_name and then org_name will have role_name as sub element like wise. I will appreciate If you can give me any hints or example on how to configure the <map> part of above configuration.

Note: The <map> part above is messed up by me while doing various trials.

Thanks
Gaurav


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.