Bottomline, I'm using Grails 1.3.7 and using JPA annotated classes from a JAR file, But the constraints are not working, meaning they are ignored even if I explicitly code them, like usual in the domain classes,
Is there a way I can get the constrain开发者_如何学Cts working?
@Don
1.- JPA classes are .java inside a jar file, I've created Grails Domain classes using this .java classes by just using the grails create-domain-class and using the corresponding package to the .java, so the outcome result in the grail project is
Domain \ com.myapp.Clazz.groovy \
package com.myapp.Clazz class Clazz {
}
Later, I tried to add a Constraint.groovy file to the src/java folder with my constraints, as specified in the following article: Reuse your hibernate/jpa
But when I tried to run the app the compiler gets into an infinte cycle and never finish to compile the project..
Grails documentation here says, that if you annotate your class with @Validateable
and provide a static constraints block inside class and register its package in Config.groovy, you will be able to validate this class as usual.
精彩评论