I have an EJB method.
public List<Rfsprsus> findAll() {
List<Rfsprsus> rl = getEntityManager()
.createNamedQuery("Rfsprsus.findAll", Rfsprsus.class)
.getResultList();
for(Rfsprsus r: rl) {
StringBuilder tempPwd = new StringBuilder("");
for(int i = 0; i < paramFacade.find().getPwlength(); i++) {
tempPwd.append("a");
}
r.setPassword(tempPwd.toString());
if(r.getOrg() == null) r.setOrg(orgFacade.find("011")); }
return rl;
But, after invoking this method, then I check the database. I’m quite surprised that the for loop actually caused an update!
I don’t know how and why, please explain!
I just added this on top of the method.
Worked like a charm!