I'm creating an enterprise application using EJB 2.0, CMP 2.0, MySql and WebLogic 8.11. I'm using JBuilder 2005 as an IDE.

I've created a cmr relationship between a local entity bean "Category" and "Product". It is a one-to-one relationship. The field for connecting the two beans is categoryId, which is the primary key in Category and just a normal field in Product (but is going to be used as a foreign key).

They way I created the beans, was to import the database schema into JBuilder, marked the following tables I wanted to use, and clicked “create cmp 2.0 entity bean”. It then creates all the code including interfaces and xml.

When setting up this in JBuilder, everything seems to be ok. But when I try to compile the project, I get this message:

"WebShopEar.jar": Role 'CategoryRelationshipRole' of relationship 'product-category' contains an invalid key-column value of 'category_id'. The key-column must specify a primary key column in the related bean. However, there is no primary key column named 'category_id' defined in the related bean 'Product' or else 'category_id' is not being recognized due to case mismatch.

From weblogic-cmp-rdbms-jar:


From ejb-jar:


Description of the tables

Field Type Null Key Default Extra
product_id int(11) PRI 0
product_name varchar(50) YES NULL
price double(6,2) YES NULL
category_id int(6) YES NULL
product_code varchar(20) YES NULL

Field Type Null Key Default Extra
category_id int(6) PRI 0
category_name varchar(50) YES NULL

CMR fields from the product bean:
public abstract void setCategory(Category category);
public abstract Category getCategory();

CMP fields for categoryId from the product bean:
 public abstract void setCategoryId(String categoryId);
 public abstract String getCategoryId();

CMP fields for categoryId from the category bean:
public abstract void setCategoryId(String categoryId);
public abstract String getCategoryId();

Appreciate all help!