Greg L. Turnquist

Results 352 comments of Greg L. Turnquist

What happens if you use `IS NULL` instead of `= NULL`? If this is native SQL via `@Query(value="/* SQL */", nativeQuery=true)`, then `null` doesn't equal `null` and requires a specific...

What happens if you remove some of those redundant parentheses? I don't think you need them around `? is null OR ? is null`. `a or b or c` should...

@Tsyklop Frankly, I feel as if you should check in advance whether either :createdAtFrom or :createdAtTo is `null`, and if so, choose an alternative query. Only if BOTH fields are...

Well, I've discovered that Hibernate is prone to not route null values through attribute converters, so that may the issue you're also running into. If this is also suffering from...

Okay, I've captured this scenario in a test method inside Spring Data JPA. ```java @ExtendWith(SpringExtension.class) @ContextConfiguration public class PageRequestSortQueryDoesntWorkIntegrationTests { @Autowired ThisRepository thisRepository; @Autowired ThatRepository thatRepository; @Test void test() {...

@CyrilChevalier So far, using Spring Data 3.0 with HSQL, I have it working just fine. I borrowed your entity type, repository definition, and converter: ```java @ExtendWith(SpringExtension.class) @ContextConfiguration public class AttributeConverterIntegrationTests...

Okay, I ran the same thing against Spring Data 2.7.x, and it still passed: ```java @ExtendWith(SpringExtension.class) @ContextConfiguration public class AttributeConverterIntegrationTests { @Autowired MyEntityRepository repository; @Test void nullBasedFinderShouldBlowUp() { LocalDate now...

If I don't put in that `@Nullable`, this happens: ``` java.lang.IllegalArgumentException: Parameter date in AttributeConverterIntegrationTests.MyEntityRepository.findByDate must not be null! at org.springframework.data.repository.core.support.MethodInvocationValidator.invoke(MethodInvocationValidator.java:93) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:215) at org.springframework.data.jpa.domain.support.$Proxy119.findByDate(Unknown Source) at org.springframework.data.jpa.domain.support.AttributeConverterIntegrationTests.nullBasedFinderShouldBlowUp(AttributeConverterIntegrationTests.java:49)...

Part of my concern is what you're expecting to happen when you invoke `findByDate(null)`. `select e from AttributeConverterIntegrationTests$MyEntity e WHERE e.date = :date` flat out shouldn't work if `:date` is...

Okay, I swapped out HSQL and plugged in Testcontainers so I could use PostgreSQL, and what do you know... ``` Converted 2022-06-02 to 1654128000000 for the database. Converted null to...