2009/5/23 Benjamin Rack <[email protected]> > Hello, > > I'm trying to persist JPA entities to a Jackrabbit Repository using the OCM > framework.
I'm not sure that it will be possible or easy in all cases. There are many JPA annotations that will not be usefull in a JCR context and some annotations are missing in the JPA world to have a full JCR support. Nevertheless, we can start a review and make a prototype. If you are interested to work on that, there is a jira issue ( http://issues.apache.org/jira/browse/OCM-13). > The main problem in doing so is that such entities normally do > not contain suitable properties for storing the path and uuid, which is > required for OCM in order to handle instances of the entity classes. This is certainly a good example on what is missing in the JPA world. Path and UUID have to be supported in an OCM-JPA implementation. > > > My current approach is using Javassist in a preprocessing step and > enhancing > the given entity classes by adding two special properties and respective > get/set methods for these properties. Furthermore the preprocessing step is > used for generating the OCM mapping metadata by analyzing the JPA > annotations in the given entity classes and transforming them into > according > OCM mapping metadata. I understand your problem but I'm not a big fan of code enhancement. What are you doing with the entity primary keys (@id or @EmbeddedId)? > > Is there another approach, which possibly could make the mapping of JPA > entities to a Content Repository a bit easier? Perhaps, someone has already > solved this problem in a better way. > No sorry :-( I'm not sure that we have to support all JPA features. Maybe you can start smoothly even if you have to modify the annotations in your entities. > > Thanks, > Benjamin > >
