简体   繁体   中英

set function on Spring Boot entity not persisting

I attached this code to a request mapping

Game g = gRepo.getOne((long)1);
System.out.println(g.getFinished());
g.setFinished(true);
System.out.println(g.getFinished());

My output is:

False
True
False
True

My Game entity setFinished function is:

public void setFinished(Boolean finished) {
    this.finished = finished;
}

I'm looking for the following system print and don't understand why I'm not getting it.

False
True
True
True

@ErwinBolwidt answered my question. I wasn't using the save method. Thank you, Erwin.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM