7.标示符的意义-不同的对象标示符必须不一样
@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中,不允许出现这种情况:两个持久化对象,但是标示符的值一样
时间: 2024-10-17 07:14:07