That is spec compliant to not set the PK fields after the entity bean
exists.
We just avoid setting the PK in setData.
If you want en ejbCreate(AbcData data) it must looks like
{
   setPk(whatever)
   setData(data)
}

Vincent

----- Original Message -----
From: "Saul Farber" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, May 26, 2002 4:40 AM
Subject: [Xdoclet-user] setData method in generated CMP class doesn't set
"keyed" fields


> Hello all,
>
> Dude...xdoclet (particularly ejbdoclet) is great.  Already saved me ~20
> hours of mindnumbing ejb work.  Plus with the great docs was able to get
> generation up, running, reading and integrating into my ant tasks with
> very little ramp-up time.
>
> One problem, however, remains:
>
> When I generate the related "support" files (*CMP,*Data,*Home,*,*PK,
> etc) from the tagged *Bean.java files, the setData method which the
> *CMP.java file implements doesn't "set-the-data" for the fields (which
> correspond to the methods which) are marked as key fields.  I.e. if I
> have the following Bean file:
>
> public class...blah {
>
> /**
>  * @ejb:persistent-field
>  * @ejb:pk-field
>  *
> **/
> public abstract java.math.BigDecimal getPKField();
> <insert associated mutator here>
>
> /**
>  * @ejb:persistent-field
>  *
> **/
> public abstract java.math.BigDecimal getSomeValueField();
> <insert associated mutator here>
>
> }
>
> I wind up with a *CMP.java file whose setData method looks like this:
>
> public void setData( my.package.*Data dataHolder )
>    {
>       try
>       {
>          setSomeValueField( dataHolder.getSomeValueField() );
>
>          this.dataHolder = null;
>       }
>       catch (Exception e)
>       {
>          throw new javax.ejb.EJBException(e);
>       }
>    }
>
>
> which doesn't set the primary key field when ejbCreate is called!!  So I
> get sql exceptions which point this out, and feed me long stack-traces.
>
> Any pointers?  Should I include more information?  Or am I missing some
> "good design" practice that should remove this problem?
>
> thanks,
>
> saul
>
>
> _______________________________________________________________
>
> Don't miss the 2002 Sprint PCS Application Developer's Conference
> August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm
>
> _______________________________________________
> Xdoclet-user mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/xdoclet-user
>
>


_______________________________________________________________

Don't miss the 2002 Sprint PCS Application Developer's Conference
August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm

_______________________________________________
Xdoclet-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-user

Reply via email to