Nested unit of work + entity creational + constraint bug
--------------------------------------------------------
Key: QI-147
URL: http://issues.ops4j.org/jira/browse/QI-147
Project: Qi4j
Issue Type: Bug
Components: Persistence
Affects Versions: 0.5
Reporter: Edward Yakop
Assignee: Rickard Öberg
Fix For: 0.5
Steps to reproduce:
* interface Money
{
Currency currency();
Long amount();
}
* interface MoneyState
{
Property<String> currencyCode();
Property<Long> amount();
}
* interface MoneyEntity extends Money, EntityComposite
{
// Implementation
}
* UnitOfWork uow = uowf.newUnitOfWork();
UnitOfWork nestedUOW = uowf.nestedUnitOfWork();
EntityBuilder<Money> moneyBuilder = nestedUow.newEntityBuilder( Money.class
);
MoneyState state = moneyBuilder.templateFor( MoneyState.class );
state.currencyCode().set( "USD" );
state.amount().set( 100L );
Money money = moneyBuilder.newInstance();
nestedUOW.completeAndContinue();
uow.discard();
Expected output:
* Nested UOW to complete properly.
Current output:
org.qi4j.entity.UnitOfWorkCompletionException:
org.qi4j.composite.ConstraintViolationException: Constraint violation in
org.qi4j.tests.jira.test.MoneyState.currencyCode with constraint not optional,
for value 'null'
at
org.qi4j.runtime.entity.UnitOfWorkInstance.commitCompleteLists(UnitOfWorkInstance.java:514)
at
org.qi4j.runtime.entity.UnitOfWorkInstance.complete(UnitOfWorkInstance.java:401)
at
org.qi4j.runtime.entity.UnitOfWorkInstance.completeAndContinue(UnitOfWorkInstance.java:385)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.ops4j.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
_______________________________________________
qi4j-dev mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/qi4j-dev