Hi folks!
How can I have property constraints checked in UnitOfWork.complete()?
Is there a ready-made fragment to do this? How can I 'weave' it in?
Sample:
public interface Book
{
@NotEmpty Property<String> title();
@NotNull Property<ISBN13> isbn();
}
The following code works fine
...
UnitOfWork uow = uowf.newUnitOfWork();
Book book = uow.newEntity(BookEntity.class);
book.title().set("Qi4j in Action");
uow.complete();
...
and the book.isbn() is never set, so the @NotNull constraint is never
checked and null is stored.
That's ok for some kind of use-cases, let's say a wizard, where the user
has the ability to save the current wizard state and restart later where
he left.
But there are other cases, where I wan't to assure that my entities
fullfill the property constraints at latest when uow.complete() is
performed.
Thanks
Georg
_______________________________________________
qi4j-dev mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/qi4j-dev