Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception thrown when using LocalDate in an EntityView being fetched using the Multiset strategy #1904

Closed
dsarlo opened this issue May 16, 2024 · 0 comments · Fixed by #1911
Assignees

Comments

@dsarlo
Copy link
Contributor

dsarlo commented May 16, 2024

Description

When using the Multiset fetch strategy on a collection whose entity view contains a LocalDate typed value, an exception is thrown when attempting to convert the database column to a java.sql.Timestamp before converting to a LocalDate.

Expected behavior

The database column for a LocalDate should be converted from a java.sql.Date instead of a java.sql.Timestamp object.

Actual behavior

java.lang.IllegalArgumentException: Timestamp format must be yyyy-mm-dd hh:mm:ss[.fffffffff]
    at java.sql/java.sql.Timestamp.valueOf(Timestamp.java:196)
    at com.blazebit.persistence.view.impl.type.LocalDateBasicUserType.fromString(LocalDateBasicUserType.java:36)
    at com.blazebit.persistence.view.impl.type.LocalDateBasicUserType.fromString(LocalDateBasicUserType.java:30)
    at com.blazebit.persistence.view.impl.objectbuilder.transformer.MultisetTupleTransformer.transform(MultisetTupleTransformer.java:78)
    at com.blazebit.persistence.view.impl.objectbuilder.transformator.TupleTransformator.transform(TupleTransformator.java:84)
    at com.blazebit.persistence.view.impl.objectbuilder.transformator.TupleTransformator.transform(TupleTransformator.java:77)
    at com.blazebit.persistence.view.impl.objectbuilder.ChainingObjectBuilder.build(ChainingObjectBuilder.java:51)
    at com.blazebit.persistence.impl.builder.object.PreProcessingObjectBuilder.build(PreProcessingObjectBuilder.java:46)
    at com.blazebit.persistence.impl.query.ObjectBuilderTypedQuery.getResultList(ObjectBuilderTypedQuery.java:71)
    at com.blazebit.persistence.impl.query.ObjectBuilderTypedQuery.getSingleResult(ObjectBuilderTypedQuery.java:49)  

Steps to reproduce

Introduce a collection on an entity view that uses the Multiset fetch strategy whose entity view contains a LocalDate field

Environment

Version: 1.6.11
JPA-Provider: hibernate
DBMS: postgres 13.3
Application Server: tomcat

dsarlo added a commit to dsarlo/blaze-persistence that referenced this issue Jun 5, 2024
dsarlo added a commit to dsarlo/blaze-persistence that referenced this issue Jun 5, 2024
…ng to LocalDate

Update LocalDateBasicUserType.java

Revert "Update LocalDateBasicUserType.java"

This reverts commit 8a9d6d9.

Removed override - address code review items
dsarlo added a commit to dsarlo/blaze-persistence that referenced this issue Jun 5, 2024
…ng to LocalDate

Update LocalDateBasicUserType.java

Revert "Update LocalDateBasicUserType.java"

This reverts commit 8a9d6d9.

Removed override - address code review items

Update entity-view/impl/src/main/java/com/blazebit/persistence/view/impl/type/LocalDateBasicUserType.java

Co-authored-by: Christian Beikov <christian.beikov@gmail.com>
dsarlo added a commit to dsarlo/blaze-persistence that referenced this issue Jun 5, 2024
…ng to LocalDate

Update LocalDateBasicUserType.java

Revert "Update LocalDateBasicUserType.java"

This reverts commit 8a9d6d9.

Removed override - address code review items

Update entity-view/impl/src/main/java/com/blazebit/persistence/view/impl/type/LocalDateBasicUserType.java

Co-authored-by: Christian Beikov <christian.beikov@gmail.com>

Update entity-view/impl/src/main/java/com/blazebit/persistence/view/impl/type/LocalDateBasicUserType.java

Co-authored-by: Christian Beikov <christian.beikov@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment