parent
							
								
									3be3f138c4
								
							
						
					
					
						commit
						5335635d7d
					
				@ -1,4 +1,4 @@
 | 
				
			|||||||
package space.kklochko.jdbc_hospital_example.cli.commands;
 | 
					package space.kklochko.jpa_hospital_example.cli.commands;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import lombok.AllArgsConstructor;
 | 
					import lombok.AllArgsConstructor;
 | 
				
			||||||
import lombok.Data;
 | 
					import lombok.Data;
 | 
				
			||||||
@ -1,8 +1,8 @@
 | 
				
			|||||||
package space.kklochko.jdbc_hospital_example.cli.commands;
 | 
					package space.kklochko.jpa_hospital_example.cli.commands;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import lombok.AllArgsConstructor;
 | 
					import lombok.AllArgsConstructor;
 | 
				
			||||||
import lombok.Data;
 | 
					import lombok.Data;
 | 
				
			||||||
import space.kklochko.jdbc_hospital_example.db.repositories.AbstractRepository;
 | 
					import space.kklochko.jpa_hospital_example.db.repositories.AbstractRepository;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.lang.reflect.InvocationTargetException;
 | 
					import java.lang.reflect.InvocationTargetException;
 | 
				
			||||||
import java.lang.reflect.Method;
 | 
					import java.lang.reflect.Method;
 | 
				
			||||||
@ -1,7 +1,7 @@
 | 
				
			|||||||
package space.kklochko.jdbc_hospital_example.cli.commands;
 | 
					package space.kklochko.jpa_hospital_example.cli.commands;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import lombok.Data;
 | 
					import lombok.Data;
 | 
				
			||||||
import space.kklochko.jdbc_hospital_example.db.repositories.AbstractRepository;
 | 
					import space.kklochko.jpa_hospital_example.db.repositories.AbstractRepository;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.lang.reflect.InvocationTargetException;
 | 
					import java.lang.reflect.InvocationTargetException;
 | 
				
			||||||
import java.lang.reflect.Method;
 | 
					import java.lang.reflect.Method;
 | 
				
			||||||
@ -1,12 +1,12 @@
 | 
				
			|||||||
package space.kklochko.jdbc_hospital_example.cli.commands.factories;
 | 
					package space.kklochko.jpa_hospital_example.cli.commands.factories;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import lombok.NonNull;
 | 
					import lombok.NonNull;
 | 
				
			||||||
import space.kklochko.jdbc_hospital_example.cli.commands.CommandData;
 | 
					import space.kklochko.jpa_hospital_example.cli.commands.CommandData;
 | 
				
			||||||
import space.kklochko.jdbc_hospital_example.cli.commands.CommandEntity;
 | 
					import space.kklochko.jpa_hospital_example.cli.commands.CommandEntity;
 | 
				
			||||||
import space.kklochko.jdbc_hospital_example.db.repositories.AbstractRepository;
 | 
					import space.kklochko.jpa_hospital_example.db.repositories.AbstractRepository;
 | 
				
			||||||
import space.kklochko.jdbc_hospital_example.models.Department;
 | 
					import space.kklochko.jpa_hospital_example.models.Department;
 | 
				
			||||||
import space.kklochko.jdbc_hospital_example.models.Indicator;
 | 
					import space.kklochko.jpa_hospital_example.models.Indicator;
 | 
				
			||||||
import space.kklochko.jdbc_hospital_example.models.Patient;
 | 
					import space.kklochko.jpa_hospital_example.models.Patient;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.lang.reflect.Method;
 | 
					import java.lang.reflect.Method;
 | 
				
			||||||
import java.util.UUID;
 | 
					import java.util.UUID;
 | 
				
			||||||
@ -1,10 +1,10 @@
 | 
				
			|||||||
package space.kklochko.jdbc_hospital_example.cli.commands.factories;
 | 
					package space.kklochko.jpa_hospital_example.cli.commands.factories;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import lombok.NonNull;
 | 
					import lombok.NonNull;
 | 
				
			||||||
