I would like to save my My Employee details in Employee table and History details EmployeeHistory table before running the below command i am able to save the records in my Employee table but not saving in EmployeeHistory table jpa audit revisionLog --provider H-ENVERS
After running the above command i am not able to save Employee table also i am getting error like this org.hibernate.engine.jdbc.spi.sqlexceptionhelper - invalid object name RevisionLogEntity
My log.roo
project --topLevelPackage com.employeedetails --projectName EmployeeDetails jpa setup --database MSSQL --provider HIBERNATE --hostName Hostname --databaseName dbname --userName sa --password Admin@123!! database introspect --schema dbo --file db_schema database reverse engineer --schema dbo --package ~.domain --includeTables "Employee" web mvc setup web mvc all --package ~.web web mvc scaffold --class ~.web.EmployeeController --backingType ~.domain.Employee web mvc scaffold --class ~.web.EmployeeListController --backingType ~.domain.Employee --path employeelist web mvc finder all web mvc jquery setup web mvc jquery all web mvc datatables setup web mvc bootstrap setup jpa gvnix setup jpa batch all web mvc batch setup web mvc batch all web mvc datatables add --type ~.web.EmployeeListController --mode show security setup web mvc bootstrap update jpa audit setup jpa audit revisionLog --provider H-ENVERS jpa audit all --package ~.domain.audit
I can see that you are using reverse engineering to generate your model. Did you create the tables required by Hibernate Envers to store revision information?
Hibernate Envers requires a new entity RevisionLog
to store general information about all revision (date, user, etc) which is stored in DB and one table per entity audited to store entity instance values for every revision.
gvNIX create this configuration for you but, as you are using Reverse Engineering tool, the hibernate.hbm2ddl.auto
property should be set to none
. So, required Envers tables will not be generated on DB.
A simple solution could be:
hibernate.hbm2ddl.auto
to create
For more information about Envers check development guide
Good luck!
PD: Don't forget exclude envers tables from Reverse Engineering configuration next time you execute it!.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.