如何从em.find
方法中获取相同的实体?
Address address=em.find(Address.class,1);
System.out.println("Name of Address: "+address.getAddressName); // Chinnur
address.setAddressName("Russia");
Address address1=em.find(Address.class,address.getAddressId());
System.out.println("Name of Address: "+address1.getAddressName); //?????????
我需要address1.getAddressName
是“chinnur”,
但我得到address1.getAddressName
是“俄罗斯”
我需要简短的解释请帮助我。
答案 0 :(得分:0)
修改后的实体存储在事务cache
中,当您想要再次检索时,显示的是缓存结果