cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bill Fan" <>
Subject Can not recognize the object passed in for the toOne relationship?
Date Fri, 21 Apr 2006 04:41:12 GMT

I'm trying to do something like the following and it seems the productId
becomes null in the generated sql query.

Price price = new Price();

The query generated was as following:
INSERT INTO dbo.Price (Description, GST, IsUnitPrice, Price, PriceId,
PriceTypeId, ProductId, Qty) VALUES (?, ?, ?, ?, ?, ?, ?, ?)
[bind: '1 box', 10, 'true', 100, 280, 1, NULL, 1]

I'm using Tomcat 5.0.28 + Spring 1.2.7 + Cayenne 1.1.4 + Struts 1.2.9

I can see and verify the productId value and the product name by placing the
following logging statements before the product object is used,
	Log.debug("product Id: " + product.getProductId());
	Log.debug("product Name: " + product.getProductName());

More details are as follow if it is required:
In the web app, there are a Product table and a Price table. It is a "one to
many" relation from Product to Price,

The tables:
Product table:
	proudctId int PK
	productName varchar(100)

Price table:
	priceId int PK,
	productId int FK (to Product.ProductId column)
	price double

Cayenne data map:
<db-relationship name="toProduct" source="Price" target="Product"
	<db-attribute-pair source="ProductId" target="ProductId"/>

<db-relationship name="priceArray" source="Product" target="Price"
		<db-attribute-pair source="ProductId" target="ProductId"/>

Many thanks in advance!

View raw message