You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
One of the uses of Spring Data JPA in my company is to store plain Protocol Buffers messages and in @Entity we have a field of type ByteString, which is Iterable, we also have a custom @Converter created for it, which converts ByteString to Base-64 string.
This setup worked perfectly fine in Spring Data JPA 2.1, but now fails with the following exception:
Caused by: java.lang.IllegalStateException: Operator SIMPLE_PROPERTY on signature requires a scalar argument, found class com.google.protobuf.ByteString in method public abstract java.util.Optional com.company.project.SignatureEntityRepository.findBySignature(com.google.protobuf.ByteString).
at org.springframework.data.jpa.repository.query.PartTreeJpaQuery.throwExceptionOnArgumentMismatch(PartTreeJpaQuery.java:171)
at org.springframework.data.jpa.repository.query.PartTreeJpaQuery.validate(PartTreeJpaQuery.java:147)
at org.springframework.data.jpa.repository.query.PartTreeJpaQuery.<init>(PartTreeJpaQuery.java:90)
... 119 common frames omitted
Our persistence model makes ample use of Vlad Mihalcea's com.vladmihalcea.hibernate.type.json.``JsonNodeBinaryType, which maps a com.fasterxml.jackson.databind.JsonNode object onto a Postgres jsonb column. This has been working beautifully so far, but after attempting the update to the latest Spring Data JPA 2.2.4, the new org.springframework.data.jpa.repository.query.PartTreeJpaQuery.validate(PartTree, JpaParameters, String) method is spitting the dummy because JsonNode happens to implement Iterable.
On the whole, the validation of repo method signatures isn't a bad idea, but it should of course not mess with anybody's mappings the way it does now. It'll likely be difficult to achieve both to just work out of the box, but maybe an annotation to explicitly suppress this validation for advanced custom user types and converters could be a way out of the dead end
ahaczewski opened DATAJPA-1682 and commented
One of the uses of Spring Data JPA in my company is to store plain Protocol Buffers messages and in
@Entity
we have a field of typeByteString
, which is Iterable, we also have a custom@Converter
created for it, which convertsByteString
to Base-64 string.Here is ByteString declaration (from ByteString JavaDoc):
Here is a custom converter that we use:
Here is our field declaration in the entity:
Here is our repository method:
This setup worked perfectly fine in Spring Data JPA 2.1, but now fails with the following exception:
Affects: 2.2.4 (Moore SR4)
Reference URL: #228 (comment)
3 votes, 4 watchers
The text was updated successfully, but these errors were encountered: