-
Notifications
You must be signed in to change notification settings - Fork 45
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
Migrate from Jadira 7.0.0.CR1 to Java 17 #121
Comments
rcbandit111
changed the title
Migrate from Jadire 7.0.0.CR1 to Java 17
Migrate from Jadira 7.0.0.CR1 to Java 17
Feb 9, 2023
it looks like this project has been abandoned. I recently finished migrating my project to Hibernate 6. You have a couple of options:
Something like this: public class DateTimeJavaType extends AbstractClassJavaType<DateTime> {
public static final DateTimeJavaType INSTANCE = new DateTimeJavaType();
public DateTimeJavaType() {
super(DateTime.class, ImmutableMutabilityPlan.INSTANCE);
}
@Override
public <X> X unwrap(DateTime value, Class<X> type, WrapperOptions options) {
if (value == null) {
return null;
}
if (DateTime.class.isAssignableFrom(type)) {
return (X) value;
}
if (Timestamp.class.isAssignableFrom(type)) {
return (X) new Timestamp(value.toDate().getTime());
}
throw unknownUnwrap(type);
}
@Override
public <X> DateTime wrap(X value, WrapperOptions options) {
if (value == null) {
return null;
}
if (value instanceof Timestamp) {
return new DateTime(value);
}
if (value instanceof DateTime) {
return (DateTime) value;
}
throw unknownWrap(value.getClass());
}
@Override
public JdbcType getRecommendedJdbcType(JdbcTypeIndicators indicators) {
return indicators.getTypeConfiguration()
.getJdbcTypeRegistry()
.getDescriptor(Types.TIMESTAMP);
}
} Then you can use it like this: @JavaType(DateTimeJavaType.class)
private DateTime until; |
@theigl Thanks for the reply. Using |
I have the similar problem, but it's about currency mapping:
anyone gets any idea to work around this? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I use 'org.jadira.usertype:usertype.core:7.0.0.CR1' into my project. I want to migrate to Java 17. I have the following columns definitions:
Do you know how I can replace the code for latest Java 17/Hibernate/Spring Boot?
The text was updated successfully, but these errors were encountered: