In this section, you'll learn how to store data.
In this tutorial, we create an auto increment document named JavaDoc.java
locate in src/main/java/runflow
, the content like following:
In parent class
top.myrest.myflow.db.AutoIncrementDoc
, it has two methods:setId(Integer)
andInteger getId()
. And if you want to customize the unique id do not need auto increment, you can extend the top level abstract classtop.myrest.myflow.db.BaseDoc<T>
.
Create a repository named JavaRepo.java
locate in src/main/java/runflow
, the content like following:
The base class
BaseRepo<ID,T>(Class<T> docClass, Boolean enableDataSync)
has many utility methods for crud operation, and you can override methodonSyncFrom
to customize how to synchronize data.