-->
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: Issue with getNamedQuery
PostPosted: Tue Jan 03, 2006 7:40 am 
Beginner
Beginner

Joined: Wed Apr 21, 2004 8:33 am
Posts: 27
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:2.0

Mapping documents:Tidcvval.hbm
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 2.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping>
<class name="Testing.Tidcvval" table="TIDCVVAL" schema="wf503">
<composite-id >
<key-property
column="ELEM_NBR"
length="8"
name="elemNbr"
type="string"
/>
<key-property
column="CODE_QUAL_VAL"
length="12"
name="codeQualVal"
type="string"
/>
<key-property
column="CODE_VALUE"
length="12"
name="codeValue"
type="string"
/>
</composite-id>
<property name="displayValue" column="DISPLAY_VALUE" type="java.lang.String" length="24" not-null="true"/>
<property name="codeEndDate" column="CODE_END_DATE" type="java.lang.String" length="16" not-null="true"/>
<property name="codeStartDate" column="CODE_START_DATE" type="java.lang.String" length="16" not-null="true"/>
<property name="codeDescr" column="CODE_DESCR" type="java.lang.String" length="158" not-null="true"/>
<property name="lockedCodeValue" column="LOCKED_CODE_VALUE" type="java.lang.String" length="2" not-null="true"/>
<property name="genArg" column="GEN_ARG" type="java.lang.Long" length="22" not-null="true"/>
<property name="timeStamp" column="TIME_STAMP" type="java.lang.String" length="26" not-null="true"/>

</class>

<query name="Read_Tidcvval_Both_Dates_Blank">
<![CDATA[
FROM Testing.Tidcvval
WHERE
ELEM_NBR = :InputString_ElementNbr
AND
CODE_QUAL_VAL = :InputString_CodeQualVal

]]>
</query>

</hibernate-mapping>


Code between sessionFactory.openSession() and session.close():
String inputString1_Code_Qual = "REPAIR CATA";
String inputString2_Elem_Nbr = "TIG12790";
List result = null;
Query q = sess.getNamedQuery(Tidcvval.QUERY_READ_TIDCVVAL_DATES_BLANK);
q.setString("InputString_CodeQualVal",inputString1_Code_Qual);
q.setString("InputString_ElementNbr",inputString2_Elem_Nbr);
result = q.list();




Name and version of the database you are using:Oracle 9i

I have the appropriate QUERY_READ_TIDCVVAL_DATES_BLANK definition in Tidcvval.java the value object.

However when i run my test the result size is zero whereas when i execute the sql that is being logged using p6spy it shows that there are 6 records in the DB which ofcourse is true.

So can anybody tell if am doing something wrong , because the sql that is being logged as result of getNamedQuery works , but the getNamedQuery as such does not work.

Thanks and Regards
Vijay


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.