Adding additional Libraries to Hibernate, e.g. Envers
Hello Ivy-Developers!
Envers is a powerfull Library, that comes along with the Hibernate-Package and allows auto-Auditing for entities. (History-Tables etc.)
Update:
To insert the library I did as following:
Added hibernate-envers-4.2.13.Final.jar to ivy-Hibernate-jar:
designer\plugins\ch.ivyteam.hibernate_5.1.0.201409121008.jar\lib\mvn\
made some changes in the ivy-Hibernate-jar:
',lib/mvn/hibernate-envers-4.2.13.Final.jar' added to MANIFEST.MF
in pom.xml I inserted a new dependency for hibernate-envers (see pom.xml)
When inserting this library this unusual way, there are no more errors accessing the persistence.
Adding @Audited to the Entity gives no error, but no auditing happens on merge.
Merging through the EntityManager (from createEntityManager()) does not work (Nothing happens, no error)
Trying to add the library found in the hibernate-package to the classpath, access the AuditReader will result in an exception (tried different versions:
fail on a ClassNotFoundException: org.hibernate.integrator.spi.Integratororg.hibernate.envers.AuditReaderFactory
ch.ivyteam.ivy.java.internal.IvyProjectClassLoader.loadClass(IvyProjectClassLoader.java:243)
Installation as described in:
[Guide from Hibernate][1]
[1]: http://docs.jboss.org/hibernate/orm/4.2/devguide/en-US/html/ch15.html
-
My first guess is, that the class Integrator is overwritten or somelike by the library, what is not handled right. Might be because it can be found in the hibernate-envers-4.2.13.Final.jar under META-INF\services\
Could be something with the Classloader// switching contextClassLoader to ivy.request.getProject().getProjectClassLoader()
EntityManager em = entityManager.createEntityManager();
AuditReaderFactory.get(em);
As I understand this has been successfully implemented in the csc project.
So the questions are: How can I integrate this library into Ivy? If not possible, is there another a way to integrate this library?detach Hibernate more from Ivy?
Installation as described in:
[Guide from Hibernate][1]
[1]: http://docs.jboss.org/hibernate/orm/4.2/devguide/en-US/html/ch15.html
Thanks in advance!
Greetings
Alexis