-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Unable to get Envers to create audit table in Hibernate 4.0
PostPosted: Mon Feb 13, 2012 7:00 am 
Beginner
Beginner

Joined: Thu Apr 21, 2005 12:15 pm
Posts: 34
Trying to use Envers, trouble is the documentation shows you what to do if you are using hibernate.cfg.xml or persistence.xml but Im just using properties with the Configuration class, whilst this is analagous to hibernate.cfg.xml I cant work out how to setup the enver listeners

I have two tests, one to create the database which does not create any _AUD tables currently even though the tables have @Audited annotation added, and my second test that trys to get a revision unsuprisingly fails with

org.hibernate.exception.SQLGrammarException: Table/View 'COVERIMAGE_AUD' does not exist.

This is my config class

public static Configuration getInitializedConfiguration()
{
Configuration config = new Configuration();
config.setProperty("hibernate.connection.driver_class","org.apache.derby.jdbc.EmbeddedDriver");
config.setProperty("hibernate.connection.url","jdbc:derby:C:/User/MESH/Database/songlayer");
config.setProperty("hibernate.dialect","org.hibernate.dialect.DerbyDialect");
//config.setProperty("org.hibernate.service.jdbc.connections.internal.ConnectionProviderInitiator","org.hibernate.service.jdbc.connections.internal.C3P0ConnectionProvider");
config.setProperty("hibernate.connection.username","jaikoz");
config.setProperty("hibernate.c3p0.min_size","20");
config.setProperty("hibernate.c3p0.max_size","100");
config.setProperty("hibernate.c3p0.timeout","300");
config.setProperty("hibernate.c3p0.max_statements","50");
config.setProperty("hibernate.c3p0.idle_test_period","3000");
config.setProperty("hibernate.show_sql","true");
config.setProperty("hibernate.ejb.event.post-insert","org.hibernate.envers.event.AuditEventListener");
config.setProperty("hibernate.ejb.event.post-update","org.hibernate.envers.event.AuditEventListener");
config.setProperty("hibernate.ejb.event.post-delete","org.hibernate.envers.event.AuditEventListener");
config.setProperty("hibernate.ejb.event.pre-collection-update","org.hibernate.envers.event.AuditEventListener");
config.setProperty("hibernate.ejb.event.pre-collection-remove","org.hibernate.envers.event.AuditEventListener");
config.setProperty("hibernate.ejb.event.post-collection-recreate","org.hibernate.envers.event.AuditEventListener");
//config.setProperty("hibernate.format_sql","true");
config.addAnnotatedClass(SongParent.class);
config.addAnnotatedClass(Song.class);
config.addAnnotatedClass(CoverImage.class);
config.addAnnotatedClass(CoverArt.class);
return config;
}


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.