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

DateTime Column with @Version attribute #101

Open
mea-alexanm opened this issue Aug 31, 2021 · 3 comments
Open

DateTime Column with @Version attribute #101

mea-alexanm opened this issue Aug 31, 2021 · 3 comments

Comments

@mea-alexanm
Copy link

Hello,
we have an application where we use optimisting locking like this:

@typedefs({ @typedef(name = "dateTime", defaultForType = org.joda.time.DateTime.class, typeClass = org.jadira.usertype.dateandtime.joda.PersistentDateTime.class) })
@column(name = "LAST_UPDATE")
@Version
private DateTime lastUpdate;

This worked perfectly fine until we recently upgraded our application to newer version - including jadira to 7.0.0.CR1.
Since then we get a class cast exception for above definition:
java.lang.ClassCastException: class org.jadira.usertype.dateandtime.joda.PersistentDateTime cannot be cast to class org.hibernate.usertype.UserVersionType

Having a look at the source code of jadira it seems there was a change in the class hierarchy for PersistentDateTime class from AbstractVersionableUserType to AbstractParameterizedTemporalUserType which causes this error. At least with our versions.

The versions used are:

  • jadira: 7.0.0.CR1
  • Hibernate: 5.4

Any ideas how to solve this? For now we are trying to go back to version 6.0.1.GA of Jadira.

Thx
Markus

@froque
Copy link

froque commented Sep 6, 2021

as I mentioned in #98 this project is practically dead.

I removed jadira from my project and I suggest you do the same.

Can not help with your problem.

@rcbandit111
Copy link

@froque Can you share how to replace Jadira? Other framework that can be used with Hibernate?

@froque
Copy link

froque commented Jun 27, 2022

Replaced joda and jadira with Java 8 Instant.

Example:

        @NotNull
        @Column(name="activation_date")
-       @Type(type = "org.jadira.usertype.dateandtime.joda.PersistentDateTime")
-       private DateTime activationDate;
+       private Instant activationDate;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants