Go to 코딩천재/Spring(5)
-
[MVC프로젝트] #3. Mybatis와 MS-SQL 이용하기 Tips
1. SQL 제약조건 예외 처리 OKKY | 스프링 환경에서 마이바티스 쿼리실행시 예외처리 하는방법 테이블의 특정 행을 삭제하고자 할때 그 행을 참조하는 자식 레코드가 있을경우 SQLIntegrityConstraintViolationException 이 발생합니다 위 익셉션이 발생했을때 삭제할수없습니다 라는 알림창을 띄우고 싶은데 try{ sqlSession.delete( blog.deleteCategory , category okky.kr 2. MS-SQL의 날짜(DATETIME/DATE) 처리 - 문자형 → 날짜형 [MS-SQL] 문자를 날짜형식(타입)으로 변경 (CONVERT, TO_DATE) SQL Server 2008, SQL Server 2012 문자(VARCHAR)를 날짜형식(타입)으로 변경..
2019.09.22 -
[MVC프로젝트] #2 MyBatis 연동하기 (ORACLE, MS-SQL)
* DBCP2 사용 기준 * 트랜잭션 관리 설정한 기준 ORACLE 기준 STEP 1 . webapp - [META-INF] - context.xml 생성 후, dataSource 객체 정의 WEB-INF/web.xml STEP 2 . webapp - [WEB-INF] - mybatis - configuration.xml 생성 - configuration.xml : DTO 클래스 alias 추가할 파일 ... STEP 3 . webapp - [WEB-INF] - mybatis - mapper_xxxx.xml 생성 - mapper_xxxx.xml : SQL문 작성할 파일 select a, b, c from table STEP 4 . root-context.xml에서 sqlSession 객체 정의 - nam..
2019.09.21 -
[MVC프로젝트] #1 Spring Legacy Project 생성
STEP 1 . Spring Legacy Project 생성 (MVC 프로젝트) STEP 2 . 프로젝트 파일의 Properties 설정 [build path] ① JRE-System Library - edit - 'workspace default JRE ( ... )' 체크 ② Add Library - Server Runtime 라이브러리 - tomcat 8.5 server 추가 [Java Compiler] ① 'use default compilance from execution ...' 체크 해제 ② 'use default compilance settings' 체크 ③ 오른쪽 버전 변경 (1.8) [Project Facets] ① Dynamic Web Module 버전 변경 (3.1) ② Java 버..
2019.09.21 -
[Error] #2 org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'xxxController': Unsatisfied dependency expressed through field 'xxxService';
원인 - 컨트롤러, 서비스 등의 빈 생성 문제 - 나의 경우 : @Service 클래스에 sqlSession 객체를 선언 후, @Autowired를 지정했는데 sqlSession 설정을 하지 않음.. 해결방법 - 나의 경우 : root-context.xml에 sqlSession 객체 생성 - 참고 : https://liante0904.tistory.com/113 [Spring] 빈 생성 에러 디버그 Error creating bean with name 'XXX' 스프링은 자바에서 MVC 패턴을 이용해 개발을 할 수 있게 도와준다. 또한 자바의 철학에 맞게 확실한 데이터 형과 문법, 그리고 Bean이라는 개념을 통해 객체 지향 프로그래밍을 사용하고.. 이를 통해 협업을 할.. liante0904.tisto..
2019.09.21 -
[Error] #1 No mapping found for HTTP request with URI
[원인] 설정파일 또는 url mapping 문제 [해결방법] 1. web.xml의 DispatcherServlet 설정 확인 2. servlet-context.xml의 component:scan 설정 확인 3. 컨트롤러의 url mapping 확인 4. servlet-context.xml의 mvc:annotation-driven 선언 확인 참고 : https://stufeel.tistory.com/8 No mapping found for HTTP request with URI 에러 원인 1. web.xml 에서 DispatcherServlet 선언이 제대로 되어있는지 확인 appServlet org.springframework.web.servlet.DispatcherServlet
2019.09.21