Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ private static List<Book> getBooksByIds(int... ids) {
return Arrays.stream(ids)
.mapToObj(id -> testingBooks.stream()
.filter(c -> c.id == id)
.findFirst()
.findAny()
.orElseThrow(() -> fail("id does not exist: " + id)))
.toList();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ private static List<Contact> getTestingContacts(int... ids) {
return Arrays.stream(ids)
.mapToObj(id -> testingContacts.stream()
.filter(c -> c.id == id)
.findFirst()
.findAny()
.orElseThrow(() -> fail("id does not exist: " + id)))
.toList();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ private static List<Book> getBooksByIds(int... ids) {
return Arrays.stream(ids)
.mapToObj(id -> testingBooks.stream()
.filter(c -> c.id == id)
.findFirst()
.findAny()
.orElseThrow(() -> fail("id does not exist: " + id)))
.toList();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ private static List<Item> getTestItems(int... ids) {
return Arrays.stream(ids)
.mapToObj(id -> ITEMS.stream()
.filter(c -> c.id == id)
.findFirst()
.findAny()
.orElseThrow(() -> fail("id does not exist: " + id)))
.toList();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,13 @@ void testRoundTripSessionTzsEqual(ZoneId systemTimeZone, ZoneId sessionTimeZone,
name = "testRoundTripWriteAndReadPathTzsNotEqual: Write(sys={0}, sess={0}). Read(sys={1}, sess={1})")
@MethodSource("instantPersistAndReadParameters")
void testRoundTripWriteAndReadPathTzsNotEqual(
ZoneId writeTimeZonePath, ZoneId readTimeZonePath, Instant toSave, Instant toRead) throws Exception {
ZoneId writePathTimeZone, ZoneId readPathTimeZone, Instant toSave, Instant toRead) throws Exception {
var instantItem = new Item(1, toSave);
withSystemTimeZone(
writeTimeZonePath, () -> inTransaction(writeTimeZonePath, session -> session.persist(instantItem)));
writePathTimeZone, () -> inTransaction(writePathTimeZone, session -> session.persist(instantItem)));
var loadedInstantItem = withSystemTimeZone(
readTimeZonePath,
() -> fromTransaction(readTimeZonePath, session -> session.find(Item.class, instantItem.id)));
readPathTimeZone,
() -> fromTransaction(readPathTimeZone, session -> session.find(Item.class, instantItem.id)));

var expectedItem = new Item(1, toRead);
assertEq(expectedItem, loadedInstantItem);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ void unsupported() {
new ItemWithNestedAggregateEmbeddableWithBasicPersistentAttribute<Time>() {}.getClass()),
() -> assertNotSupported(
new ItemWithNestedAggregateEmbeddableWithArrayPersistentAttribute<Time>() {}.getClass()),
() -> assertNotSupported(
new ItemWithNestedAggregateEmbeddableWithCollectionPersistentAttribute<Time>() {}.getClass()),
() -> assertNotSupported(new ItemWithNestedCollectionOfAggregateEmbeddable<Time>() {}.getClass()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ void unsupported() {
new ItemWithNestedAggregateEmbeddableWithBasicPersistentAttribute<Timestamp>() {}.getClass()),
() -> assertNotSupported(
new ItemWithNestedAggregateEmbeddableWithArrayPersistentAttribute<Timestamp>() {}.getClass()),
() -> assertNotSupported(
new ItemWithNestedAggregateEmbeddableWithCollectionPersistentAttribute<
Timestamp>() {}.getClass()),
() -> assertNotSupported(new ItemWithNestedCollectionOfAggregateEmbeddable<Timestamp>() {}.getClass()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,13 @@
import jakarta.persistence.Id;
import java.util.Collection;
import org.hibernate.annotations.Struct;
import org.hibernate.type.descriptor.java.JavaType;

/**
* NOTE: List of unsupported entities could include an entity with an array of aggregate embeddables (and the same case
* with nested aggregate embeddables). Hibernate ORM currently maps such arrays as {@link org.hibernate.type.BasicType}
* instead of {@link org.hibernate.type.BasicArrayType} when the element type is a parameterized generic class. For
* non-parameterized entities this mapping works; therefore these use cases are omitted from testing.
* NOTE: An entity with a field that is an array of aggregate embeddables (and the same case with nested aggregate
* embeddables) is not included in the unsupported-items test set. Hibernate ORM currently maps such arrays as
* {@link org.hibernate.type.BasicType} instead of {@link org.hibernate.type.BasicArrayType} when the component type is
* a parameterized type, which causes validation not to catch the unsupported {@link JavaType} usage.
*/
final class UnsupportedItems {

Expand Down Expand Up @@ -177,7 +178,7 @@ static class ItemWithNestedCollectionOfAggregateEmbeddable<T> {
@Id
int id;

AggregateEmbeddableWithCollectionOfAggregateEmbeddableWithBasicPersistentAttribute<T> v;
AggregateEmbeddableWithCollectionOfAggregateEmbeddablePersistentAttribute<T> v;
}

@Embeddable
Expand Down Expand Up @@ -248,7 +249,7 @@ static class AggregateEmbeddableNestedWithCollectionPersistentAttribute<T> {

@Struct(name = "AggregateEmbeddableWithCollectionOfAggregateEmbeddableWithBasicPersistentAttribute")
@Embeddable
static class AggregateEmbeddableWithCollectionOfAggregateEmbeddableWithBasicPersistentAttribute<T> {
static class AggregateEmbeddableWithCollectionOfAggregateEmbeddablePersistentAttribute<T> {
Collection<AggregateEmbeddableWithBasicPersistentAttribute<T>> v;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ void unsupported() {
() -> assertNotSupported(
new ItemWithNestedAggregateEmbeddableWithArrayPersistentAttribute<
ZonedDateTime>() {}.getClass()),
() -> assertNotSupported(
new ItemWithNestedAggregateEmbeddableWithCollectionPersistentAttribute<
ZonedDateTime>() {}.getClass()),
() -> assertNotSupported(
new ItemWithNestedCollectionOfAggregateEmbeddable<ZonedDateTime>() {}.getClass()));
}
Expand Down