-->
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: hibernate binds parameter with incorrect values in 2.0.3?
PostPosted: Thu Sep 30, 2004 3:30 pm 
Newbie

Joined: Mon Jun 21, 2004 12:58 pm
Posts: 15
This seemed a bit strange.
I have Ac with a set of Div which has a set of Org.
The length of Ac_code is 1 and Div_code is 3.
All i'm trying to do is traverse through all the list from ac to org.
Ac to Div list comes up fine but from Div to Org its trying to switch the values for the Div code and the Ac code when it tries to fetch the records for Org.

What i see from log is, its trying to assign the value of Div_code to Ac_code parameter and vice versa and is rightly blowing up with the db2 exception saying the value is too large.
Is it a known issue in 2.0.3?

Hibernate version:
2.0.3

Mapping documents:

---------------- AC mapping ---------------------

<class
name="Accomponent"
table="ACMPNT"
>

<id
name="acomCode"
type="java.lang.String"
column="ACOM_CD"
length="1"
>
<generator class="assigned" />
</id>


<set
name="divisions"
lazy="true"
inverse="true"
>
<key>
<column name="ACOM_CD" />
</key>
<one-to-many
class="Division"
/>
</set>

</class>

---------------- Division mapping ----------------
<class
name="Division"
table="DIV"
>

<composite-id name="divisionPK" class="DivisionPK">
<key-property
name="divCode"
column="DIV_CD"
type="java.lang.String"
length="3"
/>
<key-many-to-one
name="accomponent"
class="Accomponent"
>
<column name="ACOM_CD" />
</key-many-to-one>
</composite-id>

<set
name="orgs"
lazy="true"
inverse="true"
>
<key>
<column name="ACOM_CD" />
<column name="DIV_CD" />
</key>
<one-to-many
class="Org"
/>
</set>


--------- ORG mapping ----------------------

<class
name="Org"
table="ORG"
>

<composite-id name="orgPK" class="OrgPK">

<key-property
name="orgCode"
column="ORG_CD"
type="java.lang.String"
length="3"
/>
<key-many-to-one
name="division"
class="Division"
>
<column name="ACOM_CD" />
<column name="DIV_CD" />
</key-many-to-one>


</composite-id>



Name and version of the database you are using:
DB2 7.1


Hibernate log and exception:

