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

Add support for Hibernate 5.2 #92

Closed
nik-kashi opened this issue Jun 11, 2016 · 8 comments
Closed

Add support for Hibernate 5.2 #92

nik-kashi opened this issue Jun 11, 2016 · 8 comments
Milestone

Comments

@nik-kashi
Copy link

Due huge changes in Hibernate 5.2 it is necessary to upgrade version to 5.2

@nik-kashi
Copy link
Author

I fix it in pull #66

@cowtowncoder
Copy link
Member

Could you please elaborate what you mean by "have to upgrade"? I am fine fixing issues that would exist when used with 5.2, but ideally version we mandate should be an early 5.x minor version for maximal compatibility -- users are unlikely to base their choice of Hibernate version based on what jackson module would like.

So we should not require specific later 5.x minor version if at all possible to avoid (yes, currently 5.1 is required which seems unfortunate).
Module should of course also work with 5.2, I just would not want to break backwards compatibility with 5.1 if that is the cost.

@ptahchiev
Copy link

Hello for me jackson-datatype-hibernate5 does not work with hibernate 5.2. I have a spring-data-rest project that exposes hibernate lazy loaded proxies via rest and it all works fine with hibernate 5.0.x and hibernate 5.1.x but when I try to upgrade to hibernate 5.2 with jackson-datatype-hibernate5 I get this error: Id must be assignable to Serializable! Object of class [null] must be an instance of interface java.io.Serializable. It is well documented here:

http://stackoverflow.com/questions/26322985/id-must-be-assignable-to-serializable-with-lazy-manytoone

https://jira.spring.io/browse/DATAJPA-630

https://jira.spring.io/browse/DATAREST-359

This error was appearing before with hibernate 5.1 and then I followed the recommendation on stackoverflow to add jackson-datatype-hibernate5 to the classpath and it stopped appearing. Several months later I upgraded to hibernate 5.2 and it starts appearing again.

@cowtowncoder
Copy link
Member

@ptahchiev At this point module can not work with HIbernate 5.2 since module is using part of non-public API that was included in 5.0 and 5.1 but removed from 5.2. There was an attempt (#66) to resolve this, but that unfortunately would not work with 5.0 and 5.1, so we are still missing a solution that would work for these existing hibernate 5.x versions.

I am not sure the exception you get is the primary cause; rather it seems likely that it would be a secondary exception triggered by actual failure during class loading.

@coladict
Copy link

Hi, you're saying it doesn't work with Hibernate 5.2, but my project is using Hibernate 5.2.2.Final and Jackson version 2.7.5 with the same version for this module and a lazy object that gets serialized properly. Could this be a regression bug for the ones experiencing it?

I don't know if it would also get deserialized properly if I didn't have a custom deserializer, which fetches it the existing object from the database, because it is only being sent to the server as an id.

@Ramblurr
Copy link

Ramblurr commented Nov 15, 2016

I'm experiencing the exact same issue as @ptahchiev (down to the exception, + usage of spring-data-rest). Are there any updates regarding this?

I'm still not sure where the bug actual lies, with SDR or jackson-datatype-hibernate

@mshima
Copy link
Contributor

mshima commented Nov 23, 2016

Added a PR #100
Fixed using reflection, the alternative seems to create another module for hibernate 5.2

@cowtowncoder cowtowncoder added this to the 2.8.6 milestone Dec 6, 2016
cowtowncoder added a commit that referenced this issue Dec 6, 2016
@cowtowncoder
Copy link
Member

cowtowncoder commented Dec 6, 2016

Fix #100 merged; thank you @mohsenkashi and @mshima!

Fix will be included in 2.8.6 and 2.9.0.

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

6 participants