On 2009-11-20 12.13, Niclas Hedhman wrote:
2. Qi4j's UnitOfWork is really going to be used both for 'multiple per
thread' as well as 'nested'. The latter will not be seen by the
EntityStore (the UoW is the store), but the former needs to be
supported. I think (but not totally sure) that the issue lies in when
the transaction manager kicks in. I *think* that the Transaction
should be started on EntityStoreSPI.apply() and be
committed/rollbacked on StateCommitter.commit()/cancel(). That gives a
short running transaction and no multiple ones in the same thread.
Additionally, there is a new NeoEntityStoreUnitOfWork instance for
each thread (if that helps).

The thing is that Johan wanted to experiment with having the UoW backed directly by a tx. If that is done, then all reads/writes are done directly to a node. apply() would then simply commit the transaction, and not have to do much work. This obviously messes up the distinction between UoW and tx, with the benefit being that there is only one tx per UoW, and management of state is easier (no copying up/down from Neo, everything is in the node).

If you think that makes sense, I will go ahead with that change (make
short-lived transactions).

See above. The old implementation had two variants: one for the short-lived transactions and one for "long-lived" ones (which is the same as the current). Most usages will probably be with the "long-lived" one, i.e. short-lived UoW's (request/response type).

Another thing;
We get a testcase failure (both locally on my machine and on the
Continuous Integration server) for whenNewEntityThenCanFindEntity(),
and the exception is a bit odd;

java.lang.ClassCastException: java.lang.String
        at 
org.qi4j.test.entity.AbstractEntityStoreTest.whenNewEntityThenCanFindEntity(AbstractEntityStoreTest.java:142)

on line;
     assertThat( "property has correct value",
         
instance.valueProperty().get().valueProperty().get().stringValue().get(),
         equalTo( "Bar" ) );

Not sure how CCE can happen on that line. Got any ideas?

The string value in the store is not deserialized to a ValueComposite properly?

/Rickard

_______________________________________________
qi4j-dev mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/qi4j-dev

Reply via email to