aspose file tools*
The moose likes Object Relational Mapping and the fly likes Hibernate exception - could not insert Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Hibernate exception - could not insert" Watch "Hibernate exception - could not insert" New topic
Author

Hibernate exception - could not insert

Gundeti Reddy
Greenhorn

Joined: Jun 28, 2008
Posts: 6
Hi all, I am getting below exception when i am trying to insert the data.
I am getting this exception only in some scenarios. I could not find out the reason. please help me. here i am posting the exception and my mapping file and the way i am using it in the code.
Mapping file is::

composite-id name="commentsId" class="com.i21.epay.model.CommentsPK">
<key-property name="partitionId" column="PARTITION_ID" type="int"/>
<key-property name="assetId" column="ASSET_ID" type="long"/>
<key-property name="commSeqNum" column="COMM_SEQ_NUM" type="short"/>
</composite-id>
<property
name="commentTypeCd"
type="java.lang.String"
column="COMMENT_TYPE_CD"
length="4"
not-null="true"
/>
<property
name="commentCd"
type="java.lang.String"
column="COMMENT_CD"
length="4"
not-null="true"
/>

<property
name="dataValue"
type="java.lang.String"
column="DATA_VALUE"
length="20"
/>
<property
name="createdTs"
type="java.sql.Timestamp"
column="CREATED_TS"
not-null="true"
length="26"
/>


Code that i am using is:


Type types[] = { Hibernate.INTEGER, Hibernate.LONG };
Object values[] = { new Integer(partitionId), new Long(assetId)};
list = getObjs( "select max({c}.commentsId.commSeqNum) from

Comments {c} " + " where {c}.commentsId.partitionId = ? and {c}.commentsId.assetId = ? ", value,types);


The Exception i am getting is::


27 Jun 2008 01:35:23 WARN [ORB.thread.pool : 0] net.sf.hibernate.util.JDBCExceptionReporter - SQL Error: -302, SQLState: 22001
27 Jun 2008 01:35:27 ERROR [ORB.thread.pool : 0] net.sf.hibernate.util.JDBCExceptionReporter - THE VALUE OF INPUT VARIABLE OR PARAMETER NUMBER 2 IS INVALID OR TOO LARGE FOR THE TARGET COLUMN OR THE TARGET VALUE
27 Jun 2008 01:35:27 ERROR [ORB.thread.pool : 0] net.sf.hibernate.util.JDBCExceptionReporter - could not insert: [com.i21.epay.model.CreditCardInfo#com.i21.epay.model.FinancialAccountInfoPK@328a328a[partitionId=243300,assetId=2000433,assetSeqNum=1]]
com.ibm.db2.jcc.c.SqlException: THE VALUE OF INPUT VARIABLE OR PARAMETER NUMBER 2 IS INVALID OR TOO LARGE FOR THE TARGET COLUMN OR THE TARGET VALUE
at com.ibm.db2.jcc.c.yc.d(yc.java:1257)
at com.ibm.db2.jcc.a.db.l(db.java:365)
at com.ibm.db2.jcc.a.db.a(db.java:63)
at com.ibm.db2.jcc.a.r.a(r.java:64)
at com.ibm.db2.jcc.a.tb.c(tb.java:266)
at com.ibm.db2.jcc.c.zc.W(zc.java:1700)
at com.ibm.db2.jcc.c.zc.d(zc.java:2258)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Hibernate exception - could not insert
 
Similar Threads
hibernate many to one question
Could not read the data
Not able to find the added record in table.
Problem when delete 1 record in ROOM table
Hibernate3.0 with DB2 8.1.3UDB - org.hibernate.exception. SQLGrammarException