-
Notifications
You must be signed in to change notification settings - Fork 47
Save to DB
王爵nice edited this page Mar 17, 2018
·
1 revision
Saving data through Anima
is a process of persisting a Java object to a database, so you only need to create an object and then save it. Anima will return you a ResultKey
object through which you can save the database. The primary key.
User user = new User();
user.setUserName("save1");
user.setAge(99);
Integer id = user.save().asInt();
You can also save it with the ʻAnimastatic methods
saveand
saveBatch`.
Anima.save(new User("save3", 100));
List<User> users = new ArrayList<>();
users.add(new User("user1", 10));
users.add(new User("user2", 11));
users.add(new User("user3", 12));
Anima.saveBatch(users);
Contributing
Documentation
- Getting started
- Create Model
- Query DB
- Save to DB
- Updates and Deletes
- Transaction
- Integration with Spring
- Advanced Usage
Other resources
中文文档