I am not certain about Jim's example. However, we use this style of code to
null out "transient" fields that get filled in during the use of an entity
bean. The problem is that these fields are not "cleared" between passivation
and re-activation. Thus, you can have fields with invalid values from a pervious
incantation of the bean. Clearing these fields solves that problem.
tim.
> I just read Arhcer's Test20Cmp example (posted on this list earlier on). I
> am unaware of the need for the initToNull() method (see below); does anyone
> know why its there - its is repeated in the later examples aswell.
>
> Well, I know at least one guy who knows... but if anyone else but Jim
> himself knows, you are of course also very welcome to reply ;-). Thanks.
>
>
> Randahl
>
>
>
> public String ejbCreate() {
> trace("ejbCreate() entered");
>
> initToNull();
>
> setUserId("jarcher");
> setFirstName("Jim");
> setLastName("Archer");
> setEmail("[EMAIL PROTECTED]");
>
> trace("ejbCreate() exiting");
>
> // In CMP, should return null.
> return null;
> }
>
>
> // ------------------------------------------------------------
> private void initToNull()
> {
> trace("initToNull() entered");
>
> setUserId(null);
> setFirstName(null);
> setLastName(null);
> setEmail(null);
>
> trace("initToNull() exiting");
> }
>
>