mirror of
https://github.com/Athou/commafeed.git
synced 2026-03-21 21:37:29 +00:00
unit of work refactoring
This commit is contained in:
@@ -44,15 +44,10 @@ public class StartupService implements Managed {
|
||||
@Override
|
||||
public void start() throws Exception {
|
||||
updateSchema();
|
||||
new UnitOfWork<Void>(sessionFactory) {
|
||||
@Override
|
||||
protected Void runInSession() throws Exception {
|
||||
if (userDAO.count() == 0) {
|
||||
initialData();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}.run();
|
||||
long count = UnitOfWork.run(sessionFactory, () -> userDAO.count());
|
||||
if (count == 0) {
|
||||
UnitOfWork.run(sessionFactory, () -> initialData());
|
||||
}
|
||||
}
|
||||
|
||||
private void updateSchema() {
|
||||
|
||||
Reference in New Issue
Block a user