> From: A mailing list for Enterprise JavaBeans development
> [mailto:[EMAIL PROTECTED]]On Behalf Of Chris Harris

> My question is this: since these methods are abstract, how
> can I validate input coming in via a setXXX() method? Does
> this approach mean I can no longer put logic in my entity
> beans?

Correct.  The EJB 2.0 specification doesn't discuss any kind of interceptors for
EJB's, which seems to be what you are looking for.

Since relationships are exposed through local interfaces, you will have to use
some kind of value objects to exchange values with a remote client, so
performing your validation logic on this tier might make sense.

EJBGen 1.20 (http://beust.com/cedric/ejbgen) will generate value objects for you
automatically.  As of today, they are fairly simple (simple JavaBeans with
getters/setters for all CMP/CMR fields) but I am considering adding some
convenience methods such as a constructor from a local object.  Giving the user
the possibility to add pre and post conditions to the setters is an interesting
idea, I'll think about it.

> Does this mean I am reduced to putting a session
> bean in front of the entities and putting my validation
> there (ugly)?

Not necessarily, see above.

--
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".

Reply via email to