You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@geronimo.apache.org by Mattias Malmgren <ma...@freefarm.se> on 2006/09/22 18:12:30 UTC

CMP EJB without primary key

Hi

This is perhaps out of topic, but I have a question about CMP and EJB and 
there seams to be some very experiensed EJB-programmers rading this list. 
Reading Suns j2ee tutorial it says that an EJB must have a primary key. I 
wonder if it is possible to have a EBJ that only have a foreign key. Eg a 
weight watchers system with person and weights att diffrent dates:

SQL:
create table person (id int primary key, name varchar(20))
create table weight(fk_person foreign key, date varchar(8), weight numeric)

Say that I have 2 entity EJBs, PersonEJB and WeightBean. The relationship 
is 1-n. Must the weight table also include a primary key to make CMP work, 
even though a primary key in this table from a SQL-point of view is 
unnessesary?

Best regards // Mattias
PS
I am proud to announce that I have got my first test case of a JSP page 
calling an EJB to work!
DS