Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
I have a query that returns 6 rows - which is correct - but each instance of PromoHeadingsHolder.class contains the data from row 1. I have tried many combinations, but same result. The PK on the table consists of the first 2 columns in the mapping document and the associated index is specified in the <generator> tag.
The code is wrapped by a try block, and the session close is in the finally block.
Help VM appreciated.
I am using Hibernate v2 , Oracle 8 and WebLogic 7
Here is a section of my mapping document
<class name="com.jnjvision.common.promo.dbo.PromoHeadingsHolder" table="PROMO_SURVEY_INTRO_TEXT" >
<meta attribute="class description">
Represents a text heading or text paragraph rendered above the demographics
section in the freetrial web page.
</meta>
<id name="surveyPromoId" type="long" unsaved-value="null">
<column name="PROMO_SURVEY_ID" length="10" />
<generator class="sequence">
<param name="sequence">PK_PROMO_SURVEY_INTRO_TEXT</param>
</generator>
</id>
<property name="paragraphSequenceNumber" type="int">
<column name="PARAGRAPH_SEQ_NO" length="2" not-null="true" />
</property>
<property name="resourceChannel" type="string">
<column name="RESOURCE_CHANNEL" length="2" />
</property>
/b
And here is the code:
List list = session.createCriteria(PromoHeadingsHolder.class)
.add(Expression.eq("surveyPromoId", promoId))
.add(Expression.ge("paragraphSequenceNumber",
new Integer(startingParagraphSeqNo)))
.add(Expression.le("paragraphSequenceNumber",
new Integer(endingParagraphSeqNo)))
.addOrder( Order.asc("paragraphSequenceNumber"))
.list();