본문 바로가기

Java/JPA with Error25

[해결방법] duplicateKeyException duplicateKeyExceptionEnvironmentLanguage: JavaDB: MySQL 오류Caused by: java.lang.IllegalStateException: Duplicate key 400 BAD_REQUEST (attempted merging values DUPLICATED_EMAIL and NOT_EQUAL_PASSWORD) at java.base/java.util.stream.Collectors.duplicateKeyException(Collectors.java:135) at java.base/java.util.stream.Collectors.lambda$uniqKeysMapAccumulator$1(Collectors.java:182)  원인DUPLICATED_EMAIL(H.. 2024. 8. 12.
[해결방법] EmptyResultDataAccessException EmptyResultDataAccessExceptionEnvironmentLanguage: JavaDB: MySQL 오류Caused by: jakarta.persistence.NoResultException: No result found for query [select u from User u where u.email = :email] at org.hibernate.query.spi.AbstractSelectionQuery.getSingleResult(AbstractSelectionQuery.java:476) at com.msgs.user.repository.UserRepository.findByEmail(UserRepository.java:19)  원인public Optional findByEmail(.. 2024. 8. 11.
[해결방법] JdbcTypeRecommendationException JdbcTypeRecommendationException Environment Language: Java DB: H2 Database IDE: IntelliJ Problem @Entity를 선언하고 table을 create할 때 발생 Caused by: org.hibernate.type.descriptor.java.spi.JdbcTypeRecommendationException: Could not determine recommended JdbcType for Java type 'jpabook.jpashop.domain.Delivery' Cause of Problem Hibernate가 엔티티의 필드에 대한 JDBC 타입을 결정하지 못할 때 발생 엔티티 필드와 데이터베이스 컬럼 간의 매핑이 충분히 명시되지.. 2023. 12. 25.
[해결방법] BeanCreationException BeanCreationException Environment Language: Java DB: H2 Database IDE: IntelliJ Problem Entity에서 PK에 @Id를 설정하고, @GeneratedValue를 통해 자동으로 값을 부여하고자 할 때 발생 org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: [PersistenceUnit: defau.. 2023. 12. 25.
[해결 방법] org.hibernate.resource.jdbc.internal.LogicalConnectionManagedImpl ... is closed 👉 기본 환경 - Language: Java - DB: H2 Database - IDE: IntelliJ 테스트 코드가 안돌아갑니다. Transaction이 closed 됐다고 안돌아갑니다😖. ⌨️ 코드 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 @SpringBootTest public class PostServiceTest { @Autowired private PostService postService; @Autowired private PostRepository postRepository; @Test public void DTO데이터_POST테이블_조회(){ // given PostSaveDTO.. 2023. 10. 8.
[해결 방법] org.hibernate.QueryException 👉 기본 환경 - Language: Java - DB: H2 Database - IDE: IntelliJ ⌨️ 코드 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 public class Main { public static void main(String[] args) { // 생략 try { Team team = new Team(); team.setName("Team"); em.persist(team); Member member = new Member(); member.setName("Member"); member.setAge(10); member.set.. 2023. 9. 26.