From: marceloverdijk <ma...@ov...> - 2012-02-14 12:47:10
|
I'm using the simple Order and OrderLine classes as below, together with a OrderResource. The Order and OrderLine contain Hibernate Validator constraints for validation being performed automatically using the @ValidateRequest and @Valid annotations. public class Order { @Id private Long id; @NotNull private Long customerId; @NotNull private Date orderDate; @Embedded List<OrderLine> lines = new ArrayList<OrderLine>(); } public class OrderLine { @NotBlank private String description; @NotNull private Double price; } @Path("/order") public class OrderResource { @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @ValidateRequest public Order create(@Valid Order order) { order.save(); return order; } } This works fine for validating the Order class but if the create resource receives a JSON body including OrderLine lines these are not validated... However the lines are added to the order itself so that works. Is it possible to validate the Order lines automatically? Cheers, Marcel -- View this message in context: http://resteasy-users.6463.n6.nabble.com/ValidateRequest-Valid-Constraints-for-embedded-classes-not-validated-tp4468631p4468631.html Sent from the resteasy-users mailing list archive at Nabble.com. |