본문 바로가기

Spring/Spring Data JPA26

mybatis Cause: java.lang.IllegalArgumentException: argument type mismatch” mybatis Cause: java.lang.IllegalArgumentException: argument type mismatch” Mybatis 에서 데이터 조회시 다음과 같은 오류가 날때는 Mybatis 특성에 대해 알고 있어야 대응이 가능 하다. Caused by: org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.reflection.ReflectionException: Error instantiating class com.cjenm.report.library.domain.entity.JobEntity with invalid types (Job) or values (16). Cause: java.lang.. 2021. 4. 29.
mybatis association, inner class , embeded mybatis association, inner class , embeded innerclass를 이요해서 mybatis 의 Obejct 맵팽을 위해서는 다음과 같이 사용 할 수 있다. 특히 JPA 사용사 멀티 PK를 사용한 Entity 를 사용시 @embeded 를 이요한 내부 Class 를 이용할때 혹은 객체를 이용할때 association tag는 유용하다. innnerClass 선택은 xml 에서 $을 . 대신에 사용해 준다. Entity Class 생성 AdsEntityPK 를 내부 Class로 가지고 있다. @Entity @Table(name = "ads") @Getter@Setter @EqualsAndHashCode(callSuper = true, exclude = {"adGroupEntit.. 2021. 4. 29.
mybatis 문법 foreach mybatis 문법 foreach 리스트객체로 보낼경우 parameterType="java.util.List" , collection = "list"로 받아서 처리 한다. item 은 el tag 안에서 사용할 변수명 this.jobMapper.findAllByJobId(List.of(masterJobId) SELECT `job_execution_id`, `master_job_id` as `job_id`, `job_name`, `total_size`, `processed_count`, `start_time`, `end_time`, `status`, `exit_status`, `message`, `request_details`, `requester`, `last_update` FROM `ae_report`.. 2021. 4. 29.
JPA Inner Join , left join JPA Inner Join , left join JPA로 저장이 잘되던 내역이 갑자기 저장이 되지 않고 중복에러를 뱉어 냈다. 어째든 내가 어딘가를 수정 했겠지.. save 시에 저장되는 쿼리를 살펴 보니 inner join 형태로 조인되어 지고 있었다. 1:1 관계로 맺어둔 엔티티들이 문제였다. (이래서 왠만하면 1:N 으로 묶는구나 싶었다.) 1:1 상황에서 연관된 객체를 영속성있게 해주지 않으면 부모 객체의 PK 값만 넣어줬을때 조회후 중복으로 체크되어 if (entityInformation.isNew(entity)) 에서 true로 merge 되도록 하지만 중복 오류가 발생된다. merge문을 타도록 되어 있지만 sql 로그에 찍히는 걸보면 insert 문이 찍힌다. - 연관된 1:1 객체는 모두.. 2020. 9. 8.
728x90