Env:
WildFly 10.0.0.Final
Hibernate 5.0.7.Final
Hi,
In my web application, i have following code
Stateless Session Bean
Code:
@Inject
private EmployeeRepostiory repo;
public Employee checkChanges() {
return repo.get();
}
and the EmployeeRepository class
Code:
@PersistenceContext(name = "employees")
private EntityManager em;
public Employee get() {
Employee o1 = em.find(Employee.class, 1);
o1.setFirstName("test");
Employee o2 = em.find(Employee.class, 1);
return o1;
}
The transaction attribute is default i.e. MANDATORY. The FlushMode is AUTO (verified that)
Issue: For some reason, the second find() method still gets the data from DB. It is unable to get the updated employee record that is still present in the Entity Context.
Any inputs are much appreciated.
Rakesh