-
1. Re: can i mix hbm definitions with envers audit annoations?
bestage Aug 30, 2009 7:31 AM (in response to elhanan)"Elhanan" wrote:
hi.. all of our current pojo's are configured with hbm files, can we keep them but still have only the audited annotation with envers?
also does envers audit components? if not , how can we audit them?
hi,
first of all you can find the answers to both of your questions in the docs.
Envers is for jpa entities (annotated POJOs) only, which is actually not a problem I guess?
You can audit components accordings to the docs. I never tested it though. -
2. Re: can i mix hbm definitions with envers audit annoations?
elhanan Aug 30, 2009 8:14 AM (in response to elhanan)actually it does present a problem as we have 2-3 legacy applications with loads of hbm files.
does this mean we cannot use envers? is there another framework like it? -
3. Re: can i mix hbm definitions with envers audit annoations?
hernanbolido Aug 31, 2009 11:36 AM (in response to elhanan)We are using envers with hbm files.
We found a problem when an interface is mapped (it's no possible to use annotated interfaces, so the problem only happens with hbm files) but we fixed it. You can see http://www.jboss.org/index.html?module=bb&op=viewtopic&t=156233 for more information.
Hernan. -
4. Re: can i mix hbm definitions with envers audit annoations?
elhanan Aug 31, 2009 1:36 PM (in response to elhanan)
i tried to look through the documentation, and i'm wondering is it possible to mix hibernate annotations and hbm files?
the reason i'm asking is this, we have an abstract class which all persistent entities must extend. this class is currently un-mapped. this class should be mapped as an identifier and a few dates. can i used mappedSuperclass on this class and leave the rest of hbm's which map the concrete classes which extend it as they are ? -
5. Re: can i mix hbm definitions with envers audit annoations?
hernanbolido Aug 31, 2009 2:03 PM (in response to elhanan)Hi Elhanan, here is an approach...
I've found this on hibernate annotations documentation (http://docs.jboss.org/hibernate/stable/annotations/reference/en/html/ch01.html#setup-configuration)
In section 1.2 it says:
There is no other difference in the way you use Hibernate APIs with annotations, except for this startup routine change or in the configuration file. You can use your favorite configuration method for other properties ( hibernate.properties, hibernate.cfg.xml, programmatic APIs, etc). You can even mix annotated persistent classes and classic hbm.cfg.xml declarations with the same SessionFactory. You can however not declare a class several times (whether annotated or through hbm.xml). You cannot mix configuration strategies (hbm vs annotations) in a mapped entity hierarchy either.
Hernan. -
6. Re: can i mix hbm definitions with envers audit annoations?
elhanan Aug 31, 2009 3:35 PM (in response to elhanan)so in short i can use envers, with hbm'd classes , i would also need to use hiberate-annoations for it, and once i'll do that, i can begin using hibernate annoations on new entities, but cannot mix class tree like i wanted, oh well :)