-
1. Re: Nasty bug with JBoss 2.4
nuanda Sep 14, 2001 3:28 AM (in response to nuanda)My apologies!! Apparently this is me mis-understanding the EJB spec. Scott Stark informs me that a programmer is entirely responsible for setting all state of an EJB in ejbCreate(), instance variables may contain any data when ejbCreate() is called.
This causes a slight problem for our code as we have 'dateFrom', 'dateTo' style instance vars. In ejbCreate we call 'setDateFrom' and 'setDateTo' accessors to take advantage of the parameter validation checks in those set methods.
We had coded them to ensure that if dateTo was not null then it should only occur after dateFrom. The problem with dirty data hanging around meant that when calling setDateFrom in ejbCreate it was occasionally throwing an IllegalParamEx because dateTo was not null, given that it contained old state hanging around from the previous bean instance that happened to be before dateFrom.
I assume we will have to do:
this.dateTo = null;
this.dateFrom = null;
...kind of code right at the start of ejbCreate to clean up hang-over data.
Seems a little ick, but what're you gonna do ;-)