Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Althogh its not clear implementation of your user.save() method. One thing is clear your guess is right. It's because of new User() which creates a new user for you.</p> <p>Check your user class is there any property to uniquely identify a user(such as id). And while you are changing details pass that unique id property along with other details which will say details for which user needs to be updated.</p> <p>Again if you are using any persistence api like hibernate then setting unique id properties is enough to update details, other wise you have to write your custom code first get detail of the user with unique id and then update the details</p> <p>Again your in your code there is no primary key declaration for any properties and i can't find save method in User class. I am assuming you are using hibernate.</p> <p>According to the code for User class i am assuming email properties is the unique id you are using so change your changeDetails method like this</p> <pre><code>public static void changeDetails(String firstName, String lastName, String email, String password, String age, String nationality) { Logger.info("New details are: " + firstName + " " + lastName + " " + email + " " + password + " " + age + " " + nationality + " "); User user = findByEmail(String email); //User user = new User(firstName, lastName, email, password, age, nationality); user.setFirstName(firstName); user.setLastName(lastName); //user.setEmail(email); user.setPassword(password); user.setAge(age); user.setNationality(nationality); user.save(); Home.index(); } </code></pre> <p>As you can see i have commented user.setEmail(email) because it will say its a new user and will save it as a new user.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload