-->
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.  [ 2 posts ] 
Author Message
 Post subject: Entity not being found, but generated query works in SQL*Plu
PostPosted: Fri Oct 21, 2005 6:35 pm 
Newbie

Joined: Wed Oct 12, 2005 3:59 pm
Posts: 12
I'm having a strange problem where my simple finder isn't finding my record, even though the record is in the database (I closed all connections I was using outside of the application to make sure it wasn't a commit problem).

Everything appears to run correctly, and I c-n-p'd the query into SQL*Plus and it came back w/ the record find (the difference being I had to replace the binding manually w/ 'I').

Anyone see anything wrong, or know where I can look?



Hibernate version:3

Mapping documents:
RefCaseStatus.hbm.xml:
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<!--
        Auto-generated mapping file from
        the hibernate.org cfg2hbm engine
-->
    <class name="x.to.RefCaseStatus" table="REF_CASE_STATUS" schema="ATFPSBADMIN">
        <id name="caseStatusCode" type="string">
            <column name="CASE_STATUS_CODE" length="2" />
            <generator class="assigned" />
        </id>
        <property name="caseStatusName" type="string">
            <column name="CASE_STATUS_NAME" length="32" not-null="true" />
        </property>
        <property name="caseStatusDesc" type="string">
            <column name="CASE_STATUS_DESC" length="1000" not-null="true" />
        </property>
        <property name="createUser" type="string">
            <column name="CREATE_USER" length="32" not-null="true" />
        </property>
        <property name="createDt" type="timestamp">
            <column name="CREATE_DT" length="7" not-null="true" />
        </property>
        <property name="updateUser" type="string">
            <column name="UPDATE_USER" length="32" />
        </property>
        <property name="updateDt" type="timestamp">
            <column name="UPDATE_DT" length="7" />
        </property>
    </class>
</hibernate-mapping>



Full stack trace of any exception that occurs:
None -- No exceptions thrown

Name and version of the database you are using:
Oracle9i

The generated SQL (show_sql=true):
Hibernate: select refcasesta0_.CASE_STATUS_CODE as CASE1_0_, refcasesta0_.CASE_STATUS_NAME as CASE2_23_0_, refcasesta0_.CASE_STATUS_DESC as CASE3_23_0_, refcasesta0_.CREATE_USER as CREATE4_23_0_, refcasesta0_.CREATE_DT as CREATE5_23_0_, refcasesta0_.UPDATE_USER as UPDATE6_23_0_, refcasesta0_.UPDATE_DT as UPDATE7_23_0_ from ATFPSBADMIN.REF_CASE_STATUS refcasesta0_ where refcasesta0_.CASE_STATUS_CODE=?



Debug level Hibernate log excerpt:
Code:
2005-10-21 18:09:29,375 DEBUG [main] org.hibernate.event.def.DefaultLoadEventListener - loading entity: [x.to.RefCaseStatus#I]
2005-10-21 18:09:29,375 DEBUG [main] org.hibernate.event.def.DefaultLoadEventListener - attempting to resolve: [x.to.RefCaseStatus#I]
2005-10-21 18:09:29,375 DEBUG [main] org.hibernate.event.def.DefaultLoadEventListener - object not resolved in any cache: [x.to.RefCaseStatus#I]
2005-10-21 18:09:29,375 DEBUG [main] org.hibernate.persister.entity.BasicEntityPersister - Materializing entity: [x.to.RefCaseStatus#I]
2005-10-21 18:09:29,375 DEBUG [main] org.hibernate.loader.Loader - loading entity: [x.to.RefCaseStatus#I]
2005-10-21 18:09:29,375 DEBUG [main] org.hibernate.jdbc.AbstractBatcher - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
2005-10-21 18:09:29,375 DEBUG [main] org.hibernate.SQL - select refcasesta0_.CASE_STATUS_CODE as CASE1_0_, refcasesta0_.CASE_STATUS_NAME as CASE2_23_0_, refcasesta0_.CASE_STATUS_DESC as CASE3_23_0_, refcasesta0_.CREATE_USER as CREATE4_23_0_, refcasesta0_.CREATE_DT as CREATE5_23_0_, refcasesta0_.UPDATE_USER as UPDATE6_23_0_, refcasesta0_.UPDATE_DT as UPDATE7_23_0_ from ATFPSBADMIN.REF_CASE_STATUS refcasesta0_ where refcasesta0_.CASE_STATUS_CODE=?
2005-10-21 18:09:29,375 DEBUG [main] org.hibernate.jdbc.AbstractBatcher - preparing statement
2005-10-21 18:09:29,390 DEBUG [main] org.hibernate.type.StringType - binding 'I' to parameter: 1
2005-10-21 18:09:29,390 DEBUG [main] org.hibernate.jdbc.AbstractBatcher - about to open ResultSet (open ResultSets: 0, globally: 0)
2005-10-21 18:09:29,390 DEBUG [main] org.hibernate.loader.Loader - processing result set
2005-10-21 18:09:29,390 DEBUG [main] org.hibernate.loader.Loader - done processing result set (0 rows)
2005-10-21 18:09:29,390 DEBUG [main] org.hibernate.jdbc.AbstractBatcher - about to close ResultSet (open ResultSets: 1, globally: 1)
2005-10-21 18:09:29,390 DEBUG [main] org.hibernate.jdbc.AbstractBatcher - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
2005-10-21 18:09:29,390 DEBUG [main] org.hibernate.jdbc.AbstractBatcher - closing statement
2005-10-21 18:09:29,390 DEBUG [main] org.hibernate.loader.Loader - total objects hydrated: 0
2005-10-21 18:09:29,390 DEBUG [main] org.hibernate.engine.PersistenceContext - initializing non-lazy collections
2005-10-21 18:09:29,390 DEBUG [main] org.hibernate.loader.Loader - done entity load


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 21, 2005 6:48 pm 
Newbie

Joined: Wed Oct 12, 2005 3:59 pm
Posts: 12
I discovered that the field I was binding to was a CHAR field of length 2... so I expect that the value would have had to be ' I' and not 'I'. For now I've changed the type to VARCHAR2 to support single and two characters, but I'll test the theory further.


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