其同样的问题有: 将现有实体仅使用Nhibertate 进行正常的休眠,而不是Nhebertnate,这个问题也没有完全回答海事组织。
总而言之,能否(在休眠中)由一个以前附属的实体填补/容纳一个新实体?
daoService.getEntityManager().find(Student.class, 123L);
Student student = new Student(123) // Creating a new student
daoService.fill(student);
结果应该是,学生案例的准确价值将与实体经理发现的确切价值相同。
I can t use merge, as it returns a new instance (instead of filling the given instance) and I can t use load() if the ID belongs to an already attached entity. I want the code to be generic to every entity, so its not practical to just set the values manually. I d rather not use refelection in this context because of all the potential pitfalls (Lazy initialization, inheritance, get methods with no corresponding set methods and vice versa, etc.)
我正在研究一个传统系统,该系统既使用联合行动计划实体,也使用非实体(与联合开发银行合作),这可以解决我的一些重大问题。
提前感谢您的帮助!