• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Hibernate exception - could not insert

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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)
 
reply
    Bookmark Topic Watch Topic
  • New Topic