I have a hibernate entity with a @ManyToOne mapping to another entity.

public class Flight implements Serializable {

    @ManyToOne
    public Company getCompany() {
        return company;
    }
    ...
}

I successfully registered both a display and an edit block for this property
so it renders correctly in components like  t:Grid and t:BeanFormEditor.

Now, I'd like to add @Validate("required") to this entity - only it isn't
having any effect.

public class Flight implements Serializable {

    @Validate("required")
    @ManyToOne
    public Company getCompany() {
        return company;
    }
    ...
}

If I add this annotation to other String properties in that Entity, the
validation takes effect.

public class Flight implements Serializable {

    @Validate("required")
    public int flightNumber() { return flighNumber; }

    @ManyToOne
    public Company getCompany() {
        return company;
    }
    ...
}

I can create a t:form and manually validate this 'onSuccess' (
http://tapestry.apache.org/tapestry5/tapestry-core/ref/org/apache/tapestry5/corelib/components/Submit.html)
but I was wondering if this were possible to do with annotations (
http://tapestry.apache.org/tapestry5/tutorial1/forms.html)

Thanks,

-Luther

Reply via email to