Chris,

I have been using a simple naming strategy to deal with this.

Let's say your remote (or local) interface will have a method:

    void setName(String name)
    {
        // apply validation rules
        setNameField(name);
    }

Then your cmp-field can be "nameField".

Chris Harris wrote:

> I'm trying to sort out an issue with using CMP 2.0 entity
> beans. It's a hypothetical question right now since I'm not
> using CMP 2.0, but I am using a similar approach with
> EJBDoclet and CMP 1.1
>
> I'm starting from the assumption that in EJB 2.0, CMP
> entity beans are implemented by specifing an abstract base
> class containing abstract get/set methods for the beans
> properties. The container generates a concrete class (or
> some other approach) to do the handling of persistence.
>
> 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? Does this mean I am reduced to putting a session
> bean in front of the entities and putting my validation
> there (ugly)?
>
> (or am I being stupid and missing something in the spec?
> I'm looking at $10.3.1 in PFD2)
>
> As a side note, this presumably implies that value object
> creation cannot now be done by tools such as EJBDoclet
> since there is no code allowed in CMP accessor methods?
>
> I've looked for answers on forums/lists etc but couldn't
> find anything.
>
> Chris Harris
>
> __________________________________________________
> Do You Yahoo!?
> Make international calls for as low as $.04/minute with Yahoo! Messenger
> http://phonecard.yahoo.com/
>
> ===========================================================================
> 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".

===========================================================================
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