Our Business Objects are the JPA entities. We develop our product domain driven. This means we have several domains. Each domain is split into business layer and persistence layer (others are not relevant here). Per domain and per layer, we have an OSGI bundles. The business layer should have no dependency down (an exception is the dependency to the ObjectDB for the enhanced entities). The persistence Layers have a dependency to the business layer and to the central DataAccess Layer. The Central DataAccess Layer has a dependency on JPA & ObjectDB and to all domains, because there are the entities. (more details see http://www.objectdb.com/database/forum/891)
So far everything well.
But now we have in the Business Layer private packages that are not exported.
The entities implement interfaces from these private packages.
If ObjectDB now want to load such entity tries ObjectDB also load the private interface. Why is this necessary, is not clear to us.
Correct way would ObjectDB use the classloader of the bundle of the entity. And not his own.
The change of the context class loader is no option, since there are several bundles with entities.
We have found a solution with which we can work around the problem. This solution, we do not like, because it feels like a hack.
We have modified the ObjectDB bundle with "Eclipse-Buddy classloading".
“Eclipse-BuddyPolicy: dependent, global”
dependent: Allows access to all packages (also private) of a bundle which itself has a dependency on the ObjectDB bundle.
global: Allows access to all public packages of all bundles. This can be realized with a dependency of ObjectDB to the entity bundles. (It is therefore not necessary.)
Creating a small example would be possible. But we want to avoid as long as it is not necessary.
What would be a good solution to this problem?
Can you adapt or expand ObjectDB so that we do not need to make changes.
Important for us is that we find a solution that always works in the future.