I am very new to JPA - I have this look up that will find the user on the login table.. now if I recieve new information like the user has changed their password, how do I update the entry?
so I find the user - lets say via their email address.
TblLogin acc = tblLoginRepository.findByEmail(email);
I've seen methods invoking "getTransaction()"
http://www.objectdb.com/java/jpa/persistence/update
so something like this?
tblLoginRepository.getTransaction().begin();
acc.setPassword("test2");
tblLoginRepository.getTransaction().commit();
but then do I just do something like this - and that is it?
TblLogin acc = tblLoginRepository.findByEmail(email);
acc.setPassword("newpassword");
^ and that is that - nothing else - entry is updated?
for when the user registers -- I do a saveAndFlush? I don't have to do anything else for the editing of an entry?
TblLogin newAcc = tblLoginRepository.saveAndFlush(new TblLogin(
email,
password,
pin
));