Georg Ragaller wrote:
> > I think the current bug is that constraints aren't checked for default
> > values, and also are not checked upon instance creation. That is the
> > real bug. In the above, you are creating an Entity, whereas you really
> > should be creating a CompositeBuilder, set the properties using
> > stateOfComposite() and only then call newInstance(). This way the
> > constraints will be properly checked.
>
> So the correct way should be (?):
>
> UnitOfWork uow = uowf.newUnitOfWork();
> CompositeBuilder<Book> cb = uow.newEntityBuilder(Book.class);
> cb.stateOfComposite().title().set("Qi4j in Action");
>
> Book book = cb.newInstance();
> uow.complete();
>
> But that still works (I expected newInstance() to throw a
> ConstraintViolationException), or was that the "current bug" you
> referred to? Or is the code still missing something?
No, that's the bug.
/Rickard
_______________________________________________
qi4j-dev mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/qi4j-dev