Hi all,
I am writing a JAX-RS application that will take inputs that are validated
by Bean Validation (JSR 349). As these inputs eventually will wind up in
the database, I thought it would be nice to use the column definitions from
my jOOQ generated classes to validate them. Before I start rolling my own,
I thought I'd ask if anybody here has dealt with something like this?
public class SomeResource {
DSLContext config;
@POST
public void storeSomething(@Valid MyJsonClass input) { // <-- this is
where the magic happens
InputRecord dbRecord = input.toJooq(); // InputRecord is a jOOQ
generated class
// business logic here ...
if (ok) {
dbRecord.attach(config);
dbRecord.insert();
}
}
}
public class MyJsonClass {
@NotBlank
@Length(max=INPUT.VALUE.getDataType().length()) // <-- this can't work,
need to think of something better
private final String value;
@JsonCreator
public MyJsonClass(@JsonProperty("value") String value) {
this.value = value;
}
// .. getter and toJooq methods omitted for readatility
}
(I'm using DropWizard, but I don't think it matters for this)
Groeten,
Friso
--
You received this message because you are subscribed to the Google Groups "jOOQ
User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.