复制java对象,jpa,save
@Transactional
public void testPerson() {
try {
Person person1 = personDao.findById(1);
Person person2 = personDao.findById(2);
Person p = new Person();
BeanUtils.copyProperties(person1, p);
p.setId(person2.getId());
personDao.save(p);
} catch (Exception e) {
e.printStackTrace();
}
}