|Hibernate cross bundle mapping with annotations [message #501930]
||Fri, 04 December 2009 09:03
| Sascha Zak
Registered: July 2009
I've got a problem using hibernate's AnnotationConfiguration with
annotated "persistence classes" and different bundles.
The goal is to have an abstract persistence bundle which offers a
service for other bundles to persist their (JPA annotated) model
classes. This abstract persistence bundle provides the necessary
interfaces and deletgates calls to a concrete persistence strategy,
e.g. a database using hibernate encapsulated in another bundle or
Therefore there has to be an extension point where bundles publish
their persistence classes so that Hibernate (the AnnotationConfiguration
class) can create mappings and a SessionFactory.
The main problem is, that the subsequent methods of the
AnnotationConfiguration, although receiving the class objects from the
extension point, calls the classloader to process the mappings. This
naturally fails, because the persistence classes are defined in other
A workaroud is to use the Eclipse buddy mechanism, which smells dirty
for me and has to be always kept in mind, otherwise one can spend much
time in finding out the reason of the mapping exceptions.
Does anyone knows a solution without using the buddy mechanism?
Any hint is welcome.
Thanks in advance.
Powered by FUDForum
. Page generated in 0.02670 seconds