title: AEM CQ with JPA (Hibernate)
body: <p>I'm working with Adobe Experience Manager (AEM) 6.4 with Service Pack 1, and the Forms Package.
  I have a lot of extended Properties/attributes, so I made a Database diagram. I don't want to save all the additional stuff in crx I want to save it in an Oracle database. </p>
  
  <p>The Database diagram is complex, so I want to USE JPA (Hibernate), at minimum. If Spring would help to make it easier to use, than that would be fine for me.</p>
  
  <p>I read a lot that the OSGI is working with blueprint instead of Spring, but you can combine it. </p>
  
  <p>I'm really searching for an good example how to make things work with JPA and a Oracle db.</p>
  
  <p>Adobe is no Help at all, they can't show an example how to work with AEM and JPA/Hibernate/Spring/blueprint.</p>
  
  <p>Can anybody help me to make things working? with AEM and JPA?</p>
  
  <p>I think what I need is:</p>
  
  <ol>
  <li>persistence.xml (RESOURCE_LOCAL or JTA?)</li>
  <li>Entity classes with Annotation @Entity and other JPA annotations</li>
  <li>Service classes with Transaction control and maybe manager classes to submit to work with the entity classes and get result from queries, maybe I could put it all in the service classes</li>
  <li>hibernate-osgi (dependency)</li>
  <li>ojdbc7 for connection (dependency)</li>
  <li>org.apache.aries.jpa.api (dependency)</li>
  </ol>
  
  <p>But how do I have to make things happen? Nothing works. I even don't know if this is the right way.</p>
  
  <p>should I use blueprint or Spring or both?</p>
  
  <p>I found this Aries thing from apache.
  <a href="http://aries.apache.org" rel="nofollow noreferrer">http://aries.apache.org</a>
  And weard different samples that I don't really understand how they work.
  <a href="https://github.com/apache/aries-jpa/tree/master/examples" rel="nofollow noreferrer">https://github.com/apache/aries-jpa/tree/master/examples</a></p>
  
  <p>And some OSGI sample, they look very incomplete for my situation.
  <a href="https://enroute.osgi.org/tutorial/032-tutorial_microservice-jpa.html" rel="nofollow noreferrer">https://enroute.osgi.org/tutorial/032-tutorial_microservice-jpa.html</a></p>
  
  <p>So is there anybody with some experience with AEM and JPA?</p>