> From: A mailing list for Enterprise JavaBeans development
> [mailto:[EMAIL PROTECTED]]On Behalf Of Louth, William (Exchange)
> Basically the server uses Java reflection to inspect you entity beans when
> they are accessed within a transaction and only generates sql update
> statements when they have been updated. Some other containers use other
> means for telling has something changed. Some rely on you to write code to
> flag the change. Others use flags on the method call indicating the access
> is read only.
I would tend to conclude : the best containers offer you both.
It is indeed useful to be able to rely on the container to detect changea and
generate a SQL update only when needed, but the introspection code can only be
so smart. Nobody knows better than the programmer when a meaningful change has
been made, thus the importance of having the option to write a isModified()
method.
This is just an illustration of a more general methodology, particularly well
adapted to Java :
- rely on introspection performed by the container to prototype your
application and focus on its business logic
- replace introspection with hand-coded parts as you switch into production
mode
Some examples would be :
- use serialization, then switch progressively to externalization
- let the container checksum the bean to detect a change, then hand-code
isModified() methods where you know you can outsmart it
- use CMP, then switch progressively to BMP for a more optimized use of the
datastore
--
Cedric
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".