EMSADM DDL identity to sequence 대응 완료

This commit is contained in:
Rinjae
2025-11-14 15:01:12 +09:00
parent fa2f64169e
commit c06bbb3168
7 changed files with 328 additions and 109 deletions
@@ -3,6 +3,8 @@ package com.eactive.eai.custom;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.InitializingBean;
import com.eactive.eai.rms.data.PortalSchemaProviderHolder;
import com.eactive.eai.rms.env.EmsConfig;
import com.eactive.eai.transformer.message.ISO8583MessageFactory;
/**
@@ -36,5 +38,8 @@ public class CustomizingAppInitializer implements InitializingBean {
logger.info(String.format("ISO8583MessageFactory registered - %s = %s", MESSAGE_TYPE_SVL, ISO8583_SVL_CLASS_NAME));
logger.info(String.format("ISO8583MessageFactory registered - %s = %s", LAYOUT_TYPE_H2H, ISO8583_H2H_CLASS_NAME));
logger.info(String.format("ISO8583MessageFactory registered - %s = %s", LAYOUT_TYPE_SVL, ISO8583_SVL_CLASS_NAME));
// PortalSchemaProviderHolder 초기화 (eai.tableowner 주입)
PortalSchemaProviderHolder.setProvider(() -> System.getProperty(EmsConfig.TABLE_OWNER));
}
}
@@ -12,6 +12,8 @@ import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import com.eactive.eai.rms.common.datasource.DataSourceType;
import com.eactive.eai.rms.common.datasource.DataSourceTypeManager;
import com.eactive.eai.rms.data.PortalSchemaProviderHolder;
import com.eactive.eai.rms.env.EmsConfig;
public class CustomBeanFactoryPostProcessor implements BeanFactoryPostProcessor {
@@ -22,7 +24,13 @@ public class CustomBeanFactoryPostProcessor implements BeanFactoryPostProcessor
public void postProcessBeanFactory(ConfigurableListableBeanFactory factory)
throws BeansException {
// PortalSchemaProviderHolder 초기화 (Hibernate EntityManagerFactory 생성 전에 필요)
PortalSchemaProviderHolder.setProvider(() -> System.getProperty(EmsConfig.TABLE_OWNER));
if (logger.isDebugEnabled()) {
logger.debug("PortalSchemaProviderHolder initialized with tableOwner: " + System.getProperty(EmsConfig.TABLE_OWNER));
}
List<DataSourceType> dataSourceTypes = new ArrayList<DataSourceType>();
Map maps = factory.getBeansOfType(DataSourceType.class);
@@ -1,8 +1,5 @@
package com.eactive.eai.rms.common.startup;
import java.lang.reflect.Field;
import java.nio.charset.Charset;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;
@@ -11,115 +8,117 @@ import com.eactive.eai.rms.common.util.CommonConstants;
import com.eactive.eai.rms.env.EmsConfig;
import com.eactive.eai.rms.onl.common.service.AdapterStatusSendThreadPool;
public class AppInitializer implements InitializingBean, DisposableBean {
public class AppInitializer implements InitializingBean, DisposableBean {
final Logger logger = Logger.getLogger(AppInitializer.class);
boolean debug = true;
private String instName;
private String tableOwner;
private String systemMode = "D"; //EAI System Mode : [P/T/D/S]
private String themeColor = "black";
private String drMode = "";
private String eaiDatasourceType = "DEV"; // 데이터 소스 타입 :[DEV:개발/STG:스테이징/PRD:운영] ...NSG:내부서버
public void setInstName(String instName) {
this.instName = instName;
}
public void setTableOwner(String tableOwner) {
this.tableOwner = tableOwner;
}
public void setSystemMode(String systemMode) {
this.systemMode = systemMode;
}
public void setThemeColor(String themeColor) {
this.themeColor = themeColor;
}
public void setDrMode(String drMode) {
this.drMode = drMode;
}
public void setEaiDatasourceType(String eaiDatasourceType) {
this.eaiDatasourceType = eaiDatasourceType;
}
private void init()
{
if (debug) {
logger.debug("applicationInitialized");
}
//MS949로 default encoding 고정
// System.setProperty("file.encoding","MS949");
// Field charset = null;
// try {
// charset = Charset.class.getDeclaredField("defaultCharset");
// charset.setAccessible(true);
// charset.set(null, null);
// } catch (Exception e) {
// e.printStackTrace();
// }
// set default value
String serverName = System.getProperty(EmsConfig.INST_NAME);
if(serverName == null) {
System.setProperty(EmsConfig.INST_NAME, instName);
}
String tOwner = System.getProperty(EmsConfig.TABLE_OWNER);
if(tOwner == null) {
System.setProperty(EmsConfig.TABLE_OWNER, tableOwner);
}
// 서버 구분 설정(개발:D, 테스트:T, 온라인:P)
CommonConstants.SERVER_TYPE = systemMode;
//모니터링 테마 적용
String tColor = System.getProperty(EmsConfig.THEME_COLOR);
if(tColor == null || "".equals(tColor)) {
System.setProperty(EmsConfig.THEME_COLOR, themeColor);
}
if (debug) {
logger.debug(EmsConfig.DR_MODE + " = " + drMode);
}
//env 프라퍼티 파일만 있음 dr 여부 셋팅
System.setProperty(EmsConfig.DR_MODE, drMode);
private String systemMode = "D"; // EAI System Mode : [P/T/D/S]
//데이터 소스타입(DEV:개발 / STG:스테이징 / PRD:운영 ... )
String eDatasourceType = System.getProperty(EmsConfig.DATASOURCE_TYPE);
if(eDatasourceType == null || "".equals(eDatasourceType)) {
System.setProperty(EmsConfig.DATASOURCE_TYPE, eaiDatasourceType);
}
if (debug) {
logger.debug(EmsConfig.DATASOURCE_TYPE + " =" + eaiDatasourceType); //env 프라퍼티
}
if(debug) {
logger.debug("SERVER_TYPE ="+CommonConstants.SERVER_TYPE);
}
}
public void destroy()
{
AdapterStatusSendThreadPool.destroy();
if(debug) {
logger.debug("############ e-link WebApplication stopping... preStop ############");
}
}
private String themeColor = "black";
private String drMode = "";
private String eaiDatasourceType = "DEV"; // 데이터 소스 타입 :[DEV:개발/STG:스테이징/PRD:운영] ...NSG:내부서버
public void setInstName(String instName) {
this.instName = instName;
}
public void setTableOwner(String tableOwner) {
this.tableOwner = tableOwner;
}
public void setSystemMode(String systemMode) {
this.systemMode = systemMode;
}
public void setThemeColor(String themeColor) {
this.themeColor = themeColor;
}
public void setDrMode(String drMode) {
this.drMode = drMode;
}
public void setEaiDatasourceType(String eaiDatasourceType) {
this.eaiDatasourceType = eaiDatasourceType;
}
private void init() {
if (debug) {
logger.debug("applicationInitialized");
}
// MS949로 default encoding 고정
// System.setProperty("file.encoding","MS949");
// Field charset = null;
// try {
// charset = Charset.class.getDeclaredField("defaultCharset");
// charset.setAccessible(true);
// charset.set(null, null);
// } catch (Exception e) {
// e.printStackTrace();
// }
// set default value
String serverName = System.getProperty(EmsConfig.INST_NAME);
if (serverName == null) {
System.setProperty(EmsConfig.INST_NAME, instName);
}
String tOwner = System.getProperty(EmsConfig.TABLE_OWNER);
if (tOwner == null) {
System.setProperty(EmsConfig.TABLE_OWNER, tableOwner);
}
// 서버 구분 설정(개발:D, 테스트:T, 온라인:P)
CommonConstants.SERVER_TYPE = systemMode;
// 모니터링 테마 적용
String tColor = System.getProperty(EmsConfig.THEME_COLOR);
if (tColor == null || "".equals(tColor)) {
System.setProperty(EmsConfig.THEME_COLOR, themeColor);
}
if (debug) {
logger.debug(EmsConfig.DR_MODE + " = " + drMode);
}
// env 프라퍼티 파일만 있음 dr 여부 셋팅
System.setProperty(EmsConfig.DR_MODE, drMode);
// 데이터 소스타입(DEV:개발 / STG:스테이징 / PRD:운영 ... )
String eDatasourceType = System.getProperty(EmsConfig.DATASOURCE_TYPE);
if (eDatasourceType == null || "".equals(eDatasourceType)) {
System.setProperty(EmsConfig.DATASOURCE_TYPE, eaiDatasourceType);
}
if (debug) {
logger.debug(EmsConfig.DATASOURCE_TYPE + " =" + eaiDatasourceType); // env 프라퍼티
}
if (debug) {
logger.debug("SERVER_TYPE =" + CommonConstants.SERVER_TYPE);
}
if (debug) {
logger.debug("PortalSchemaProviderHolder initialized with tableOwner: " + tableOwner);
}
}
public void destroy() {
AdapterStatusSendThreadPool.destroy();
if (debug) {
logger.debug("############ e-link WebApplication stopping... preStop ############");
}
}
@Override
public void afterPropertiesSet() throws Exception {
init();
init();
}
}
}
@@ -11,6 +11,7 @@ import javax.persistence.Id;
import javax.persistence.Table;
import org.hibernate.annotations.Comment;
import org.hibernate.annotations.GenericGenerator;
import org.springframework.data.annotation.CreatedBy;
import org.springframework.data.annotation.CreatedDate;
@@ -30,7 +31,20 @@ public class UserAthrRoleChgHistory extends AbstractEntity<String> implements Se
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
// @GeneratedValue(strategy = GenerationType.IDENTITY)
@GenericGenerator(
name = "TB_APIMS_USER_ATHR_ROLE_CHG_H_GEN",
strategy = "com.eactive.eai.rms.data.jpa.SchemaPrefixedSequenceGenerator",
parameters = {
@org.hibernate.annotations.Parameter(name = "sequence_name", value = "TB_APIMS_USER_ATHR_ROLE_CHG_H_SEQ"),
@org.hibernate.annotations.Parameter(name = "initial_value", value = "1"),
@org.hibernate.annotations.Parameter(name = "increment_size", value = "1")
}
)
@GeneratedValue(
strategy = GenerationType.SEQUENCE,
generator = "TB_APIMS_USER_ATHR_ROLE_CHG_H_GEN"
)
@Column(name = "CHG_LOG_ID", unique = true, nullable = false)
@Comment("사용자 정보 변경 로그 식별 ID")
private int chgLogId;
@@ -11,6 +11,7 @@ import javax.persistence.Id;
import javax.persistence.Table;
import org.hibernate.annotations.Comment;
import org.hibernate.annotations.GenericGenerator;
import org.springframework.data.annotation.CreatedDate;
import com.eactive.eai.data.entity.AbstractEntity;
@@ -30,7 +31,20 @@ public class UserLoginHistory extends AbstractEntity<String> implements Serializ
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
// @GeneratedValue(strategy = GenerationType.IDENTITY)
@GenericGenerator(
name = "TB_APIMS_LOIN_L_GEN",
strategy = "com.eactive.eai.rms.data.jpa.SchemaPrefixedSequenceGenerator",
parameters = {
@org.hibernate.annotations.Parameter(name = "sequence_name", value = "TB_APIMS_LOIN_L_GEN_SEQ"),
@org.hibernate.annotations.Parameter(name = "initial_value", value = "1"),
@org.hibernate.annotations.Parameter(name = "increment_size", value = "1")
}
)
@GeneratedValue(
strategy = GenerationType.SEQUENCE,
generator = "TB_APIMS_LOIN_L_GEN"
)
@Column(name="LOIN_LOG_ID", unique = true, nullable = false)
@Comment("로그인 로그 식별자")
private int loginLogId;
@@ -37,5 +37,4 @@ public class CustomRevisionEntity {
@Column(name = "USERID")
@Comment("변경자ID")
private String userId;
}