Trouble Getting Hibernate Working with OSGi


We have been trying to get Hibernate to work with OSGi and PostgreSQL. We are using Eclipse to develop our application, but Eclipse is not a requirement right now. We just need to get it working. We have problems with null EntityManagers and null DataSources in our provider classes. We tried it in Blueprint, but Declarative Services is OK too (since DS is newer and better supported).


Check out these demos which show various Hibernate OSGI setups.

Hey @rpepersack, happy to help with this. Have any code you can share with us? The demos that Vlad pointed out are a great start. The way OSGi applications must get EntityManagers or Sessions looks a lot different (revolving around service discovery), when compared to standard non-OSGi apps.

We figured it out. But, thanks anyway.

so and what is the solution? please share it. I have the same problem