DEBUG [15:20:01,035] [] [net.sf.hibernate.impl.SessionImpl:2888] - initializing collection [Accomponent.divisions#A]
DEBUG [15:20:01,055] [] [net.sf.hibernate.impl.BatcherImpl:166] - about to open: 0 open PreparedStatements, 0 open ResultSets
DEBUG [15:20:01,085] [] [net.sf.hibernate.impl.SessionFactoryImpl:526] - prepared statement get: select div0_.DIV_CD as DIV_CD__, div0_.ACOM_CD as ACOM_CD__, div0_.DIV_CD as DIV_CD, div0_.ACOM_CD as ACOM_CD, div0_.STDADMCD as STDADMCD, div0_.DIV_ACR as DIV_ACR, div0_.DIV_TITLE as DIV_TITLE from MRM.DIV div0_ where div0_.ACOM_CD=?
Hibernate: select div0_.DIV_CD as DIV_CD__, div0_.ACOM_CD as ACOM_CD__, div0_.DIV_CD as DIV_CD, div0_.ACOM_CD as ACOM_CD, div0_.STDADMCD as STDADMCD, div0_.DIV_ACR as DIV_ACR, div0_.DIV_TITLE as DIV_TITLE from MRM.DIV div0_ where div0_.ACOM_CD=?
DEBUG [15:20:01,125] [] [net.sf.hibernate.impl.SessionFactoryImpl:536] - preparing statement
DEBUG [15:20:01,155] [] [net.sf.hibernate.type.StringType:44] - binding 'A' to parameter: 1
DEBUG [15:20:01,235] [] [net.sf.hibernate.loader.Loader:148] - processing result set
DEBUG [15:20:01,255] [] [net.sf.hibernate.type.StringType:65] - returning '015' as column: DIV_CD
DEBUG [15:20:01,285] [] [net.sf.hibernate.type.StringType:65] - returning 'A' as column: ACOM_CD
DEBUG [15:20:01,316] [] [net.sf.hibernate.impl.SessionImpl:1752] - loading [Accomponent#A]
DEBUG [15:20:01,366] [] [net.sf.hibernate.impl.SessionImpl:1843] - attempting to resolve [Accomponent#A]
DEBUG [15:20:01,396] [] [net.sf.hibernate.impl.SessionImpl:1858] - resolved object in session cache [Accomponent#A]
DEBUG [15:20:01,456] [] [net.sf.hibernate.loader.Loader:260] - result row: DivisionPK@7344e2b6[divCode=015,accomponent=Accomponent@d5362b5[acomCode=A]]
DEBUG [15:20:01,486] [] [net.sf.hibernate.loader.Loader:357] - Initializing object from ResultSet: DivisionPK@7344e2b6[divCode=015,accomponent=Accomponent@d5362b5[acomCode=A]]
DEBUG [15:20:01,516] [] [net.sf.hibernate.loader.Loader:413] - Hydrating entity: Division#DivisionPK@7344e2b6[divCode=015,accomponent=Accomponent@d5362b5[acomCode=A]]
DEBUG [15:20:01,536] [] [net.sf.hibernate.type.StringType:65] - returning 'S4C ' as column: STDADMCD
DEBUG [15:20:01,566] [] [net.sf.hibernate.type.StringType:65] - returning 'DCS ' as column: DIV_ACR
DEBUG [15:20:01,606] [] [net.sf.hibernate.type.StringType:65] - returning 'Office of Deputy Commissioner Systems ' as column: DIV_TITLE
DEBUG [15:20:01,626] [] [net.sf.hibernate.type.StringType:65] - returning '015' as column: DIV_CD__
DEBUG [15:20:01,656] [] [net.sf.hibernate.type.StringType:65] - returning 'A' as column: ACOM_CD__
DEBUG [15:20:01,686] [] [net.sf.hibernate.impl.SessionImpl:1752] - loading [Accomponent#A]
DEBUG [15:20:01,726] [] [net.sf.hibernate.impl.SessionImpl:1843] - attempting to resolve [Accomponent#A]
DEBUG [15:20:01,766] [] [net.sf.hibernate.impl.SessionImpl:1858] - resolved object in session cache [Accomponent#A]
DEBUG [15:20:01,796] [] [net.sf.hibernate.impl.SessionImpl:1752] - loading [Division#DivisionPK@6631a2b6[divCode=015,accomponent=Accomponent@d5362b5[acomCode=A]]]
DEBUG [15:20:01,836] [] [net.sf.hibernate.impl.SessionImpl:1843] - attempting to resolve [Division#DivisionPK@6631a2b6[divCode=015,accomponent=Accomponent@d5362b5[acomCode=A]]]
DEBUG [15:20:01,866] [] [net.sf.hibernate.impl.SessionImpl:1858] - resolved object in session cache [Division#DivisionPK@6631a2b6[divCode=015,accomponent=Accomponent@d5362b5[acomCode=A]]]
DEBUG [15:20:01,896] [] [net.sf.hibernate.loader.Loader:182] - done processing result set (1 rows)
DEBUG [15:20:01,926] [] [net.sf.hibernate.impl.BatcherImpl:173] - done closing: 0 open PreparedStatements, 0 open ResultSets
DEBUG [15:20:01,946] [] [net.sf.hibernate.impl.SessionFactoryImpl:554] - closing statement
DEBUG [15:20:01,987] [] [net.sf.hibernate.loader.Loader:195] - total objects hydrated: 1
DEBUG [15:20:02,007] [] [net.sf.hibernate.impl.SessionImpl:1954] - resolving associations for [Division#DivisionPK@7344e2b6[divCode=015,accomponent=Accomponent@d5362b5[acomCode=A]]]
DEBUG [15:20:02,027] [] [net.sf.hibernate.impl.SessionImpl:1975] - done materializing entity [Division#DivisionPK@7344e2b6[divCode=015,accomponent=Accomponent@d5362b5[acomCode=A]]]
1 divisions
--> Office of Deputy Commissioner Systems
DEBUG [15:20:02,057] [] [net.sf.hibernate.impl.SessionImpl:2888] - initializing collection [Division.orgs#DivisionPK@7344e2b6[divCode=015,accomponent=Accomponent@d5362b5[acomCode=A]]]
DEBUG [15:20:02,087] [] [net.sf.hibernate.impl.BatcherImpl:166] - about to open: 0 open PreparedStatements, 0 open ResultSets
DEBUG [15:20:02,107] [] [net.sf.hibernate.impl.SessionFactoryImpl:526] - prepared statement get: select org0_.ORG_CD as ORG_CD__, org0_.ACOM_CD as ACOM_CD__, org0_.DIV_CD as DIV_CD__, org0_.ORG_CD as ORG_CD, org0_.ACOM_CD as ACOM_CD, org0_.DIV_CD as DIV_CD, org0_.ORG_ACR as ORG_ACR, org0_.ORG_TITLE as ORG_TITLE, org0_.STDADMCD as STDADMCD, org0_.HOME_CANUM as HOME_CANUM, org0_.CST_ANL_CD as CST_ANL_CD from MRM.ORG org0_ where org0_.ACOM_CD=? and org0_.DIV_CD=?
Hibernate: select org0_.ORG_CD as ORG_CD__, org0_.ACOM_CD as ACOM_CD__, org0_.DIV_CD as DIV_CD__, org0_.ORG_CD as ORG_CD, org0_.ACOM_CD as ACOM_CD, org0_.DIV_CD as DIV_CD, org0_.ORG_ACR as ORG_ACR, org0_.ORG_TITLE as ORG_TITLE, org0_.STDADMCD as STDADMCD, org0_.HOME_CANUM as HOME_CANUM, org0_.CST_ANL_CD as CST_ANL_CD from MRM.ORG org0_ where org0_.ACOM_CD=? and org0_.DIV_CD=?
DEBUG [15:20:02,137] [] [net.sf.hibernate.impl.SessionFactoryImpl:536] - preparing statement
DEBUG [15:20:02,157] [] [net.sf.hibernate.type.StringType:44] - binding '015' to parameter: 1
DEBUG [15:20:02,177] [] [net.sf.hibernate.type.StringType:44] - binding 'A' to parameter: 2


DEBUG [15:20:02,267] [] [net.sf.hibernate.util.JDBCExceptionReporter:36] - SQL Exception
COM.ibm.db2.jdbc.DB2Exception: [IBM][CLI Driver][DB2] SQL0302N The value of a host variable in the EXECUTE or OPEN statement is too large for its corresponding use. SQLSTATE=22001

at COM.ibm.db2.jdbc.app.SQLExceptionGenerator.throw_SQLException(Unknown Source)
at COM.ibm.db2.jdbc.app.SQLExceptionGenerator.throw_SQLException(Unknown Source)
at COM.ibm.db2.jdbc.app.SQLExceptionGenerator.check_return_code(Unknown Source)
at COM.ibm.db2.jdbc.app.DB2PreparedStatement.execute2(Unknown Source)
at COM.ibm.db2.jdbc.app.DB2PreparedStatement.executeQuery(Unknown Source)
at net.sf.hibernate.impl.BatcherImpl.getResultSet(BatcherImpl.java:71)
at net.sf.hibernate.loader.Loader.getResultSet(Loader.java:551)
at net.sf.hibernate.loader.Loader.doFind(Loader.java:140)
at net.sf.hibernate.loader.Loader.loadCollection(Loader.java:602)
at net.sf.hibernate.loader.OneToManyLoader.initialize(OneToManyLoader.java:102)
at net.sf.hibernate.impl.SessionImpl.initialize(SessionImpl.java:2897)
at net.sf.hibernate.collection.PersistentCollection.initialize(PersistentCollection.java:151)
at net.sf.hibernate.collection.PersistentCollection.read(PersistentCollection.java:64)
at net.sf.hibernate.collection.Set.size(Set.java:114)
at Tester.orgs(Tester.java:38)
at Tester.main(Tester.java:18)
WARN [15:20:02,307] [] [net.sf.hibernate.util.JDBCExceptionReporter:38] - SQL Error: -302, SQLState: 22001
ERROR [15:20:02,337] [] [net.sf.hibernate.util.JDBCExceptionReporter:46] - [IBM][CLI Driver][DB2] SQL0302N The value of a host variable in the EXECUTE or OPEN statement is too large for its corresponding use. SQLSTATE=22001

DEBUG [15:20:02,367] [] [net.sf.hibernate.impl.BatcherImpl:173] - done closing: 0 open PreparedStatements, 0 open ResultSets
DEBUG [15:20:02,397] [] [net.sf.hibernate.impl.SessionFactoryImpl:554] - closing statement


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.