|
24 | 24 | import java.time.Instant;
|
25 | 25 | import java.time.LocalDate;
|
26 | 26 | import java.time.LocalDateTime;
|
| 27 | +import java.time.LocalTime; |
| 28 | +import java.time.OffsetDateTime; |
| 29 | +import java.time.ZoneId; |
27 | 30 | import java.time.ZoneOffset;
|
28 | 31 | import java.time.ZonedDateTime;
|
29 | 32 | import java.util.ArrayList;
|
|
36 | 39 | import java.util.Map;
|
37 | 40 | import java.util.Optional;
|
38 | 41 | import java.util.Set;
|
| 42 | +import java.util.TimeZone; |
39 | 43 | import java.util.UUID;
|
40 | 44 | import java.util.function.Consumer;
|
41 | 45 | import java.util.function.Function;
|
|
133 | 137 | import org.springframework.data.neo4j.integration.shared.common.KotlinPerson;
|
134 | 138 | import org.springframework.data.neo4j.integration.shared.common.LikesHobbyRelationship;
|
135 | 139 | import org.springframework.data.neo4j.integration.shared.common.MultipleLabels;
|
| 140 | +import org.springframework.data.neo4j.integration.shared.common.OffsetTemporalEntity; |
136 | 141 | import org.springframework.data.neo4j.integration.shared.common.OneToOneSource;
|
137 | 142 | import org.springframework.data.neo4j.integration.shared.common.OneToOneTarget;
|
138 | 143 | import org.springframework.data.neo4j.integration.shared.common.ParentNode;
|
@@ -4372,6 +4377,26 @@ void findByPropertyOnRelationshipWithPropertiesRelatedEntity(
|
4372 | 4377 | }
|
4373 | 4378 | }
|
4374 | 4379 |
|
| 4380 | + @Test // GH-2706 |
| 4381 | + void findByOffsetDateTimeShouldWork(@Autowired TemporalRepository temporalRepository) { |
| 4382 | + |
| 4383 | + temporalRepository.deleteAll(); |
| 4384 | + |
| 4385 | + LocalDateTime fixedDateTime = LocalDateTime.of(2023, 1, 1, 21, 21, 0); |
| 4386 | + ZoneId europeBerlin = TimeZone.getTimeZone("Europe/Berlin").toZoneId(); |
| 4387 | + OffsetDateTime v1 = OffsetDateTime.of(fixedDateTime, europeBerlin.getRules().getOffset(fixedDateTime)); |
| 4388 | + LocalTime v2 = fixedDateTime.toLocalTime(); |
| 4389 | + |
| 4390 | + temporalRepository.save(new OffsetTemporalEntity(v1, v2)); |
| 4391 | + temporalRepository.save(new OffsetTemporalEntity(v1.minusDays(2), v2.minusMinutes(2))); |
| 4392 | + |
| 4393 | + assertThat(temporalRepository.findAllByProperty1After(v1)).isEmpty(); |
| 4394 | + assertThat(temporalRepository.findAllByProperty2After(v2)).isEmpty(); |
| 4395 | + |
| 4396 | + assertThat(temporalRepository.findAllByProperty1After(v1.minusDays(1))).hasSize(1); |
| 4397 | + assertThat(temporalRepository.findAllByProperty2After(v2.minusMinutes(1))).hasSize(1); |
| 4398 | + } |
| 4399 | + |
4375 | 4400 | /**
|
4376 | 4401 | * The tests in this class ensure that in case of an inheritance scenario no DTO is projected but the extending class
|
4377 | 4402 | * is used. If it wasn't the case, we wouldn't find the relationship nor the other attribute.
|
@@ -4701,6 +4726,15 @@ interface SameIdEntitiesRepository extends Neo4jRepository<SameIdProperty.PolEnt
|
4701 | 4726 | interface EntityWithCustomIdAndDynamicLabelsRepository
|
4702 | 4727 | extends Neo4jRepository<EntitiesWithDynamicLabels.EntityWithCustomIdAndDynamicLabels, String> {}
|
4703 | 4728 |
|
| 4729 | + interface TemporalRepository extends |
| 4730 | + Neo4jRepository<OffsetTemporalEntity, UUID> { |
| 4731 | + |
| 4732 | + List<OffsetTemporalEntity> findAllByProperty1After(OffsetDateTime aValue); |
| 4733 | + |
| 4734 | + List<OffsetTemporalEntity> findAllByProperty2After(LocalTime aValue); |
| 4735 | + |
| 4736 | + } |
| 4737 | + |
4704 | 4738 | @SpringJUnitConfig(Config.class)
|
4705 | 4739 | static abstract class IntegrationTestBase {
|
4706 | 4740 |
|
|
0 commit comments