-
Notifications
You must be signed in to change notification settings - Fork 2
⬆ Update
Gustavo M. Paes edited this page Dec 10, 2021
·
1 revision
To update a data from mysql table, using this class as a example:
public class User extends WormTable {
@WormField(sqlType = "VARCHAR", length = 36, idColumn = true)
String userUuid;
@WormField(sqlType = "VARCHAR", length = 50)
String name;
@WormField(sqlType = "VARCHAR", length = 50, nullable = true, defaultValue = "NULL")
String email;
public User(){}
public User(String userUuid, String name, String email){
this.userUuid = userUuid;
this.name = name;
this.email = email;
}
}to update a data just use Update() method:
User user = new User();
user.Get('88e5bccd-0b36-47bd-ad21-3c41efce899e');
user.name = "Gampe";
user.Update();Update() will get the data with this where into Mysql table and return a boolean, if is true is successful updated and if is false was a error.
to update a data just use Update() method with where:
User user = new User();
user.Get('88e5bccd-0b36-47bd-ad21-3c41efce899e');
user.name = "Gampe";
user.Update('name like "%G"');will update all data that satisfact this where
Worm it's created by GumpDev and use some repositories like HikariCP, Mysql Connector Java and slf4j