diff --git a/src/main/java/space/kklochko/jdbc_hospital_example/Main.java b/src/main/java/space/kklochko/jdbc_hospital_example/Main.java deleted file mode 100644 index 82a8f89..0000000 --- a/src/main/java/space/kklochko/jdbc_hospital_example/Main.java +++ /dev/null @@ -1,27 +0,0 @@ -package space.kklochko.jdbc_hospital_example; - -import space.kklochko.jdbc_hospital_example.cli.CLI; -import space.kklochko.jdbc_hospital_example.config.factories.LoadDataBaseConfigFromEnvFile; -import space.kklochko.jdbc_hospital_example.config.models.DataBaseConfig; -import space.kklochko.jdbc_hospital_example.db.factories.DataBaseConnection; -import space.kklochko.jdbc_hospital_example.db.repositories.blocks.CreateTables; -import space.kklochko.jdbc_hospital_example.db.repositories.blocks.TurnOnUUIDPlugin; - -import java.sql.*; - -public class Main { - public static void main(String[] args) { - DataBaseConfig db = (new LoadDataBaseConfigFromEnvFile()).load(); - DataBaseConnection dbc = new DataBaseConnection(db); - - TurnOnUUIDPlugin turnOnUUIDPlugin = new TurnOnUUIDPlugin(); - turnOnUUIDPlugin.create(dbc); - - CreateTables createTables = new CreateTables(); - createTables.create(dbc); - - CLI cli = new CLI(dbc); - cli.run(); - } -} - diff --git a/src/main/java/space/kklochko/jpa_hospital_example/Main.java b/src/main/java/space/kklochko/jpa_hospital_example/Main.java new file mode 100644 index 0000000..3effa83 --- /dev/null +++ b/src/main/java/space/kklochko/jpa_hospital_example/Main.java @@ -0,0 +1,15 @@ +package space.kklochko.jpa_hospital_example; + +import jakarta.persistence.EntityManager; +import space.kklochko.jpa_hospital_example.cli.CLI; +import space.kklochko.jpa_hospital_example.db.factories.EntityManagerConnection; + +public class Main { + public static void main(String[] args) { + EntityManager manager = (new EntityManagerConnection()).connect(); + + CLI cli = new CLI(manager); + cli.run(); + } +} +