Mohammed Khaffar wrote:
> Thanks for your replies. Now my understading is that you
> CANNOT use a CMR field a part of a primary key. It may not be
> directly against the EJB 2.0 specs, however, it specifies
> that the "Primary Key may only be set once in ejbCreate(...)"
> So any any attempt set the PK or any part of the PK outside
> ejbCreate(...) throws an exception.
>
> I had thought what exactly David has suggested. When I tried
> a similar example, JBoss threw an exception when I tried to
> set the CMR field in ejbPostCreate(...). In David's example,
> an exception would be thrown in AddressEJB at:
>
> public void ejbPostCreate ( UserLocal user, Integer typeCode, ... )
> {
> setUser(user);
> }
>
> So in conlcusion, I think, a CMR filed cannot be used as a PK.
If the CMR field will be written only once when the bean is created, I
have another idea.
Instead of mapping the duplicate userId CMP field to the same column as
the user CMR field, map it to a new duplicate column. The rest of the
example should work as is. You return a new PK in ejbCreate using userId
and typeCode and set the CMR in ejbPostCreate. As the CMR is neither
part of the PK nor physically linked to the PK-CMP field, this last step
should no longer throw an exception.
Peace
--
David Harkness
Sr. Software Engineer
Sony Pictures Digital Networks
(310) 482-4756
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id56&alloc_id438&op=click
_______________________________________________
xdoclet-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-user