标签:hibernate
@Test public void testIdentity(){ Session session = sessionFactory.openSession(); Transaction transaction = session.beginTransaction(); Person person = (Person)session.get(Person.class, 1L); Person person2 = new Person(); person2.setPid(1L); session.update(person2); transaction.commit(); session.close(); }
在hibernate中,不允许出现这种情况:两个持久化对象,但是标示符的值一样
标签:hibernate
原文地址:http://pengya123.blog.51cto.com/8467424/1794485