如何从em.find方法获取相同的实体?

时间:2013-04-19 05:46:52

标签: java jpa

如何从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是“俄罗斯”

我需要简短的解释请帮助我。

1 个答案:

答案 0 :(得分:0)

修改后的实体存储在事务cache中,当您想要再次检索时,显示的是缓存结果