import space.kklochko.jdbc_hospital_example.cli.commands.CommandData;
 | 
					import space.kklochko.jpa_hospital_example.cli.commands.CommandData;
 | 
				
			||||||
import space.kklochko.jdbc_hospital_example.models.Department;
 | 
					import space.kklochko.jpa_hospital_example.models.Department;
 | 
				
			||||||
import space.kklochko.jdbc_hospital_example.models.Indicator;
 | 
					import space.kklochko.jpa_hospital_example.models.Indicator;
 | 
				
			||||||
import space.kklochko.jdbc_hospital_example.models.Patient;
 | 
					import space.kklochko.jpa_hospital_example.models.Patient;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.sql.Timestamp;
 | 
					import java.sql.Timestamp;
 | 
				
			||||||
import java.util.Map;
 | 
					import java.util.Map;
 | 
				
			||||||
@ -1,9 +1,9 @@
 | 
				
			|||||||
package space.kklochko.jdbc_hospital_example.cli.commands.factories;
 | 
					package space.kklochko.jpa_hospital_example.cli.commands.factories;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import lombok.NonNull;
 | 
					import lombok.NonNull;
 | 
				
			||||||
import space.kklochko.jdbc_hospital_example.cli.commands.CommandData;
 | 
					import space.kklochko.jpa_hospital_example.cli.commands.CommandData;
 | 
				
			||||||
import space.kklochko.jdbc_hospital_example.cli.commands.CommandEntities;
 | 
					import space.kklochko.jpa_hospital_example.cli.commands.CommandEntities;
 | 
				
			||||||
import space.kklochko.jdbc_hospital_example.db.repositories.AbstractRepository;
 | 
					import space.kklochko.jpa_hospital_example.db.repositories.AbstractRepository;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.lang.reflect.Method;
 | 
					import java.lang.reflect.Method;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -1,4 +1,4 @@
 | 
				
			|||||||
package space.kklochko.jdbc_hospital_example.cli.parsers;
 | 
					package space.kklochko.jpa_hospital_example.cli.parsers;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import lombok.NonNull;
 | 
					import lombok.NonNull;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -1,8 +1,8 @@
 | 
				
			|||||||
package space.kklochko.jdbc_hospital_example.cli.parsers;
 | 
					package space.kklochko.jpa_hospital_example.cli.parsers;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import lombok.NonNull;
 | 
					import lombok.NonNull;
 | 
				
			||||||
import lombok.ToString;
 | 
					import lombok.ToString;
 | 
				
			||||||
import space.kklochko.jdbc_hospital_example.cli.commands.CommandData;
 | 
					import space.kklochko.jpa_hospital_example.cli.commands.CommandData;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ToString
 | 
					@ToString
 | 
				
			||||||
public class CommandParser {
 | 
					public class CommandParser {
 | 
				
			||||||
@ -1,4 +1,4 @@
 | 
				
			|||||||
package space.kklochko.jdbc_hospital_example.cli.validators;
 | 
					package space.kklochko.jpa_hospital_example.cli.validators;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.util.regex.Pattern;
 | 
					import java.util.regex.Pattern;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -1,4 +1,4 @@
 | 
				
			|||||||
package space.kklochko.jdbc_hospital_example.cli.validators;
 | 
					package space.kklochko.jpa_hospital_example.cli.validators;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.util.regex.Pattern;
 | 
					import java.util.regex.Pattern;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -1,4 +1,4 @@
 | 
				
			|||||||
package space.kklochko.jdbc_hospital_example.cli.validators;
 | 
					package space.kklochko.jpa_hospital_example.cli.validators;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.util.regex.Pattern;
 | 
					import java.util.regex.Pattern;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -1,4 +1,4 @@
 | 
				
			|||||||
package space.kklochko.jdbc_hospital_example.config.env;
 | 
					package space.kklochko.jpa_hospital_example.config.env;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import io.github.cdimascio.dotenv.Dotenv;
 | 
					import io.github.cdimascio.dotenv.Dotenv;
 | 
				
