Hello!
I was able to run your first & second fragments with expected behavior:
Entity{id='hello3', value='v3', date=2019-01-21}
Note that I'm using 2.7.
Regards,
--
Ilya Kasnacheev
пн, 21 янв. 2019 г. в 08:43, c c <[email protected]>:
> Hi,
> I work on ignite 2.7.0
>
> I have a value type as below
>
> public class Entity {
> String id;
> String value;
> Date date;
> }
>
> then interact with cache as below
>
> try (Transaction tx =
> ignite.transactions().txStart(TransactionConcurrency.PESSIMISTIC,
> TransactionIsolation.SERIALIZABLE)) {
> cache1.invoke("k6", new EntryProcessor<String, Entity, Object>() {
> @Override public Object process(MutableEntry<String, Entity>
> mutableEntry, Object... objects) throws EntryProcessorException {
> Entity e = mutableEntry.getValue();
> e.setId("hello3");
> e.setValue("v3");
> mutableEntry.setValue(e);
> return null;
> }
> });
> tx.commit();
> }
>
> But entry value does not change after commit.
>
> If i code as below, entry value would change after commit.
>
> try (Transaction tx =
> ignite.transactions().txStart(TransactionConcurrency.PESSIMISTIC,
> TransactionIsolation.SERIALIZABLE)) {
> cache1.invoke("k6", new EntryProcessor<String, Entity, Object>() {
> @Override public Object process(MutableEntry<String, Entity>
> mutableEntry, Object... objects) throws EntryProcessorException {
> mutableEntry.setValue(new Entity("test2", "a2", new Date()));
> return null;
> }
> });
> tx.commit();
> }
>
> I found that changes to entry would not take effect after commit when
> mutableEntry.getValue() called.
>