field « Validation « JPA Q&A

1. hibernate validator for cross field validation

I have a question about hibernate validator:

class A
  private String a;
  private String b;
String a and b can either be null but can't both be null. How can I ...

2. JPA: Own Annotation to bundle annotations for fields with same value

I'm wondering how to write my own Annotation for fields which have the same annotations. For example: old class:

public class XXXEntity {

@Size(max = 100)  ...

3. Hibernate uniqueness Fields

I have a class called Iteraction this iteration have many fields in special i want do a validation of uniqueness for three fields together (startDate, endDate and Project), Project is a ...

5. Validation acrros Multiple fields

Hi, I have quite a simple issue: One entity (let's name it History) has 2 fields: Date validFrom; Date validTo; I want to ensure that validTo is [u]after[/u] validFrom. My first idea was to define my own field validator that I put on validTo but I can only access the value from the property itself, thus not possible to inspect validFrom... ...