If I want to use CMP2.0 (uni-directional; 1:n), and I have:
CREATE TABLE Product(
productId INT NOT NULL,
PRIMARY KEY (productId));
CREATE TABLE ProductDetails(
locale VARCHAR(15) NOT NULL,
productId INT NOT NULL,
FOREIGN KEY (productId) REFERENCES Product (productId),
PRIMARY KEY (locale,productId));
A collection of ProductDetails beans can be obtained by my Product bean (i.e. my ProductDetails bean doesn't have a property namely productId, but Product has a method namely getProductDetails())
Since my ProductDetails bean doesn't have the productId property (not CMP), how may I include productId in my ProductDetailsPK class, so that I can allow multiple locales for each product (but not multiple locales for all products)
--
Another question:
If i remove all ProductDetails using:
for (Iterator i = product.getProductDetails().iterator(); i.hasNext() { i.remove(); }
I cannot remove the ProductDetails records in the database; JBoss sets all ProductDetails.productId to 0. How may I delete the record?
You can't yet. It is on the list of features.