Hi!

Luis Ochoa wrote:
> Newbie here, so bear with me.
> I have successfully put together a system consisting of 2 Entity and 1
> session. Stuff was working great, I created a few entities, all good, but
> after a little while, I created this one entity, and just filled in a few of
> the fields. When I looked in the database (Oracle), to my horror, the bean
> row had been created with the fields I had specified, but the rest of the
> fields I hadn't, contained OLD data from a previous creation!!
> 
> Of course I don't want this to happen, so my question is:
> 
> Is this normal behavior?

Yes.

> if so, how can I avoid it? 

Either
* set pool size to 0 (zero). This will cause new instances to be caused
all the time, hence avoiding "old" data to be used
* make sure you initiate all fields to proper values

Of course the latter is preferred since it allows the container to work
more efficiently. The first method is easy to use, but produces
unportable beans (as another container might not support setting pool
sizes). 

This is a very well documented effect of how EJB works. See the EJB
specification, especially the life cycle diagrams, for more details.

/Rickard



--
--------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
List Help?:          [EMAIL PROTECTED]

Reply via email to