I have some understanding of how spring does transactions. Roo is using the aspectj mode. Either way though the cut points are before and after the method, so I don't think there's problem catching an exception within a method marked as @Transactional. And in fact it WAS working. The problem is that surefire was simply not saving off my debug println's. I updated the pom.xml and it created output files with my debug statements.
Code:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.7.2</version>
<configuration>
<printSummary>false</printSummary>
<redirectTestOutputToFile>true</redirectTestOutputToFile>
<excludes>
<exclude>**/*_Roo_*</exclude>
</excludes>
</configuration>
</plugin>
Once I was able to see the output I got a much clearer and more informative error.
Code:
ConstraintDescriptor: ConstraintDescriptorImpl{annotation=org.hibernate.validator.constraints.Email, payloads=[], hasComposingConstraints=true, isReportAsSingleInvalidConstraint=false, elementType=FIELD, definedOn=DEFINED_LOCALLY, groups=[interface javax.validation.groups.Default], attributes={message={org.hibernate.validator.constraints.Email.message}, payload=[Ljava.lang.Class;@500b2175, groups=[Ljava.lang.Class;@ac1b161}}
Message: not a well-formed email address
Invalid value: Email_0
1) Why is DOD not looking at the constraints and generating output that meets the constraint? I understand that roo cannot support all constraints, but why not warn the user during DOD generation that the constraint is unknown and LIKELY to fail validation.
2) Why is surefire not setup to generate output files by default. Once someone knows what they're doing and wants to save disk space and gain performance they can turn it off?
3) Why not somewhere somehow inspect the constraint violations automatically during tests generated by roo? This just seems a very fundamental of an issue to me.