Peter Walser (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
) *commented* on HV-1928 (
https://hibernate.atlassian.net/browse/HV-1928?atlOrigin=eyJpIjoiMTA4MTA4...
)
Re: Bad validator performance when adding obsolete @Validated to Java value objects (
https://hibernate.atlassian.net/browse/HV-1928?atlOrigin=eyJpIjoiMTA4MTA4...
)
When I wrap the values into value objects (with @Valid), the validation runs very fast
(although it supposedly does the same: recurse into values with @Valid and validate with
@NotNull and @Min ):
public class Item {
private Id id;
private Quantity quantity;
public @Valid Id getId() { return id; }
public void setId(Id id) { this.id = id; }
public @Valid Quantity getQuantity() { return quantity; }
public void setQuantity(Quantity quantity) { this.quantity = quantity; }
public static class Id {
private Long id;
public @NotNull Long getId() { return id; }
public void setId(Long id) { this.id = id; }
}
public static class Quantity {
private int quantity;
public @Min(1) int getQuantity() { return quantity; }
public void setQuantity(int quantity) { this.quantity = quantity; }
}
}
0 items, avg. validation time: 49.520402 ms
1 items, avg. validation time: 50.609528 ms
2 items, avg. validation time: 50.88673 ms
5 items, avg. validation time: 50.236684 ms
10 items, avg. validation time: 49.789304 ms
20 items, avg. validation time: 48.713483 ms
50 items, avg. validation time: 50.069192 ms
100 items, avg. validation time: 50.027649 ms
200 items, avg. validation time: 49.037075 ms
500 items, avg. validation time: 50.690123 ms
1000 items, avg. validation time: 50.057061 ms
2500 items, avg. validation time: 49.99966 ms
5000 items, avg. validation time: 48.518808 ms
7500 items, avg. validation time: 50.0492 ms
10000 items, avg. validation time: 50.01165 ms
20000 items, avg. validation time: 48.984054 ms
30000 items, avg. validation time: 51.152249 ms
40000 items, avg. validation time: 50.320894 ms
50000 items, avg. validation time: 50.039272 ms
(
https://hibernate.atlassian.net/browse/HV-1928#add-comment?atlOrigin=eyJp...
) Add Comment (
https://hibernate.atlassian.net/browse/HV-1928#add-comment?atlOrigin=eyJp...
)
Get Jira notifications on your phone! Download the Jira Cloud app for Android (
https://play.google.com/store/apps/details?id=com.atlassian.android.jira....
) or iOS (
https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=Em...
) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100210- sha1:583150f )