본문 바로가기
728x90
반응형
SMALL

mybatis6

Spring Boot - MyBatis 연동 1. pom.xml 필요한 dependency 설정 (jdbc, mybatis, mysql-connector) ... org.springframework.boot spring-boot-starter-jdbc org.mybatis.spring.boot mybatis-spring-boot-starter 1.3.2 mysql mysql-connector-java runtime ... 2. application.properties spring.datasource.url=jdbc:mysql://IP:PORT/test?useUnicode=true&zeroDateTimeBehavior=convertToNull&characterEncoding=utf8 spring.datasource.username=아이디 spring.. 2018. 8. 29.
Error getting generated key or setting result to parameter object unique or primary key 가 있는 table 에 아래와 같이 insert 할 경우 INSERT INTO test_table ( idx, name, age ) VALUES ( #{idx}, #{name}, #{age}) Error getting generated key or setting result to parameter object 이럴 때는 를 이용한다. INSERT INTO test_table ( idx, name, age ) VALUES ( #{idx}, #{name}, #{age}) select LAST_INSERT_ID() AS idx 2014. 7. 14.
commit / rollback - MyBatis public void updateSample(testDto param) throws Exception{ SqlSession tmpSession = sqlSessionFactory.openSession(); try{ // Delete all tmpSession.delete("deleteSample", param); // Insert New Data tmpSession.insert("insertSample", param); tmpSession.commit(); }catch(Exception e){ tmpSession.rollback(); logger.error("TestDao updateSample e : "+e.getMessage()); throw e; }finally{ if(tmpSes.. 2013. 12. 24.
ibatis like 검색 oracle, ms-sql, mysql 1. oracle O_LOCALCODE like '%' || #cowNo# || '%' 2. ms-sqlO_LOCALCODE like '%'+#cowNo#+'%' 3. mysql O_LOCALCODE LIKE CONCAT('%', #cowNo#, '%') 2013. 12. 24.
728x90
반응형
LIST