-->
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.  [ 4 posts ] 
Author Message
 Post subject: Mapping Problem
PostPosted: Mon Apr 03, 2006 3:45 am 
Newbie

Joined: Thu Dec 29, 2005 11:02 am
Posts: 4
Hello everyone!

I have a problem with my mapping. i use a mapping document with ejb 3 because i want to map a stored procedure result set. i've done this often because i have to integrate many procedures. it always worked fine. but now it's the first one i use here with more than one row in the result set. the problem is that in the list that i get all items are references to the first item in the list. the number of items returned is correct. please help me i don't know what i've missed! Or ist this not possible in that way?

Hibernate version:
3.1
Mapping documents:

Code:
<class name="com.xxx.PDCStockTransferQuantity">
     <id name="productionOrderId" type="integer" column="prod_order_id"/>
     <property name="productionOrderNo" type="string" column="prod_order_no"/>
      <property name="stockTransferType" type="integer" column="stock_transfer_type"/>
      <property name="prodBomPosition" type="integer" column="prod_bom_position"/>
      <property name="prodBomId" type="integer" column="prod_bom_id"/>
      <property name="articleMaterialId" type="integer" column="article_material_id"/>
      <property name="articleMaterialNo" type="string" column="article_material_no"/>
      <property name="articleMaterialDesc" type="string" column="article_material_desc"/>
      <property name="unitDesc" type="string" column="unit_desc"/>
      <property name="targetQuantity" type="big_decimal" column="target_quantity"/>
      <property name="actualQuantity" type="big_decimal" column="actual_quantity"/>
      <property name="postingQuantity" type="big_decimal" column="posting_quantity"/>
      <property name="goodQuantity" type="big_decimal" column="good_quantity"/>
      <property name="scrapQuantity" type="big_decimal" column="scrap_quantity"/>
      <property name="stockKeeping" type="integer" column="stock_keeping"/>
      <property name="distOrderPostId" type="integer" column="dist_order_pos_id"/>
      <property name="storageLocationId" type="integer" column="storage_location_id"/>
</class>
     
<sql-query name="PDCSTOCKTRANQUANT" callable="true">
      <return  class="com.xxx.PDCStockTransferQuantity">
            <return-property name="productionOrderId" column="prod_order_id"/>
           <return-property name="productionOrderNo"  column="prod_order_no"/>
            <return-property name="stockTransferType"  column="stock_transfer_type"/>
            <return-property name="prodBomPosition"  column="prod_bom_position"/>
            <return-property name="prodBomId"  column="prod_bom_id"/>
            <return-property name="articleMaterialId"  column="article_material_id"/>
            <return-property name="articleMaterialNo"  column="article_material_no"/>
            <return-property name="articleMaterialDesc"  column="article_material_desc"/>
            <return-property name="unitDesc" column="unit_desc"/>
            <return-property name="targetQuantity"  column="target_quantity"/>
            <return-property name="actualQuantity" column="actual_quantity"/>
            <return-property name="postingQuantity"  column="posting_quantity"/>
            <return-property name="goodQuantity"  column="good_quantity"/>
            <return-property name="scrapQuantity" column="scrap_quantity"/>
            <return-property name="stockKeeping" column="stock_keeping"/>
            <return-property name="distOrderPostId"  column="dist_order_pos_id"/>
            <return-property name="storageLocationId"  column="storage_location_id"/>
      </return>
      {  call stp_PDCGetStockTransferAmount(:pdcNo,:prodAmountGood,:scrapQuantity,:reworkQuantity,:confirmationType) }
   </sql-query>
 


Code in Session Bean Method
Code:
List pdcstock = null;
      pdcstock = em.createNamedQuery("PDCSTOCKTRANQUANT")
      .setParameter("pdcNo",pdcNo)
      .setParameter("prodAmountGood",prodAmountGood)
      .setParameter("scrapQuantity",scrapQuantity)
      .setParameter("reworkQuantity",reworkQuantity)
      .setParameter("confirmationType",confirmationType)
      .getResultList();

Name and version of the database you are using:
Sybase ASA 9


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 03, 2006 5:24 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
and you are 100% sure that each of the rows you return is actually unique ?

try to run it with debug logging and see what values are actually returned and processed.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 03, 2006 5:27 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
btw. if you returned column names are exactly the same then just do (in later 3.1.x code):

Code:
<sql-query name="PDCSTOCKTRANQUANT" callable="true">
      <return  class="com.xxx.PDCStockTransferQuantity"/>
      {  call stp_PDCGetStockTransferAmount(:pdcNo,:prodAmountGood,:scrapQuantity,:reworkQuantity,:confirmationType) }
   </sql-query>


much easier, right ? :)

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject: That's it!
PostPosted: Tue Apr 04, 2006 5:39 am 
Newbie

Joined: Thu Dec 29, 2005 11:02 am
Posts: 4
Thanks for the quick answer max!

It was really a promlem with uniqueness...
i chose the wrong column as PK.
my mistake...

Thanks for the pointer!


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