config: config set
parent
5ed807b717
commit
faa273f382
@ -1,16 +1,15 @@
|
||||
package com.xit.core.support;
|
||||
|
||||
import org.springframework.jdbc.support.JdbcUtils;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
public class CamelCaseLinkedMap extends LinkedHashMap {
|
||||
|
||||
@Override
|
||||
public Object put(Object key, Object value){
|
||||
if(key != null && key.toString().contains("_")) return super.put(JdbcUtils.convertUnderscoreNameToPropertyName((String)key), value);
|
||||
else return super.put(key, value);
|
||||
//if(key != null && key.toString().contains("_")) return super.put(JdbcUtils.convertUnderscoreNameToPropertyName((String)key), value);
|
||||
//else return super.put(key, value);
|
||||
return super.put(key, value);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,18 +0,0 @@
|
||||
package com.xit.core.support.jpa;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.repository.NoRepositoryBean;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* Repository 재정의
|
||||
* NoRepositoryBean annotaion 필수
|
||||
*
|
||||
* @author Lim, Jong Uk (minuk926)
|
||||
* @since 2021-07-22
|
||||
*/
|
||||
@NoRepositoryBean
|
||||
public interface ISimpleRepository<T, ID extends Serializable> extends JpaRepository<T, ID> { //Repository<T, ID> {
|
||||
boolean contains(T entity);
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
package com.xit.core.support.jpa;
|
||||
|
||||
import org.springframework.data.jpa.repository.support.JpaEntityInformation;
|
||||
import org.springframework.data.jpa.repository.support.SimpleJpaRepository;
|
||||
|
||||
import javax.persistence.EntityManager;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 기본 구현체 확장
|
||||
* 사용하려면 @EnableJpaRepositories의 repositoryBaseClass로 지정하고
|
||||
* 각 Repository는 ISimpleRepository를 상속 받도록 한다
|
||||
*
|
||||
* querydsl 사용시도 동일
|
||||
* ( SimpleJpaRepository가 아니라 QuerydslJpaRepository를 상속 받아야 했으나
|
||||
* 버전이 올라 가면서 deprecated 됨)
|
||||
*
|
||||
* @param <T>
|
||||
* @param <ID>
|
||||
*/
|
||||
//public class SimpleBaseRepository<T, ID extends Serializable> extends QuerydslJpaRepository<T, ID> implements ISimpleRepository<T, ID>{
|
||||
public class SimpleBaseRepository<T, ID extends Serializable> extends SimpleJpaRepository<T, ID> implements ISimpleRepository<T, ID>{
|
||||
|
||||
private final EntityManager em;
|
||||
|
||||
public SimpleBaseRepository(JpaEntityInformation<T, ?> entityInformation, EntityManager em) {
|
||||
super(entityInformation, em);
|
||||
this.em = em;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean contains(T entity) {
|
||||
return em.contains(entity);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue