What is the proper way to add logic to CMP data accessor methods?

Suppose I want to make a CMP in which setName() throws an exception if the name 
doesn't have at least eight characters.

I have been doing this:

/* In local interface */
public void setName(String name) throws ValidationException {
        if (name.length() < 8) {
                throw new ValidationException("name", "Name must have at least eight 
characters");
        }
        setSb_Name(name);
}

/* not in any interfaces */
public abstract void setSb_name(String name);

The biggest problem with this is that in EJBQL I now have to use o.sb_name to refer to 
the field.

Is there a better way to do this?

Thanks,

JWS

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