db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Amit Rana" <r...@solis.jp>
Subject question on getPrimaryKey() method of BasePeer
Date Tue, 21 Oct 2003 01:54:24 GMT
Hi,

	I am getting a ClassCastException while creating a new row in a
table. I have posted a question regarding same in the user list. In
order to solve it quickly I am trying to look in the torque code and
have some questions. It would be great if someone can help me understand
this.

	In BasePeer's doInsert method - 
public static ObjectKey doInsert(Criteria criteria, Connection con)
throws TorqueException
	We retrieve primary key using the following line
ColumnMap pk = getPrimaryKey(criteria);

	Is this the right way to do it? What if a table has a composite
key?

Moreover doInsert returns the value of primary key after inserting and
it always returns a single value. Is that correct? I think this is the
reason for me getting a ClassCastException in table's Peer's
setPrimaryKey() method. BasePeer returns a single key but setPrimaryKey
is expecting an array.

	I am not very knowledgeable in the Torque code, so can anyone
advice if I am doing something wrong or how can I fix this.

Regards,
Amit.

My table definition.
<table name="SC_COMMON_ORDERS">
	<column name="id" required="true" primaryKey="true"
autoIncrement="true" type="INTEGER"/>
	<column name="line_number" required="true" primaryKey="true"
default="1" type="INTEGER"/>
	---other columns
</table>


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org


Mime
View raw message