Hi Andrea,

> I want to use a beans who maps a table on a relational db which haS a
> primary key composed by two colomns of this table, or eventually a column
of
> this table and a column which is a foreign key which point on another
table.
> This is may little problem; I don't understand if with JAWS I may do this,
> or I has to use a BMP.

We currently use BMP only and havn't touched JAWS yet, so I tried
a search in the JBoss docs, on the JAWS mailing list archive
and in the JBoss code. Neither in the docs nor in the archive I
could find a clear answer (though in the archive there are similar
questions -- unanswered :-( ).

In the code I found
(in org.jboss.ejb.plugins.jaws.jdbc.JDBCCreateEntityCommand) handling
for a 'composite key' while creating an EntityBean. So I assume
that JAWS is able to work with composite keys.

I think it works as follows: when you want to have a composite key
you must have a handmade primary key class, which must follow the
EJB spec 1.1 section 9.4.7.2 (and 9.2.9). Important is to have
each PK class field public and with the same name and type in
both, the PK class and the bean. In ejb-jar.xml do NOT
fill in the primkey-field element of the deployment descriptor,
but the FILL in the prim-key-class element.

The rest should be handled automatically by JAWS.

regards

Georg
 ___   ___
| + | |__    Georg Rehfeld      Woltmanstr. 12     20097 Hamburg
|_|_\ |___   [EMAIL PROTECTED]           +49 (40) 23 53 27 10



_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to