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: Invalid parameter number error when trying to save a record
PostPosted: Fri Sep 11, 2009 2:25 pm 
Newbie

Joined: Tue Jul 07, 2009 1:48 pm
Posts: 3
Hi,

I have a composite primary key for a DB2 table. So, I have the following java classes with Hibernate annotations:

@Entity
@IdClass(LocationModelPK.class)
@Table(name = "T074AT63")
LocationModel.java {
private LocationModelPK idPK;

private String organization;
private String ccpl;
private String processArea;

@Column(name = "CLM_INVT_LOC_CODE", nullable = false, length = 3)
private String inventoryLocation;

@Column(name = "SCY_RCP_LGN_ID", nullable = false, length = 8)
private String userId;

@Column(name = "RCD_MNT_TSP_GRP", nullable = false, length = 26)
private Timestamp lastUpdate;

public Object getId() {
return this.idPK;
}

...... getters and setters for these attributes, equals() and hashCode()
}

@Embeddable
LocationModelPK.java {
@Column(name = "CLM_PCS_ORG_CODE", nullable = false, length = 6)
private String organization;

@Column(name = "CLM_PCS_LOC_CODE", nullable = false, length = 3)
private String ccpl;

@Column(name = "CLM_PCS_ARA_CODE", nullable = false, length = 4)
private String processArea;

public Object getId() {
return null;
}

....... getters and setters, equals() and hashCode()
}

When I try to save a record for this model class to the database (DB2 V8 with a Type 2 Driver), I get the following error :

COM.ibm.db2.jdbc.DB2Exception: [IBM][JDBC Driver] CLI0612E Invalid parameter number. SQLSTATE=S1093
at COM.ibm.db2.jdbc.app.SQLExceptionGenerator.throwParamIndexError(SQLExceptionGenerator.java:620)
at COM.ibm.db2.jdbc.app.DB2PreparedStatement.setNull(DB2PreparedStatement.java:2258)
at com.ibm.ws.rsadapter.jdbc.WSJdbcPreparedStatement.setNull(WSJdbcPreparedStatement.java:1485)


I think it is trying to pick up "idPK" as an attribute to be saved along with the other attributes.

Any help is greatly appreciated.

Regards,
Yogesh


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.