thank you for this link. This was the code I was looking for!
If I my ask you to help me getting the final part of the puzzle (the group validation) to work properly:
I have created my own Validation Group:
public interface PrePersitValidationGroup {}
In persistence.xml I have registered this group to be called only on pre-persist:
<property name="javax.persistence.validation.group.pre-persist" value="javax.validation.groups.Default, com.emajstor.server.persistence.validator.PrePersitValidationGroup" />
<property name="javax.persistence.validation.group.pre-update" value="javax.validation.groups.Default" />
<property name="javax.persistence.validation.group.pre-remove" value="javax.validation.groups.Default" />
In my Entity I have assigned my custom validator to be a part of this group:
@UniqueUserName(groups=PrePersitValidationGroup.class, message="Username is already in use! Please choose another user name.")
private String userName;
How do I say in my CustomServiceLayerDecorator to validate PrePersitValidationGroup on pre-persit only?
Or let say: How do I take the settings from the persistence.xml into account?
class CustomServiceLayerDecorator extends ServiceLayerDecorator {
@Override
public <T> Set<ConstraintViolation<T>> validate(T domainObject) {
return jsr303Validator.validate(domainObject, PrePersitValidationGroup.class);
}
}
Thank you in advance for your help!
Best regards:
Nermin
Am Donnerstag, 1. August 2013 13:53:38 UTC+2 schrieb Jens:
Take a look at ReflectiveServiceLayer used by GWT:---- J.
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.
No comments:
Post a Comment