Hi,
Regarding Michael Hunger response <https://groups.google.com/d/msg/neo4j/5IbORTqPaQs/CFKLfT3gFVQJ> and using Spring data neo4j 3.3.0.M1 Spring 4.1.4 Neo4j 2.16 Java 1.7 I've tried to use the advance mapping to have the optimistic locking working without success. My source is something like: public void updateMainChannel(String channelId, String shortName) { Transaction tx = graphDatabase.beginTx(); try { Channel c = channelService.findChannelById(channelId); //c = c.persist(); // this line makes no difference c.setShortName(shortName); channelService.saveChannel(c); tx.success(); } catch (Exception ex) { tx.failure(); } finally { tx.close(); } } @Transactional public class ChannelServiceImpl implements ChannelService{ @Autowired private ChannelRepository channelRepository; public Channel findChannelById(String id){ return channelRepository.findById(id); } public Channel saveChannel(Channel channel){ return channelRepository.save(channel); } } @Repository public interface ChannelRepository extends GraphRepository<Channel> { public Channel findById(String id); } What I tried is: - client A calls the method updateChannel and get paused (debug mode and breakpoint) right after fetching the channel using the channelService - client B calls the method updateChannel without being stopped to update the same channel as client A - client A continues The result is right after client B has updated the channel, client B's value are saved in the database. But once client A finishes, its values are saved. I was expected an exception telling that the entity was modified since it was last fetched. Did I do something wrong or am I expecting too much ? I noticed that the Channel entity returned by the "findChannelById" method has a "DetachedEntityState", does it mean that the entity is detached ? I ask this because event if the name is explicit, this class has a isDetached() method which made me think that a DetachedEntityState can be attached. Finally I tried to "attach" it using persist() on it but it does not have any effect. Thanks in advance, Denis -- You received this message because you are subscribed to the Google Groups "Neo4j" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
