geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mattias Malmgren <>
Subject CMP EJB without primary key
Date Fri, 22 Sep 2006 16:12:30 GMT

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:

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 

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

View raw message