Add a block to create tables.

main
KKlochko 2 years ago
parent 0f4cb4a20e
commit 86b9c11104

@ -0,0 +1,23 @@
package space.kklochko.jdbc_hospital_example.db.repositories.blocks;
import space.kklochko.jdbc_hospital_example.db.factories.DataBaseConnection;
import space.kklochko.jdbc_hospital_example.db.repositories.AbstractRepository;
import space.kklochko.jdbc_hospital_example.db.repositories.DepartmentRepository;
import space.kklochko.jdbc_hospital_example.db.repositories.IndicatorRepository;
import space.kklochko.jdbc_hospital_example.db.repositories.PatientRepository;
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
public class CreateTables {
public boolean create(DataBaseConnection dbc) {
ArrayList<AbstractRepository> tables = new ArrayList<>();
tables.add(new IndicatorRepository(dbc));
tables.add(new PatientRepository(dbc));
tables.add(new DepartmentRepository(dbc));
tables.forEach(repo -> repo.createTable());
return true;
}
}
Loading…
Cancel
Save