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

new project for vavr-hibernate #2022

Closed
chb0github opened this issue Jun 29, 2017 · 9 comments
Closed

new project for vavr-hibernate #2022

chb0github opened this issue Jun 29, 2017 · 9 comments

Comments

@chb0github
Copy link
Contributor

Would be great from an adoption standpoint to have ready-to-go hibernate support.

@danieldietrich
Copy link
Contributor

How would that support look like? Brainstorming welcome!

Generally we do not bake dependencies to 3rd party libs directly into the core Vavr library. Supporting hibernate (in the one or other way) requires us to create a new project. That's the only constraint.

@danieldietrich danieldietrich added this to the vavr-1.0.0 milestone Jun 29, 2017
@nfekete
Copy link
Member

nfekete commented Jun 29, 2017

@chb0github That's an interesting idea. Did you try to investigate whether it is actually possible?

To me it seems that Hibernate (and JPA providers in general) are pretty much tied to the Java Collection API. For example, they provide special implementations of the Java Collection API interfaces Set, List, Map, etc: PersistentSet, PersistentList, PersistentMap, and so on.

I didn't look into this recently, but I remember from a few years ago that Hibernate didn't provide the customization capabilities required to use different implementations for these persistent collection classes. With all the features JPA providers support, like lazy association fetching, these classes are designed with mutability in mind. Without active customization support on this level from the persistence provider, implementing these kind of things could prove really difficult.

@chb0github
Copy link
Contributor Author

My confidence that this is possible is nearly 100% - I have done it in the past. There are 2 different ways to do it:

One is with a UserType which is generally applied on the field being bound with @Type( VavrType.class) - The basics are: Given a result set, construct the result to be bound to the object field and return it - should be no problem to integrate.

Option 2 is anTypeDescriptor. I have never used these.

The option to use is the one that requires nothing more than the dependency being dropped in and that's it. We should model it on how hibernate support for hibernate-java8 was implemented. It takes care of things like Instant which are immutable as well as Optional and Stream.

Once a strategy is developed a new repository would be created that just has necessary hibernate dependencies discovered at runtime so it isn't version bound - these 2 approaches seem to have been around forever so that's a safe approach for portability

@chb0github
Copy link
Contributor Author

As I thought about it more, ideally such a package would support options 1 and 2 so that the user may choose.

@danieldietrich
Copy link
Contributor

danieldietrich commented Jun 30, 2017

@chb0github I added a new repository vavr-io/vavr-hibernate and a new developer team to the Vavr organization. May I add you to the Vavr organization and to the new team in order to start with vavr-hibernate?

@chb0github
Copy link
Contributor Author

Yeah, that'd be great! Thanks

@chb0github
Copy link
Contributor Author

chb0github commented Jun 30, 2017 via email

@danieldietrich
Copy link
Contributor

@chb0github awesome, thank you! I've overseen your replies, my inbox is still too full after vacation 😅

@danieldietrich
Copy link
Contributor

We created it, now we need to ramp it up. Ticket can be closed.

@danieldietrich danieldietrich removed this from the vavr-1.0.0 milestone Sep 1, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants