* 환경MySQL 5.5Hibernate 5 * - SQL Error: 0, SQLState: 08S01ERROR: org.hibernate.engine.jdbc.spi.SqlExceptionHelper - Communications link failure The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.5월 10, 2018 10:26:58 오후 org.apache.catalina.core.StandardWrapperValve invoke심각: Servlet.service() for servlet [appServlet] in ..
* 개요Hibernate 사용시 복수의 데이터베이스 연결하고 싶을때. * 절차 - 그냥 하던대로 하면 됨. 1. root-context 에 별도의 DataSource, SessionFactory, (+TransactionManager) Bean 정의 2. 별도의 hibernate.cfg.xml 정의3. DAO 에 SessionFactory @Autowired 로 연결하고 있다면@Qualifier("세션팩토리이름") 추가로 선언해줘야 함. - 안해주면 세션팩토리 하나일때와 달리, 찾을 수 없으므로 다음 예외 발생org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type 'org.hibernate.S..
* 개요 Hibernate 에서 composite key (복합키) 로 선언했을 때 하나의 컬럼은 자동 생성이 가능한가?ex : INSERT 그룹명은 지정해주고, 그룹내 번호는 DBMS 에 의해 자동 생성되는 경우 * 일반적인 composite id 선언 - 어노테이션 이용- composite id 선언시는 그냥 @Id 두개 붙이면 됨.- 하나의 컬럼을 자동생성하려면 해당 컬럼에 @GeneratedValue 선언으로 사용 가능MySQL 의 경우 1. numInGroup 컬럼에 Auto Increment 선언,2. 매핑되는 필드에 @GeneratedValue (strategy=GenerationType.IDENTITY) * 일반적인 composite id 선언 - XMLhbm.xml 에 다음과 같이 선언 ..