I have a product table with product_id and product_name with product_id as auto_increment. I can able to add the product successfully.
Then I have created a table product_key with pk_id, pk_key and product_id. pk_id as auto_increment and product_id as foreign key.
I have configured the relationship in both ejb.jar.xml and jbosscmp-jdbc.xml as given below:
What I am trying to do is:
1. User inputting the product name and the key in the form.
2. In struts action, I am retrieving the form values.
3. In struts action, I am getting the Remote Session bean from JNDI.
4. In session bean, first I am getting the Product, by passing the product name to findByName.
5. In session bean, then I am trying to insert a productkey in productkey table.
6. In session bean, then I am trying to set the product to productkey.
But I am getting the following error:
My ProductKey ejbCreate is having only one argument for key. Since id is auto_increment and product_id is foreign, I didn't included it in the ejbCreate
But in the debug log, how the insert query has product_id too?
<!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise
JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">