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.
------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
Resteasy-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/resteasy-users