Karsten Jahn wrote:
>[Rupp, Heiko wrote:]
>> If you have a one field-pk, then use
>> 
>> /**
>>  * @ejb.bean primkey="bar"
>>  */
>> class foo {
>> 
>>   Object getBar();
>
> Not really...
> 
> The PK is unknown (generated by MySQL / JBoss). Working with
> an unknownPK the ClassTag has to be like this:
>  * @ejb.pk class = "java.lang.Object"

You only need to do that to tell XDoclet your PK class in the case of a
multi-field PK, IIRC. While I use Integer for my PKs, Object should work
exactly the same (as Heiko's example shows):

  /** @ejb.bean
   *       primkey-field="id"
   */
  public class User ... {
    ...
    public abstract Object getId();

primkey-field tells XDoclet that your PK is a single attribute. XDoclet
uses the type of that attribute as the PK class in the deployment
descriptor. JBoss then uses its own subclass of Object which XDoclet
never knows nor cares about.

> But, well, I don't want that standard class to be overwritten... 

No worries -- just hack java.lang.Object to be final and you're all set!
;)

David Harkness
Sr. Software Engineer
Sony Pictures Digital Networks
(310) 482-4756


-------------------------------------------------------
This SF.net email is sponsored by: The Robotic Monkeys at ThinkGeek
For a limited time only, get FREE Ground shipping on all orders of $35
or more. Hurry up and shop folks, this offer expires April 30th!
http://www.thinkgeek.com/freeshipping/?cpg297
_______________________________________________
xdoclet-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-user

Reply via email to