hibernate-validator

How do I import javax.validation into my Java SE project?

I'm trying to add constraints checking, as described here http://stackoverflow.com/questions/2705759/how-to-specify-the-cardinality-of-a-onetomany-in-eclipselink-jpa ...

Locale based validation

Hi , My project have two main requirements 1) Different set of rules applied to same object at insertion and while updating it. 2) Different validation rules based on locale. In ADDRESS object STATE field requires different validation rules For USA: STATE cannot be NULL. For everywhere else it can be NULL. For first requirement i am...

User friendly validation messages during persist or update

Can you suggest good practices for information related to validation messages in the user interface. Assuming you have a the following tables (User, Address, Email) and we use JPA to model our entities and the underlying validation provider is Hibernate. The default messages which are throws when a value is empty or incorrect is either ...

Unable to locate Spring NamespaceHandler for XML schema namespace [http://jboss.org/xml/ns/javax/validation/configuration]

I am using spring 3, hibernate validator 4. My unit test is running fine. But i am getting this(see below) for my functional test, have i miss out some dependencies? Dependencies i had added for hibernate validator: validation-api-1.0.0.GA.jar hibernate-validator-4.0.2.GA.jar Here's my the content of validation.xml: <?xml version="...

hibernate validator

Hi, I'd like to use hibernate (orm) together with hibernate validator. Within the documentation we can find the following: Out of the box, Hibernate Annotations (as of Hibernate 3.5.x) will translate the constraints you have defined for your entities into mapping metadata. For example, if a property of your entity is annot...

[Spring 3] Autowiring a service into a validator

This example is a bit contrived; I've simplified it to remove extraneous details and to focus on the problem I am having. I have a validator that looks like this: @Component public class UniqueUsernameValidator implements ConstraintValidator<UniqueUsername, String> { @Autowired UsernameService usernameService; @Override ...

Stop Hibernate from creating not-null constraints

Is there a way to stop Hibernate from creating not-null constraints for properties annotated with @javax.validation.constraints.NotNull when using hbm2ddl = create? ...

How can I apply a @NotNull constraint to all fields in a class using javax.validation?

I'm using the hibernate implementation of the javax.validation and would like to know how whether anyone has been able to apply the @NotNull constraint annotation to all fields of a class, rather than to each individual field? I would prefer to enforce the @NotNull constraint as a default across my project, to avoid littering the code w...

A better way to skip over javax.validation and org.hibernate compound-constraints

I have the following method that recursively breaks down a compound constraint into its component constraints: private void handleComposingConstraints(String friendlyName, Constraint parentConstraint, ConstraintDescriptor<? extends Annotation> parentDescriptor) { if(parentDescriptor.getAnnotation().annotationType().getName().indexO...

nested Annotation List in Scala

Help, how do i do stuff like the following in Scala? import org.hibernate.validator.constraints.ScriptAssert @ScriptAssert.List({ @ScriptAssert(script = "...", lang = "javascript"), @ScriptAssert(script = "...", lang = "javascript")}) ...

Different Hibernate validation annotations on same property

Greetings all i am using two validation annotations on a property in the bean @NotEmpty(message = "{name.required}") @Pattern(regex = "^([A-Za-z0-9]{2,}(\\-[a-zA-Z0-9])?)$", message = "{invalid.name}") private String name; if i left the name empty i got the two errors and i want only the first error message (if the first condition occ...

javax.validation.ValidationException: Unable to find default provider

Hi there, I am currently working on Spring MVC web app and trying to hook up validation using the @Valid annotation. When I fire up the application I'm getting the following exception: javax.validation.ValidationException: Unable to find a default provider I have Hibernate Validator 3.1.0.GA on the classpath as well as javax validat...

Try to use hibernate 3.4 in JBoss 5.1 but gets javax.validation.ValidationException: Unable to find a default provider

I've come across some problems using Hibernate 3.4 on JBoss 5.1. Hibernate 3.4 is a JPA 1.0 implementation so it should be fine to be used in JBoss 5.1. The thing is JBoss has its own version of Hibernate, which is located at /common/lib whereas I don't want to use the version provided by JBoss. What I did was that I removed the hibernat...