			||||||
import lombok.Getter;
 | 
					import lombok.Getter;
 | 
				
			||||||
@ -1,8 +1,8 @@
 | 
				
			|||||||
package space.kklochko.jdbc_hospital_example.config.factories;
 | 
					package space.kklochko.jpa_hospital_example.config.factories;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import lombok.NonNull;
 | 
					import lombok.NonNull;
 | 
				
			||||||
import space.kklochko.jdbc_hospital_example.config.env.DataBaseEnvConfig;
 | 
					import space.kklochko.jpa_hospital_example.config.env.DataBaseEnvConfig;
 | 
				
			||||||
import space.kklochko.jdbc_hospital_example.config.models.DataBaseConfig;
 | 
					import space.kklochko.jpa_hospital_example.config.models.DataBaseConfig;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class LoadDataBaseConfigFromEnvFile {
 | 
					public class LoadDataBaseConfigFromEnvFile {
 | 
				
			||||||
    public DataBaseConfig load(@NonNull String filename) {
 | 
					    public DataBaseConfig load(@NonNull String filename) {
 | 
				
			||||||
@ -1,4 +1,4 @@
 | 
				
			|||||||
package space.kklochko.jdbc_hospital_example.config.models;
 | 
					package space.kklochko.jpa_hospital_example.config.models;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import lombok.Data;
 | 
					import lombok.Data;
 | 
				
			||||||
import java.util.Properties;
 | 
					import java.util.Properties;
 | 
				
			||||||
@ -1,7 +1,7 @@
 | 
				
			|||||||
package space.kklochko.jdbc_hospital_example.db.factories;
 | 
					package space.kklochko.jpa_hospital_example.db.factories;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import lombok.Setter;
 | 
					import lombok.Setter;
 | 
				
			||||||
import space.kklochko.jdbc_hospital_example.config.models.DataBaseConfig;
 | 
					import space.kklochko.jpa_hospital_example.config.models.DataBaseConfig;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.sql.Connection;
 | 
					import java.sql.Connection;
 | 
				
			||||||
import java.sql.DriverManager;
 | 
					import java.sql.DriverManager;
 | 
				
			||||||
@ -1,4 +1,4 @@
 | 
				
			|||||||
package space.kklochko.jdbc_hospital_example.db.factories;
 | 
					package space.kklochko.jpa_hospital_example.db.factories;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.sql.Connection;
 | 
					import java.sql.Connection;
 | 
				
			||||||
import java.sql.SQLException;
 | 
					import java.sql.SQLException;
 | 
				
			||||||
@ -1,21 +1,19 @@
 | 
				
			|||||||
package space.kklochko.jdbc_hospital_example.db.repositories;
 | 
					package space.kklochko.jpa_hospital_example.db.repositories;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import jakarta.persistence.EntityManager;
 | 
				
			||||||
import lombok.Setter;
 | 
					import lombok.Setter;
 | 
				
			||||||
import space.kklochko.jdbc_hospital_example.db.factories.DataBaseConnection;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.util.ArrayList;
 | 
					import java.util.ArrayList;
 | 
				
			||||||
import java.util.UUID;
 | 
					import java.util.UUID;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@Setter
 | 
					@Setter
 | 
				
			||||||
public abstract class AbstractRepository<T> {
 | 
					public abstract class AbstractRepository<T> {
 | 
				
			||||||
    DataBaseConnection db;
 | 
					    EntityManager manager;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public AbstractRepository(DataBaseConnection db){
 | 
					    public AbstractRepository(EntityManager manager){
 | 
				
			||||||
        setDb(db);
 | 
					        setManager(manager);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public abstract boolean createTable();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public abstract boolean create(T object);
 | 
					    public abstract boolean create(T object);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public abstract T read(UUID id);
 | 
					    public abstract T read(UUID id);
 | 
				
			||||||
					Loading…
					
					
				
		Reference in new issue