-->
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: All null elements in my collection
PostPosted: Wed Dec 14, 2005 6:48 pm 
Newbie

Joined: Wed Mar 02, 2005 1:28 pm
Posts: 4
My problem is that my criteria.list is returning me a collection of the correct size but where all the objects are null. I have no idea of why this is happening.
Has anybody ever seen something like this, any help will be greatly appreciated.
Thanks.

Hibernate version: 3.0

Mapping documents:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping SYSTEM "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="com.celltel.redemptions">
<class name="FraudRedemption" table="REDEMPTION" dynamic-update="false" dynamic-insert="false" polymorphism="explicit">
<cache usage="read-only"/>
<composite-id>
<key-property name="esn" column="ESN" type="string"/>
<key-property name="mdn" column="CELLNUM" type="string"/>
<key-property name="redemptionDate" column="REDEMPTION_DATE" type="timestamp"/>
<key-property name="actionType" column="ACTION_TYPE" type="string"/>
<key-property name="cardNumber" column="CARD_NUMBER" type="string"/>
<key-property name="cardSMPNumber" column="CARD_SMP" type="string"/>
<key-property name="redemptionUnits" column="CARD_UNITS" type="long"/>
<key-many-to-one name="promotion" column="PROMO_OBJID"/>
</composite-id>
<property name="source" column="SOURCESYSTEM" not-null="false" update="false" type="string"/>
<property name="cardDealer" column="CARD_DEALER_NAME" not-null="false" update="false" type="string"/>
<property name="cardPartNumber" column="CARD_PART_NUMBER_DESCRIPTION" not-null="false" update="false" type="string"/>
<property name="agentLoginName" column="USER_LOGIN_NAME" not-null="false" update="false" type="string"/>
</class>
</hibernate-mapping>

Code between sessionFactory.openSession() and session.close():
Session session = hibernate.getSession(CLARIFY);
try
{
if(session == null)
{
log.error("THE Hibernate SESSION IS NULL");
throw new HibernateException("The Hibernate session object is null and cannot be queried");
}
Criteria criteria = session.createCriteria(FraudRedemption.class);
//criteria = QueryUtil.makeEsnMdnCriteria(criteria, esn, mdn);
if (esn != null)
{
criteria = criteria.add(Expression.eq("esn", esn));
}
if (mdn != null)
{
criteria = criteria.add(Expression.eq("mdn", mdn));
}
criteria = QueryUtil.makeDateRangeCriteria(criteria, startDate, endDate, "redemptionDate");

switch(sortColumn)
{
//RedemptionHistory.REDEMPTION_DATE = 2
case 2:
criteria.addOrder(Order.desc("redemptionDate"));
break;

//RedemptionHistory.REDEMPTION_UNITS = 3
case 3:
criteria.addOrder(Order.desc("redemptionUnits"));
break;

//RedemptionHistory.ACTION_TYPE = 4
case 4:
criteria.addOrder(Order.asc("actionType"));
break;

//RedemptionHistory.CARD_NUMBER = 5
case 5:
criteria.addOrder(Order.asc("cardNumber"));
break;

//RedemptionHistory.SOURCE = 6
case 6:
criteria.addOrder(Order.asc("source"));
break;

//RedemptionHistory.REASON = 7
case 7:
criteria.addOrder(Order.asc("reason"));
break;

//RedemptionHistory.CARD_DEALER = 8
case 8:
criteria.addOrder(Order.asc("cardDealer"));
break;

//RedemptionHistory.CARD_PART_NUMBER = 9
case 9:
criteria.addOrder(Order.asc("cardPartNumber"));
break;

//RedemptionHistory.AGENT_LOGIN_NAME = 10
case 10:
criteria.addOrder(Order.asc("agentLoginName"));
break;

//RedemptionHistory.CARD_SMP_NUMBER = 11
case 11:
criteria.addOrder(Order.asc("cardSMPNumber"));
break;
}

if(maxResults != ALL_RECORDS)
{
criteria.setMaxResults(maxResults);
}
if(firstResult != ALL_RECORDS)
{
criteria.setFirstResult(firstResult);
}

criteria.setTimeout(2000000);

return criteria.list();
} finally
{
this.controlSessionLeaks(session);
}

Full stack trace of any exception that occurs: No Exceptions

Name and version of the database you are using: Oracle

The generated SQL (show_sql=true):

select this_.ESN as ESN0_, this_.CELLNUM as CELLNUM0_, this_.REDEMPTION_DATE as REDEMPTION3_0_, this_.ACTION_TYPE as ACTION4_0_, this_.CARD_NUMBER as CARD5_0_, this_.CARD_SMP as CARD6_0_, this_.CARD_UNITS as CARD7_0_, this_.PROMO_OBJID as PROMO8_0_, this_.SOURCESYSTEM as SOURCESY9_3_0_, this_.CARD_DEALER_NAME as CARD10_3_0_, this_.CARD_PART_NUMBER_DESCRIPTION as CARD11_3_0_, this_.USER_LOGIN_NAME as USER12_3_0_
from X_RPT_REDEMPTION this_
where this_.ESN=?


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.