public void testDuplicate2() throws Exception {
EntityManager em = createEntityManager();
assumeTrue(em.getDelegate() instanceof TripleSource);
TripleSource aSource = (TripleSource) em.getDelegate();
EntityTest aObj = InstanceGenerator.generateInstanceClass(EntityTest.class).newInstance();
aObj.setId("someid");
aObj.setLabel("some label");
em.persist(aObj);
em.refresh(aObj);
aObj.setLabel("foo");
em.merge(aObj);
Graph aGraph = Graphs.newGraph(aSource.getStatements(null, null, null));
assertEquals(3, aGraph.size());
assertEquals(1, Lists.newArrayList(aGraph.match(null, ValueFactoryImpl.getInstance().createURI("urn:label"), null)).size());
em.remove(aObj);
ParentEntity pe = InstanceGenerator.generateInstanceClass(ParentEntity.class).newInstance();
pe.setEntity(aObj);
em.persist(pe);
em.refresh(pe);
aGraph = Graphs.newGraph(aSource.getStatements(null, null, null));
assertEquals(5, aGraph.size());
assertEquals(1, Lists.newArrayList(aGraph.match(null, ValueFactoryImpl.getInstance().createURI("urn:label"), null)).size());
aObj.setLabel("foobarbaz");
em.merge(pe);
aGraph = Graphs.newGraph(aSource.getStatements(null, null, null));
assertEquals(5, aGraph.size());
assertEquals(1, Lists.newArrayList(aGraph.match(null, ValueFactoryImpl.getInstance().createURI("urn:label"), null)).size());
}