BAEL-6346 - Fixes according to editor comments

This commit is contained in:
ICKostiantyn.Ivanov 2024-04-15 07:54:29 +02:00
parent b1ae6680d8
commit 55769583dd
16 changed files with 36 additions and 35 deletions

View File

@ -17,7 +17,7 @@
<dependency>
<groupId>jakarta.persistence</groupId>
<artifactId>jakarta.persistence-api</artifactId>
<version>3.1.0</version>
<version>${jakarta.persistence-api.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
@ -147,6 +147,7 @@
<postgresql.version>42.7.1</postgresql.version>
<db.util.version>1.0.7</db.util.version>
<hypersistence-utils.version>3.7.0</hypersistence-utils.version>
<jakarta.persistence-api.version>3.1.0</jakarta.persistence-api.version>
</properties>
</project>

View File

@ -1,4 +1,4 @@
package com.baeldung.spring.notamanagedtypeexceptioninspringdatajpa.entitywithjakartaannotation;
package com.baeldung.spring.notamanagedtype.jakartaannotation;
import jakarta.persistence.Entity;
import jakarta.persistence.Id;

View File

@ -1,4 +1,4 @@
package com.baeldung.spring.notamanagedtypeexceptioninspringdatajpa.entitywithjakartaannotation;
package com.baeldung.spring.notamanagedtype.jakartaannotation;
import org.springframework.boot.autoconfigure.SpringBootApplication;

View File

@ -1,4 +1,4 @@
package com.baeldung.spring.notamanagedtypeexceptioninspringdatajpa.entitywithjakartaannotation;
package com.baeldung.spring.notamanagedtype.jakartaannotation;
import org.springframework.data.jpa.repository.JpaRepository;

View File

@ -1,4 +1,4 @@
package com.baeldung.spring.notamanagedtypeexceptioninspringdatajpa.entitywithoutannotation;
package com.baeldung.spring.notamanagedtype.missedannotation;
import javax.persistence.Id;

View File

@ -1,4 +1,4 @@
package com.baeldung.spring.notamanagedtypeexceptioninspringdatajpa.entitywithoutannotation;
package com.baeldung.spring.notamanagedtype.missedannotation;
import org.springframework.boot.autoconfigure.SpringBootApplication;

View File

@ -1,4 +1,4 @@
package com.baeldung.spring.notamanagedtypeexceptioninspringdatajpa.entitywithoutannotation;
package com.baeldung.spring.notamanagedtype.missedannotation;
import org.springframework.data.jpa.repository.JpaRepository;

View File

@ -1,4 +1,4 @@
package com.baeldung.spring.notamanagedtypeexceptioninspringdatajpa.entitywithoutannotationfixed;
package com.baeldung.spring.notamanagedtype.missedannotationfixed;
import javax.persistence.Entity;
import javax.persistence.Id;

View File

@ -1,4 +1,4 @@
package com.baeldung.spring.notamanagedtypeexceptioninspringdatajpa.entitywithoutannotationfixed;
package com.baeldung.spring.notamanagedtype.missedannotationfixed;
import org.springframework.boot.autoconfigure.SpringBootApplication;

View File

@ -1,4 +1,4 @@
package com.baeldung.spring.notamanagedtypeexceptioninspringdatajpa.entitywithoutannotationfixed;
package com.baeldung.spring.notamanagedtype.missedannotationfixed;
import org.springframework.data.jpa.repository.JpaRepository;

View File

@ -1,4 +1,4 @@
package com.baeldung.spring.notamanagedtypeexceptioninspringdatajpa.wrongentityscanapplication.app;
package com.baeldung.spring.notamanagedtype.missedentityscan.app;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;

View File

@ -1,4 +1,4 @@
package com.baeldung.spring.notamanagedtypeexceptioninspringdatajpa.wrongentityscanapplication.entity;
package com.baeldung.spring.notamanagedtype.missedentityscan.entity;
import javax.persistence.Entity;
import javax.persistence.Id;

View File

@ -1,4 +1,4 @@
package com.baeldung.spring.notamanagedtypeexceptioninspringdatajpa.wrongentityscanapplication.fixed.app;
package com.baeldung.spring.notamanagedtype.missedentityscan.fixed.app;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.domain.EntityScan;

View File

@ -0,0 +1,9 @@
package com.baeldung.spring.notamanagedtype.missedentityscan.repository;
import org.springframework.data.jpa.repository.JpaRepository;
import com.baeldung.spring.notamanagedtype.missedentityscan.entity.CorrectEntity;
public interface CorrectEntityRepository extends JpaRepository<CorrectEntity, Long> {
}

View File

@ -1,9 +0,0 @@
package com.baeldung.spring.notamanagedtypeexceptioninspringdatajpa.wrongentityscanapplication.repository;
import org.springframework.data.jpa.repository.JpaRepository;
import com.baeldung.spring.notamanagedtypeexceptioninspringdatajpa.wrongentityscanapplication.entity.CorrectEntity;
public interface CorrectEntityRepository extends JpaRepository<CorrectEntity, Long> {
}

View File

@ -1,4 +1,4 @@
package com.baeldung.spring.notamanagedtypeexceptioninspringdatajpa;
package com.baeldung.spring.notamanagedtype;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.assertThrows;
@ -7,17 +7,17 @@ import static org.springframework.boot.SpringApplication.run;
import org.junit.jupiter.api.Test;
import org.springframework.context.ConfigurableApplicationContext;
import com.baeldung.spring.notamanagedtypeexceptioninspringdatajpa.entitywithoutannotation.EntityWithoutAnnotationApplication;
import com.baeldung.spring.notamanagedtypeexceptioninspringdatajpa.entitywithoutannotationfixed.EntityWithoutAnnotationFixedApplication;
import com.baeldung.spring.notamanagedtypeexceptioninspringdatajpa.entitywithoutannotationfixed.EntityWithoutAnnotationFixedRepository;
import com.baeldung.spring.notamanagedtypeexceptioninspringdatajpa.entitywithjakartaannotation.EntityWithJakartaAnnotationApplication;
import com.baeldung.spring.notamanagedtypeexceptioninspringdatajpa.wrongentityscanapplication.app.WrongEntityScanApplication;
import com.baeldung.spring.notamanagedtypeexceptioninspringdatajpa.wrongentityscanapplication.fixed.app.WrongEntityScanFixedApplication;
import com.baeldung.spring.notamanagedtypeexceptioninspringdatajpa.wrongentityscanapplication.repository.CorrectEntityRepository;
import com.baeldung.spring.notamanagedtype.missedannotation.EntityWithoutAnnotationApplication;
import com.baeldung.spring.notamanagedtype.missedannotationfixed.EntityWithoutAnnotationFixedApplication;
import com.baeldung.spring.notamanagedtype.missedannotationfixed.EntityWithoutAnnotationFixedRepository;
import com.baeldung.spring.notamanagedtype.jakartaannotation.EntityWithJakartaAnnotationApplication;
import com.baeldung.spring.notamanagedtype.missedentityscan.app.WrongEntityScanApplication;
import com.baeldung.spring.notamanagedtype.missedentityscan.fixed.app.WrongEntityScanFixedApplication;
import com.baeldung.spring.notamanagedtype.missedentityscan.repository.CorrectEntityRepository;
class NotManagedTypeExceptionIntegrationTest {
@Test
void givenEntityWithoutAnnotationApplicationWhenBootstrapThenExpectedExceptionThrown() {
void givenEntityWithoutAnnotationApplication_WhenBootstrap_ThenExpectedExceptionThrown() {
Exception exception = assertThrows(Exception.class,
() -> run(EntityWithoutAnnotationApplication.class));
@ -27,7 +27,7 @@ class NotManagedTypeExceptionIntegrationTest {
}
@Test
void givenEntityWithoutAnnotationApplicationFixedWhenBootstrapThenRepositoryBeanShouldBePresentInContext() {
void givenEntityWithoutAnnotationApplicationFixed_WhenBootstrap_ThenRepositoryBeanShouldBePresentInContext() {
ConfigurableApplicationContext context = run(EntityWithoutAnnotationFixedApplication.class);
EntityWithoutAnnotationFixedRepository repository = context
.getBean(EntityWithoutAnnotationFixedRepository.class);
@ -36,7 +36,7 @@ class NotManagedTypeExceptionIntegrationTest {
}
@Test
void givenEntityWithJakartaAnnotationApplicationWhenBootstrapThenExpectedExceptionThrown() {
void givenEntityWithJakartaAnnotationApplication_WhenBootstrap_ThenExpectedExceptionThrown() {
Exception exception = assertThrows(Exception.class,
() -> run(EntityWithJakartaAnnotationApplication.class));
@ -46,7 +46,7 @@ class NotManagedTypeExceptionIntegrationTest {
}
@Test
void givenWrongEntityScanApplicationWhenBootstrapThenExpectedExceptionThrown() {
void givenWrongEntityScanApplication_WhenBootstrap_ThenExpectedExceptionThrown() {
Exception exception = assertThrows(Exception.class,
() -> run(WrongEntityScanApplication.class));
@ -56,7 +56,7 @@ class NotManagedTypeExceptionIntegrationTest {
}
@Test
void givenWrongEntityScanApplicationFixedWhenBootstrapThenRepositoryBeanShouldBePresentInContext() {
void givenWrongEntityScanApplicationFixed_WhenBootstrap_ThenRepositoryBeanShouldBePresentInContext() {
ConfigurableApplicationContext context = run(WrongEntityScanFixedApplication.class);
CorrectEntityRepository repository = context
.getBean(CorrectEntityRepository.class);