Announcement Announcement Module
No announcement yet.
Automatic Bean Validation in Roo Entities Problem Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Automatic Bean Validation in Roo Entities Problem


    I read this article ( and find that, in session "Using bean validation in Roo entities" the author says that "...Spring Roo supports automatic validation of Roo Entities, if annotated with Bean Validation annotations. The Roo entities are automatically validated when a persist or merge method call is executed...".

    My question is what should I do to enable this feature? I have trying the example in the article, but the entity I create doesn't get validation invoked when I call its persist() method.

    I saw the ITD generated by Roo for the entity and can't see any code that could invoke the bean validation mechanism (no @PrePersist method, no Validator creation, and so on..).

    Does Roo really automatic validate roo entities when Entity.persist() method is called?

    Here is a sample code that I'm using to verify this feature.

    public class User {
           private String name
    @RooIntegrationTest(entity = User.class, count=false, merge=false, findEntries=false, flush=false, persist=false)
    public class UserIntegrationTest {
        public void testPersist_NullName() {
        	User u = new User();
        	try {
"persisted - null name");
    	} catch (ConstraintViolationException e) {
               //JSR 303 validation exceptions expected
    I'm using roo 1.1.4-RELEASE. The above test fails.

    Any Help?