|
|
|
@ -28,12 +28,9 @@ import java.util.ArrayList; |
|
|
|
import java.util.function.Function; |
|
|
|
import java.util.function.Function; |
|
|
|
import java.util.stream.IntStream; |
|
|
|
import java.util.stream.IntStream; |
|
|
|
|
|
|
|
|
|
|
|
import org.assertj.core.api.Assertions; |
|
|
|
|
|
|
|
import org.assertj.core.api.SoftAssertions; |
|
|
|
|
|
|
|
import org.junit.jupiter.api.Test; |
|
|
|
import org.junit.jupiter.api.Test; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.context.ApplicationContext; |
|
|
|
import org.springframework.context.ApplicationContext; |
|
|
|
import org.springframework.context.ApplicationEventPublisher; |
|
|
|
|
|
|
|
import org.springframework.context.annotation.Bean; |
|
|
|
import org.springframework.context.annotation.Bean; |
|
|
|
import org.springframework.context.annotation.Configuration; |
|
|
|
import org.springframework.context.annotation.Configuration; |
|
|
|
import org.springframework.context.annotation.Import; |
|
|
|
import org.springframework.context.annotation.Import; |
|
|
|
@ -54,7 +51,6 @@ import org.springframework.data.jdbc.testing.IntegrationTest; |
|
|
|
import org.springframework.data.jdbc.testing.TestClass; |
|
|
|
import org.springframework.data.jdbc.testing.TestClass; |
|
|
|
import org.springframework.data.jdbc.testing.TestConfiguration; |
|
|
|
import org.springframework.data.jdbc.testing.TestConfiguration; |
|
|
|
import org.springframework.data.jdbc.testing.TestDatabaseFeatures; |
|
|
|
import org.springframework.data.jdbc.testing.TestDatabaseFeatures; |
|
|
|
import org.springframework.data.mapping.callback.EntityCallbacks; |
|
|
|
|
|
|
|
import org.springframework.data.mapping.context.InvalidPersistentPropertyPath; |
|
|
|
import org.springframework.data.mapping.context.InvalidPersistentPropertyPath; |
|
|
|
import org.springframework.data.relational.core.conversion.DbActionExecutionException; |
|
|
|
import org.springframework.data.relational.core.conversion.DbActionExecutionException; |
|
|
|
import org.springframework.data.relational.core.mapping.Column; |
|
|
|
import org.springframework.data.relational.core.mapping.Column; |
|
|
|
@ -1332,20 +1328,20 @@ abstract class AbstractJdbcAggregateTemplateIntegrationTests { |
|
|
|
assertThat(enumMapOwners).containsExactly(enumMapOwner); |
|
|
|
assertThat(enumMapOwners).containsExactly(enumMapOwner); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test //GH-2064
|
|
|
|
@Test // GH-2064
|
|
|
|
void saveAllBeforeConvertCallback() { |
|
|
|
void saveAllBeforeConvertCallback() { |
|
|
|
var first = new BeforeConvertCallbackForSaveBatch("first"); |
|
|
|
|
|
|
|
var second = new BeforeConvertCallbackForSaveBatch("second"); |
|
|
|
BeforeConvertCallbackForSaveBatch first = new BeforeConvertCallbackForSaveBatch("first"); |
|
|
|
var third = new BeforeConvertCallbackForSaveBatch("third"); |
|
|
|
BeforeConvertCallbackForSaveBatch second = new BeforeConvertCallbackForSaveBatch("second"); |
|
|
|
|
|
|
|
BeforeConvertCallbackForSaveBatch third = new BeforeConvertCallbackForSaveBatch("third"); |
|
|
|
|
|
|
|
|
|
|
|
template.saveAll(List.of(first, second, third)); |
|
|
|
template.saveAll(List.of(first, second, third)); |
|
|
|
|
|
|
|
|
|
|
|
var allEntriesInTable = template.findAll(BeforeConvertCallbackForSaveBatch.class); |
|
|
|
List<BeforeConvertCallbackForSaveBatch> allEntriesInTable = template |
|
|
|
|
|
|
|
.findAll(BeforeConvertCallbackForSaveBatch.class); |
|
|
|
|
|
|
|
|
|
|
|
Assertions.assertThat(allEntriesInTable) |
|
|
|
assertThat(allEntriesInTable).hasSize(3).extracting(BeforeConvertCallbackForSaveBatch::getName) |
|
|
|
.hasSize(3) |
|
|
|
.containsExactlyInAnyOrder("first", "second", "third"); |
|
|
|
.extracting(BeforeConvertCallbackForSaveBatch::getName) |
|
|
|
|
|
|
|
.containsOnly("first", "second", "third"); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test // GH-1684
|
|
|
|
@Test // GH-1684
|
|
|
|
@ -2175,9 +2171,8 @@ abstract class AbstractJdbcAggregateTemplateIntegrationTests { |
|
|
|
return id; |
|
|
|
return id; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public BeforeConvertCallbackForSaveBatch setId(String id) { |
|
|
|
public void setId(String id) { |
|
|
|
this.id = id; |
|
|
|
this.id = id; |
|
|
|
return this; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public String getName() { |
|
|
|
public String getName() { |
|
|
|
@ -2215,12 +2210,14 @@ abstract class AbstractJdbcAggregateTemplateIntegrationTests { |
|
|
|
|
|
|
|
|
|
|
|
@Table |
|
|
|
@Table |
|
|
|
static class WithInsertOnly { |
|
|
|
static class WithInsertOnly { |
|
|
|
|
|
|
|
|
|
|
|
@Id Long id; |
|
|
|
@Id Long id; |
|
|
|
@InsertOnlyProperty String insertOnly; |
|
|
|
@InsertOnlyProperty String insertOnly; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Table |
|
|
|
@Table |
|
|
|
static class MultipleCollections { |
|
|
|
static class MultipleCollections { |
|
|
|
|
|
|
|
|
|
|
|
@Id Long id; |
|
|
|
@Id Long id; |
|
|
|
String name; |
|
|
|
String name; |
|
|
|
List<ListElement> listElements = new ArrayList<>(); |
|
|
|
List<ListElement> listElements = new ArrayList<>(); |
|
|
|
|