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.  [ 5 posts ] 
Author Message
 Post subject: Stored procedure returns dynamic column names
PostPosted: Fri Sep 04, 2009 5:35 pm 
Newbie

Joined: Wed Aug 26, 2009 4:58 pm
Posts: 6
I have a sproc that is a result of a dynamic pivot table. The column names going into the sproc are dynamic and so the column names being returned are also dynamic. Here are my questions.

1. Since the values returned are a result of joined tables that are then pivoted what value do I put in the hbm.xml file for <id name="??"><column name="??" /><generator class="identity" /></id>

2. The <return-property> tags within the <sql-query> tag requires values that map to the columns returned from the db but the column names and number of columns returned will be dynamic. How should I handle this?

Unfortunately I need to have this resolved before a meeting next Monday. Please reply as soon as you can.

Thanks in advance.


Top
 Profile  
 
 Post subject: Re: Stored procedure returns dynamic column names
PostPosted: Tue Sep 08, 2009 8:31 pm 
Newbie

Joined: Wed Aug 26, 2009 4:58 pm
Posts: 6
I have continued to research this and I have come across the <map> tag. This seems to be the direction that I need to take but I cannot seem to get it to work. Can anybody please help with this issue?


Top
 Profile  
 
 Post subject: Re: Stored procedure returns dynamic column names
PostPosted: Wed Sep 09, 2009 11:30 am 
Newbie

Joined: Wed Aug 26, 2009 4:58 pm
Posts: 6
Here is where I am since my last reply. The way the db is structured I need to do a many-to-one to get the "name" part of the paired keys. This is returned at the first child node layer. What I want to do now is to add a <map tag that points to this instead of a table. For example,

Code:
  <class name="Dave" table="ControlNumberField">
    <id name="ControlNumberFieldID" type="System.Int32" column="ControlNumberFieldID" unsaved-value="0">
      <generator class="identity"/>
    </id>
    <property name="ControlNumberMetaID" />
    <property name="AttributeFieldID" />

    <many-to-one name="AttributeFields" class="AttributeField" fetch="join" column="AttributeFieldID" cascade="all" />

<!--
****This is where I am stuck****
****This is where I am stuck****
Instead of having table="CustomAttributeValue" I want to have something like table="{result of the above join}"
-->
  <map name="Attributes" table="CustomAttributeValue">
      <key column="ControlNumberFieldID"/>
      <index column="Name" type="System.String"/>
      <element column="Value" type="System.String"/>
    </map>



Top
 Profile  
 
 Post subject: Re: Stored procedure returns dynamic column names
PostPosted: Thu Sep 10, 2009 1:50 pm 
Newbie

Joined: Tue Feb 24, 2009 2:11 pm
Posts: 3
I am having the same issue. Please let me know of any solution.


Top
 Profile  
 
 Post subject: Re: Stored procedure returns dynamic column names
PostPosted: Fri Sep 11, 2009 4:44 pm 
Newbie

Joined: Wed Aug 26, 2009 4:58 pm
Posts: 6
The task has changed and I no longer need to pivot the results. I ended up using NHibernate's Subqueries class. If you give specifics I may be able to help from research I did but I am not 100% sure - willing to try.


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