Giter Club home page Giter Club logo

generator-jhipster-entity-audit's Introduction

generator-jhipster-entity-audit

JHipster blueprint, entity-audit blueprint for JHipster

NPM version Generator Integration Test

Introduction

This is a JHipster blueprint, that is meant to be used in a JHipster application.

You can choose to enable audit for all entities or choose the entities to be audited from a list during generation.

The blueprint will extend the selected entities with AbstractAuditingEntity to enable audits, hence make sure that your entities doesn't have any super class.

This will also add new columns to the entities, so it is ideal to recreate the tables if you are enabling this for existing entities or use incremental changelog.

The Audit log page is optional and can be added by choosing the option while running the generator.

Javers integration

When using sql or mongodb you can use Javers for entity auditing.

The blueprint will add spring-boot integration for javers. Each repository is annotated with the required @JaversSpringDataAuditable annotation. The new class JaversAuthorProvider provides javers with the correct user modifying an entity.

Prerequisites

As this is a JHipster blueprint, we expect you have JHipster and its related tools already installed:

Installation

To install or update this blueprint:

npm install -g generator-jhipster-entity-audit

Usage

To use this blueprint, run the below command

jhipster-entity-audit

or

jhipster --blueprints entity-audit

You can look for updated entity-audit blueprint specific options by running

jhipster-entity-audit app --help

And looking for (blueprint option: entity-audit) options.

Pre-release

To use an unreleased version, install it using git.

npm install -g jhipster/generator-jhipster-entity-audit#main
jhipster --blueprints entity-audit --skip-jhipster-dependencies

generator-jhipster-entity-audit's People

Contributors

addins avatar ashakhov avatar atomfrede avatar bhaumik-sunflower avatar danielfran avatar deepu105 avatar dependabot[bot] avatar edilsonmendes avatar finxster avatar gandrade avatar gimoh avatar irfani avatar jelharou avatar jitakirin avatar kaidohallik avatar leopku avatar loverto avatar mkysoft avatar monjurmorshed793 avatar mshima avatar murdos avatar nitram84 avatar omarhawk avatar pascalgrimaud avatar robinkamps avatar ruddell avatar szmg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

generator-jhipster-entity-audit's Issues

Starting EntityAuditEventListener before Generator, Thread Overflow Questions

Hello,

I have run your generator, and it saved me a lot of trouble so thank you!

I have a few questions:

  1. I have a Data Generator Service that I want to run after the application starts to inject a bunch of test data into my database. I noticed that when I launched it using an @Configuration annotation on my class the setBeanFactory that injects the BeanFactory into the class hasn't run yet (and thus I get a null-pointer) when EntityAuditEventListener attempts to use the BeanFactory.

I got around this by adding my own setBeanFactory method to the same class and calling it before I set off the data-generator. Is there a smarter way to do this?

  1. I was injecting around 5000 records in a single repository save action, and I was getting thread-pool overflow exceptions - so I added a short timeout between save operations and broke them up into blocks of 50 or so records per-save. Should I increase the thread pool? And if so do you know how with jHipster? I found a few notes about using my application.yml to set the thread-pool size for the internal Tomcat instance.
  2. After all this my DataGenerator ran fine, saving all the records, and a series of audit-events, however, after it ran I received a bunch of "Post Audit Event" inserts, and then the application just sort of seized up- I'm assuming the thread pool is blocking somewhere in there? Any thoughts.

Thanks!

microservice architecture support

Hi!

I tried adding entity audit support to an application and, while there were some error messages logged, the application still compiled/tested/ran ok.

However, adding entity audit support to the gateway that referenced the entity in the microservice application failed with the gateway code unable to be compiled.

Is support planned for the microservice architecture-style?
And thanks for the support for auditing when using the monolith-style!

JHipster Entity Audit Generator! v2.4.1 - TypeError: this.addEntityToCache is not a function

I am trying to add Entity Audit to my entity to a Angular4 JHipster project.
After selecting the classes to add auditing features and answering Yes to adding audit log page for the entity, the system the following error:
TypeError: this.addEntityToCache is not a function at Object.addEntityToEhcache (E:\jhipsterdev\ng2\webOrderProject\WebOrdMono\node_modules\generator-jhipster\generators\generator-base.js:724:14)
at child.writeBaseFiles (C:\Users\user\AppData\Roaming\npm\node_modules\generator-jhipster-entity-audit\generators\app\index.js:212:24)
at Object. (C:\Users\user\AppData\Roaming\npm\node_modules\generator-jhipster-entity-audit\node_modules\yeoman-generator\lib\base.js:436:25)
at C:\Users\user\AppData\Roaming\npm\node_modules\generator-jhipster-entity-audit\node_modules\yeoman-generator\node_modules\run-async\index.js:25:25
at C:\Users\user\AppData\Roaming\npm\node_modules\generator-jhipster-entity-audit\node_modules\yeoman-generator\node_modules\run-async\index.js:24:19
at C:\Users\user\AppData\Roaming\npm\node_modules\generator-jhipster-entity-audit\node_modules\yeoman-generator\lib\base.js:448:8
at runCallback (timers.js:672:20)
at tryOnImmediate (timers.js:645:5)
at processImmediate [as _immediateCallback] (timers.js:617:5)

Appreciate any suggestion on how to resolve this issue.

Thanks in advance.

entityAudit state does not activate

Hi m8,

For some reason the translatePartialLoader in the state entityAudit prevents the entityAudit state from activating without logging an exception whatsoever.

After commenting out the lines the state did load.

            resolve: {
//              translatePartialLoader: ['$translate', '$translatePartialLoader', function ($translate, $translatePartialLoader) {
//                  $translatePartialLoader.addPart('audits');
//                  return $translate.refresh();
//              }]
            }

This behaviour might be caused due to my project not being multi-lingual?

Entity Audit generator only seems to work with classic Angular.js

I am using jhipster 4.6.2 with new Angular.

Everything on the Spring Boot side appears to work: i.e. the EntityAuditEventRepository, the EntityAuditEvent, EntityAuditResource, etc.

This generator generated code for classic Angular that used Javascript instead of Typescript. As you probably know classic Angular.js has a very different architecture than the new Angular which uses Typescript.

So

  1. If this generator is supposed to work with new Angular, is there an option to generate a new Angular UI instead of the classic Angular.js module?
  2. If this generator is not supposed to work with new Angular, is there an alternative generator expected? Or can you document the user flow so that it is possible for to refactor the old Angular.js code to the new Angular UI.

Travis build

I'm working on Travis build, and I encounter an error when using this module.

So steps to reproduce:

  • git clone https://github.com/pascalgrimaud/jhipster-ng1-mysql.git
  • cd jhipster-ng1-mysql.git
  • yarn install
  • yarn link generator-jhipster -> link to master
  • yarn link generator-jhipster-entity-audit -> link to master
  • yo jhipster-entity-audit
  • select BankAccount
  • then launch ./mvnw test
? Choose which audit framework you would like to use. Custom JHipster auditing (works with SQL)
? Do you want to enable audit for all existing entities? No, let me choose the entities to update
? Please choose the entities to be audited BankAccount
? Do you want to add an audit log page for entities? Yes

I'm Updating selected entities BankAccount

Here the error:

2017-07-31 08:30:10.637  INFO 18229 --- [           main] .j.t.r.CustomAuditEventRepositoryIntTest : Starting CustomAuditEventRepositoryIntTest on xps with PID 18229 (started by pgrimaud in /home/pgrimaud/tmp/jhipster-ng1-mysql)
2017-07-31 08:30:10.638  INFO 18229 --- [           main] .j.t.r.CustomAuditEventRepositoryIntTest : No active profile set, falling back to default profiles: default
2017-07-31 08:30:16.267  INFO 18229 --- [           main] i.g.j.t.config.MetricsConfiguration      : Initializing Metrics Log reporting
2017-07-31 08:30:25.270  WARN 18229 --- [           main] o.s.w.c.s.GenericWebApplicationContext   : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.class]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory
2017-07-31 08:30:25.321 ERROR 18229 --- [           main] o.s.boot.SpringApplication               : Application startup failed

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.class]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1628)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
	at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1078)
	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:857)
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543)
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693)
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:303)
	at org.springframework.boot.test.context.SpringBootContextLoader.loadContext(SpringBootContextLoader.java:120)
	at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(DefaultCacheAwareContextLoaderDelegate.java:98)
	at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:116)
	at org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:83)
	at org.springframework.test.context.web.ServletTestExecutionListener.setUpRequestContextIfNecessary(ServletTestExecutionListener.java:189)
	at org.springframework.test.context.web.ServletTestExecutionListener.prepareTestInstance(ServletTestExecutionListener.java:131)
	at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:230)
	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:228)
	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:287)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:289)
	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:247)
	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:94)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
	at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:191)
	at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:283)
	at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:173)
	at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:153)
	at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:128)
	at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:203)
	at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:155)
	at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103)
Caused by: javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory
	at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.persistenceException(EntityManagerFactoryBuilderImpl.java:967)
	at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:892)
	at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:60)
	at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:353)
	at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:370)
	at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:359)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1687)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1624)
	... 41 common frames omitted
Caused by: org.hibernate.tool.schema.spi.SchemaManagementException: Schema-validation: missing column [created_by] in table [bank_account]
	at org.hibernate.tool.schema.internal.AbstractSchemaValidator.validateTable(AbstractSchemaValidator.java:136)
	at org.hibernate.tool.schema.internal.GroupedSchemaValidatorImpl.validateTables(GroupedSchemaValidatorImpl.java:42)
	at org.hibernate.tool.schema.internal.AbstractSchemaValidator.performValidation(AbstractSchemaValidator.java:89)
	at org.hibernate.tool.schema.internal.AbstractSchemaValidator.doValidation(AbstractSchemaValidator.java:68)
	at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.performDatabaseAction(SchemaManagementToolCoordinator.java:191)
	at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.process(SchemaManagementToolCoordinator.java:72)
	at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:309)
	at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:445)
	at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:889)
	... 47 common frames omitted

I don't know if I'm doing something wrong?

install error

when i use "yo jhipster-entity-audit", it throw error like "events.js:141
throw er; // Unhandled 'error' event
^

TypeError: jhipsterFunc.copyTemplate is not a function
at null. (/usr/local/lib/node_modules/generator-jhipster-entity-audit/generators/app/index.js:126:24)
at Array.forEach (native)
at copyFiles (/usr/local/lib/node_modules/generator-jhipster-entity-audit/generators/app/index.js:125:15)
at module.exports.yeoman.generators.Base.extend.writing.writeBaseFiles (/usr/local/lib/node_modules/generator-jhipster-entity-audit/generators/app/index.js:146:12)
at /usr/local/lib/node_modules/generator-jhipster-entity-audit/node_modules/yeoman-generator/lib/base.js:430:16
at processImmediate as _immediateCallback"


jhipster version is 2.26.2

bad request for create entity Test

when auditing is enabled "mvn test" will failed, because on createEntity() bad request returned.
the problem is the createDate and createBy will be empty.
when i set these fields on initEntity(), problem has solved.

Error when use ehache with entity audit togather.

Caused by: java.lang.IllegalStateException: All Hibernate caches should be created upfront. Please update CacheConfiguration.java with the missing cache

, when I use ehache with entity audit togather.

2017-03-24 15:08:49.707 WARN 10376 --- [ restartedMain] o.s.boot.SpringApplication : Error handling failed (Error creating bean with name 'delegatingApplicationListener' defined in class path resource [org/springframework/security/config/annotation/web/configuration/WebSecurityConfigurati
on.class]: BeanPostProcessor before instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.cache.annotation.ProxyCachingConfiguration': Initialization of bean failed; nested exception is org.springframe
work.beans.factory.NoSuchBeanDefinitionException: No bean named 'org.springframework.context.annotation.ConfigurationClassPostProcessor.importRegistry' available)
2017-03-24 15:08:49.748 ERROR 10376 --- [tion-Executor-1] liquibase : classpath:config/liquibase/changelog/20170324064600_added_entity_ApronEquipment.xml::20170324064600-1::jhipster: Could not release lock

liquibase.exception.LockException: liquibase.exception.DatabaseException: liquibase.exception.DatabaseException: org.h2.jdbc.JdbcSQLException: Database is already closed (to disable automatic closing at VM shutdown, add ";DB_CLOSE_ON_EXIT=FALSE" to the db URL) [90121-193]
at liquibase.lockservice.StandardLockService.releaseLock(StandardLockService.java:283)
at liquibase.Liquibase.update(Liquibase.java:218)
at liquibase.Liquibase.update(Liquibase.java:192)
at liquibase.integration.spring.SpringLiquibase.performUpdate(SpringLiquibase.java:431)
at liquibase.integration.spring.SpringLiquibase.afterPropertiesSet(SpringLiquibase.java:388)
at io.github.jhipster.config.liquibase.AsyncSpringLiquibase.initDb(AsyncSpringLiquibase.java:79)
at io.github.jhipster.config.liquibase.AsyncSpringLiquibase.lambda$afterPropertiesSet$0(AsyncSpringLiquibase.java:61)
at io.github.jhipster.async.ExceptionHandlingAsyncTaskExecutor.lambda$createWrappedRunnable$1(ExceptionHandlingAsyncTaskExecutor.java:63)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: liquibase.exception.DatabaseException: liquibase.exception.DatabaseException: org.h2.jdbc.JdbcSQLException: Database is already closed (to disable automatic closing at VM shutdown, add ";DB_CLOSE_ON_EXIT=FALSE" to the db URL) [90121-193]
at liquibase.database.AbstractJdbcDatabase.rollback(AbstractJdbcDatabase.java:1168)
at liquibase.lockservice.StandardLockService.releaseLock(StandardLockService.java:266)
... 10 common frames omitted
Caused by: liquibase.exception.DatabaseException: org.h2.jdbc.JdbcSQLException: Database is already closed (to disable automatic closing at VM shutdown, add ";DB_CLOSE_ON_EXIT=FALSE" to the db URL) [90121-193]
at liquibase.database.jvm.JdbcConnection.rollback(JdbcConnection.java:340)
at liquibase.database.AbstractJdbcDatabase.rollback(AbstractJdbcDatabase.java:1166)
... 11 common frames omitted
Caused by: org.h2.jdbc.JdbcSQLException: Database is already closed (to disable automatic closing at VM shutdown, add ";DB_CLOSE_ON_EXIT=FALSE" to the db URL) [90121-193]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:345)
at org.h2.message.DbException.get(DbException.java:179)
at org.h2.message.DbException.get(DbException.java:155)
at org.h2.message.DbException.get(DbException.java:144)
at org.h2.jdbc.JdbcConnection.checkClosed(JdbcConnection.java:1483)
at org.h2.jdbc.JdbcConnection.checkClosed(JdbcConnection.java:1458)
at org.h2.jdbc.JdbcConnection.getAutoCommit(JdbcConnection.java:457)
at com.zaxxer.hikari.pool.HikariProxyConnection.getAutoCommit(HikariProxyConnection.java)
at liquibase.database.jvm.JdbcConnection.rollback(JdbcConnection.java:336)
... 12 common frames omitted

2017-03-24 15:08:49.748 ERROR 10376 --- [ restartedMain] o.s.boot.SpringApplication : Application startup failed

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.class]: Invocation of init method failed; nested exception is javax.persistence.Persis
tenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1628)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1081)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:856)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:542)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:737)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:370)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:314)
at com.mycompany.myapp.MyapplicationApp.main(MyapplicationApp.java:66)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)
Caused by: javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.persistenceException(EntityManagerFactoryBuilderImpl.java:967)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:892)
at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:60)
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:353)
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:370)
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:359)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1687)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1624)
... 19 common frames omitted
Caused by: java.lang.IllegalStateException: All Hibernate caches should be created upfront. Please update CacheConfiguration.java with the missing cache
at io.github.jhipster.config.jcache.NoDefaultJCacheRegionFactory.createCache(NoDefaultJCacheRegionFactory.java:34)
at org.hibernate.cache.jcache.JCacheRegionFactory.getOrCreateCache(JCacheRegionFactory.java:190)
at org.hibernate.cache.jcache.JCacheRegionFactory.buildEntityRegion(JCacheRegionFactory.java:113)
at org.hibernate.cache.spi.RegionFactory.buildEntityRegion(RegionFactory.java:132)
at org.hibernate.internal.CacheImpl.determineEntityRegionAccessStrategy(CacheImpl.java:439)
at org.hibernate.metamodel.internal.MetamodelImpl.initialize(MetamodelImpl.java:120)
at org.hibernate.internal.SessionFactoryImpl.(SessionFactoryImpl.java:297)
at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:445)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:889)
... 25 common frames omitted

2017-03-24 15:08:49.753 WARN 10376 --- [tion-Executor-1] liquibase : classpath:config/liquibase/changelog/20170324064600_added_entity_ApronEquipment.xml::20170324064600-1::jhipster: Failed to restore the auto commit to true
2017-03-24 15:08:49.754 ERROR 10376 --- [tion-Executor-1] i.g.j.c.liquibase.AsyncSpringLiquibase : Liquibase could not start correctly, your database is NOT ready: org.h2.jdbc.JdbcSQLException: Database is already closed (to disable automatic closing at VM shutdown, add ";DB_CLOSE_ON_EXIT=FALSE" to the
db URL) [90121-193]

liquibase.exception.DatabaseException: org.h2.jdbc.JdbcSQLException: Database is already closed (to disable automatic closing at VM shutdown, add ";DB_CLOSE_ON_EXIT=FALSE" to the db URL) [90121-193]
at liquibase.database.jvm.JdbcConnection.setAutoCommit(JdbcConnection.java:363)
at liquibase.database.AbstractJdbcDatabase.close(AbstractJdbcDatabase.java:1202)
at liquibase.integration.spring.SpringLiquibase.afterPropertiesSet(SpringLiquibase.java:397)
at io.github.jhipster.config.liquibase.AsyncSpringLiquibase.initDb(AsyncSpringLiquibase.java:79)
at io.github.jhipster.config.liquibase.AsyncSpringLiquibase.lambda$afterPropertiesSet$0(AsyncSpringLiquibase.java:61)
at io.github.jhipster.async.ExceptionHandlingAsyncTaskExecutor.lambda$createWrappedRunnable$1(ExceptionHandlingAsyncTaskExecutor.java:63)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.h2.jdbc.JdbcSQLException: Database is already closed (to disable automatic closing at VM shutdown, add ";DB_CLOSE_ON_EXIT=FALSE" to the db URL) [90121-193]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:345)
at org.h2.message.DbException.get(DbException.java:179)
at org.h2.message.DbException.get(DbException.java:155)
at org.h2.message.DbException.get(DbException.java:144)
at org.h2.jdbc.JdbcConnection.checkClosed(JdbcConnection.java:1483)
at org.h2.jdbc.JdbcConnection.checkClosed(JdbcConnection.java:1458)
at org.h2.jdbc.JdbcConnection.setAutoCommit(JdbcConnection.java:438)
at com.zaxxer.hikari.pool.ProxyConnection.setAutoCommit(ProxyConnection.java:378)
at com.zaxxer.hikari.pool.HikariProxyConnection.setAutoCommit(HikariProxyConnection.java)
at liquibase.database.jvm.JdbcConnection.setAutoCommit(JdbcConnection.java:361)
... 8 common frames omitted

{
"generator-jhipster": {
"jhipsterVersion": "4.0.8",
"baseName": "myapplication",
"packageName": "com.mycompany.myapp",
"packageFolder": "com/mycompany/myapp",
"serverPort": "8080",
"authenticationType": "jwt",
"hibernateCache": "ehcache",
"clusteredHttpSession": false,
"websocket": false,
"databaseType": "sql",
"devDatabaseType": "h2Disk",
"prodDatabaseType": "mysql",
"searchEngine": false,
"messageBroker": false,
"serviceDiscoveryType": false,
"buildTool": "maven",
"enableSocialSignIn": false,
"jwtSecretKey": "5f8ca11a484f88443630bf8acf235788e9640c80",
"clientFramework": "angular1",
"useSass": false,
"clientPackageManager": "npm",
"applicationType": "monolith",
"testFrameworks": [],
"jhiPrefix": "jhi",
"enableTranslation": true,
"nativeLanguage": "zh-cn",
"languages": [
"zh-cn",
"en"
]
},
"generator-jhipster-entity-audit": {
"auditFramework": "custom"
}
}

Prompt with entity name

The entity audit generator prompt asks " Do you want to enable audit for this entity? (Y/n)".

When importing multiple entities from jdl, it is difficult to know which entity we are working on. It would be nice to display the entity name in the prompt.

Error: Cannot find module 'path-exists'

After start using the master branch of generator-jhipster and generator-jhipster-entity-audit, the error below is generated when I yo jhipster-entity-audit.

Error: Cannot find module 'path-exists'
    at Function.Module._resolveFilename (module.js:326:15)
    at Function.Module._load (module.js:277:25)
    at Module.require (module.js:354:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/home/delta/coding/generator-jhipster-entity-audit/node_modules/generator-jhipster/node_modules/yeoman-generator/lib/base.js:19:18)
    at Module._compile (module.js:398:26)
    at Object.Module._extensions..js (module.js:405:10)
    at Module.load (module.js:344:32)
    at Function.Module._load (module.js:301:12)
    at Module.require (module.js:354:17)

Node version: v5.3.0

Does it work?

Hi just a short question. Does this generator work?
I tried out once and got an error. And on github it sais build failed?
Thanks in advance

submenu item is not added to admin menu

If using angular1 as clientFramework then generator gives error:

Unable to find src/main/webapp/app/layouts/navbar/navbar.component.html or missing required jhipster-needle. Reference to entity-audit not added to admin menu.

Problem is caused by this.clientFramework is undefined in main generator function addElementToAdminMenu.

Resolution is to use similar method like is used with enableTranslation: add new parameter clientFramework to addElementToAdminMenu.

Needs change in the main generator and in the entity audit module.

I can do PR-s to both projects.

TypeError: jhipsterFunc.copyTemplate is not a function

vagrant@vagrant-ubuntu-trusty-64:~/git/latest$ yo jhipster-entity-audit
Composing JHipster configuration with module entity-audit
Welcome to the JHipster Entity Audit Generator! v1.0.0

? Do you want to enable audit for all existing entities? Yes, update all
? Do you want to add an audit log page for entities? Yes
Reading the JHipster project configuration for your module
events.js:141
throw er; // Unhandled 'error' event
^

TypeError: jhipsterFunc.copyTemplate is not a function
at null. (/usr/lib/node_modules/generator-jhipster-entity-audit/generators/app/index.js:127:24)
at Array.forEach (native)
at copyFiles (/usr/lib/node_modules/generator-jhipster-entity-audit/generators/app/index.js:126:15)
at module.exports.yeoman.generators.Base.extend.writing.writeBaseFiles (/usr/lib/node_modules/generator-jhipster-entity-audit/generators/app/index.js:147:12)
at /usr/lib/node_modules/generator-jhipster-entity-audit/node_modules/yeoman-generator/lib/base.js:430:16
at processImmediate as _immediateCallback
vagrant@vagrant-ubuntu-trusty-64:~/git/latestrsid$

Exception thrown in Post CREATE audit when extending from abstract auditing domain entity

Is this expected behavior due to the following line in the docs?

The module will extend the selected entities and its DTOs with AbstractAuditingEntity and AbstractAuditingDTO class respectively to enable audits, hence make sure that your entities/DTOs doesn't have any super class.

If it's not, here's what I've done which creates the problem.
Pseudo code:

@Entity @Inheritance(strategy = InheritanceType.JOINED) abstract class A extends AbstractAuditingEntity { @Id Long Id;}
@Entity class B extends A {}

When persisting class B the following execption is thrown:

2016-03-22 09:51:40.912 DEBUG 8552 --- [subs-Executor-1] n.b.s.c.a.AsyncEntityAuditEventWriter    : -------------- Post CREATE audit  --------------
2016-03-22 09:51:40.913 ERROR 8552 --- [subs-Executor-1] n.b.s.c.a.AsyncEntityAuditEventWriter    : Exception while getting entity ID and content {}

java.lang.NoSuchFieldException: id
    at java.lang.Class.getDeclaredField(Class.java:2070) ~[na:1.8.0_66-internal]
    at nl.bc.subs.config.audit.AsyncEntityAuditEventWriter.prepareAuditEntity(AsyncEntityAuditEventWriter.java:63) [classes/:na]
    at nl.bc.subs.config.audit.AsyncEntityAuditEventWriter.writeAuditEvent(AsyncEntityAuditEventWriter.java:38) [classes/:na]
    at nl.bc.subs.config.audit.AsyncEntityAuditEventWriter$$FastClassBySpringCGLIB$$e963bdb0.invoke(<generated>) [classes/:na]
    at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) [spring-core-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:720) [spring-aop-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) [spring-aop-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    at org.springframework.aop.interceptor.AsyncExecutionInterceptor$1.call(AsyncExecutionInterceptor.java:108) [spring-aop-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_66-internal]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_66-internal]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_66-internal]
    at java.lang.Thread.run(Thread.java:745) [na:1.8.0_66-internal]

generated index names for jhi_entity_audit_event too long for Oracle

When you run the entity audit generator for a system that uses an Oracle database, the generated index names for the jhi_entity_audit_event table are too long (>30 characters) for Oracle to create.

The workaround is to hand-edit the generated changeset file, but that's awkward.

example audit entity generator session:

$ !yo
yo
? 'Allo Craven,! What would you like to do? Jhipster Entity Audit

Make sure you are in the directory you want to scaffold into.
This generator can also be run with: yo jhipster-entity-audit

Welcome to the JHipster Entity Audit Generator! v3.1.0

? Choose which audit framework you would like to use. Custom JHipster auditing (works with SQL)
? Do you want to enable audit for all existing entities? Yes, update all
? Do you want to add an audit log page for entities? Yes

I'm Updating selected entities ....

Make sure these classes does not extend any other class to avoid any errors during compilation.
identical package.json
identical src/main/java/com/myco/audit/config/audit/AsyncEntityAuditEventWriter.java
identical src/main/java/com/myco/audit/config/audit/EntityAuditEventListener.java
identical src/main/java/com/myco/audit/config/audit/EntityAuditAction.java
identical src/main/java/com/myco/audit/config/audit/EntityAuditEventConfig.java
identical src/main/java/com/myco/audit/domain/EntityAuditEvent.java
identical src/main/java/com/myco/audit/repository/EntityAuditEventRepository.java
identical src/main/java/com/myco/audit/service/dto/AbstractAuditingDTO.java
create src/main/resources/config/liquibase/changelog/20171220234244_added_entity_EntityAuditEvent.xml
conflict src/main/resources/config/liquibase/master.xml
? Overwrite src/main/resources/config/liquibase/master.xml? overwrite
force src/main/resources/config/liquibase/master.xml
identical src/main/java/com/myco/audit/domain/AbstractAuditingEntity.java
... my entities
force src/main/webapp/app/admin/entity-audit/entity-audit-event.model.ts
force src/main/webapp/app/admin/entity-audit/entity-audit-modal.component.html
force src/main/webapp/app/admin/entity-audit/entity-audit-modal.component.ts
force src/main/webapp/app/admin/entity-audit/entity-audit-routing.module.ts
force src/main/webapp/app/admin/entity-audit/entity-audit.component.html
force src/main/webapp/app/admin/entity-audit/entity-audit.component.ts
force src/main/webapp/app/admin/entity-audit/entity-audit.module.ts
force src/main/webapp/app/admin/entity-audit/entity-audit.service.ts
force src/main/java/com/myco/audit/web/rest/EntityAuditResource.java
force src/main/webapp/app/admin/admin.module.ts
force src/main/webapp/app/layouts/navbar/navbar.component.html

I'm all done. Running yarn install for you to install the required dependencies. If this fails, try running the command yourself.

....

If we then compare the generated version of the change set to a working one:

too long (generated):
<createIndex indexName="idx_entity_audit_event_entity_id" tableName="jhi_entity_audit_event"> <column name="entity_id" type="bigint"/> </createIndex> <createIndex indexName="idx_entity_audit_event_entity_type" tableName="jhi_entity_audit_event"> <column name="entity_type" type="varchar(255)"/> </createIndex>

shortened:
<createIndex indexName="idx_entity_audit_event_entity_id" tableName="jhi_entity_audit_event"> <column name="entity_id" type="bigint"/> </createIndex> <createIndex indexName="idx_entity_audit_event_entity_type" tableName="jhi_entity_audit_event"> <column name="entity_type" type="varchar(255)"/> </createIndex>

Unable to access lob stream error with posgres

Overview of the issue and Motivation for or Use Case

Can't fetch result from drop-down list in http://localhost:8080/#/entity-audits

Actual Behavior
Error in Stack Trace and does`t display any result.

Expected Behavior
Display result.

My stack trace

[io-8080-exec-10] com.mymac.aop.logging.LoggingAspect  : Exception in com.mymac.web.rest.EntityAuditResource.getChanges() with cause = {} and exception {}

 org.springframework.orm.jpa.JpaSystemException: Unable to access lob stream; nested exception is org.hibernate.HibernateException: Unable to access lob stream
    at org.springframework.orm.jpa.vendor.HibernateJpaDialect.convertHibernateAccessException(HibernateJpaDialect.java:314)
    at org.springframework.orm.jpa.vendor.HibernateJpaDialect.translateExceptionIfPossible(HibernateJpaDialect.java:225)
    at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.translateExceptionIfPossible(AbstractEntityManagerFactoryBean.java:436)
    at org.springframework.dao.support.ChainedPersistenceExceptionTranslator.translateExceptionIfPossible(ChainedPersistenceExceptionTranslator.java:59)
    at org.springframework.dao.support.DataAccessUtils.translateIfNecessary(DataAccessUtils.java:213)
    at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:147)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
    at org.springframework.data.jpa.repository.support.CrudMethodMetadataPostProcessor$CrudMethodMetadataPopulatingMethodInterceptor.invoke(CrudMethodMetadataPostProcessor.java:131)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
    at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:208)
    at com.sun.proxy.$Proxy192.findAllByEntityType(Unknown Source)
    at com.mymac.web.rest.EntityAuditResource.getChanges(EntityAuditResource.java:68)
    at com.mymac.web.rest.EntityAuditResource$$FastClassBySpringCGLIB$$603e1f69.invoke(<generated>)
    at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
    at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:720)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
    at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:85)
    at com.mymac.aop.logging.LoggingAspect.logAround(LoggingAspect.java:51)
    at sun.reflect.GeneratedMethodAccessor368.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:620)
    at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:609)
    at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:68)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
    at org.springframework.aop.aspectj.AspectJAfterThrowingAdvice.invoke(AspectJAfterThrowingAdvice.java:59)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
    at org.springframework.security.access.intercept.aopalliance.MethodSecurityInterceptor.invoke(MethodSecurityInterceptor.java:68)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
    at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
    at com.ryantenney.metrics.spring.TimedMethodInterceptor.invoke(TimedMethodInterceptor.java:48)
    at com.ryantenney.metrics.spring.TimedMethodInterceptor.invoke(TimedMethodInterceptor.java:34)
    at com.ryantenney.metrics.spring.AbstractMetricMethodInterceptor.invoke(AbstractMetricMethodInterceptor.java:59)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
    at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:655)
    at com.mymac.web.rest.EntityAuditResource$$EnhancerBySpringCGLIB$$a6e0b2f4.getChanges(<generated>)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221)
    at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:136)
    at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:110)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:817)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:731)
    at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:959)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:968)
    at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:859)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:622)
    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:844)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
    at com.codahale.metrics.servlet.AbstractInstrumentedFilter.doFilter(AbstractInstrumentedFilter.java:104)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
    at org.springframework.boot.actuate.autoconfigure.EndpointWebMvcAutoConfiguration$ApplicationContextHeaderFilter.doFilterInternal(EndpointWebMvcAutoConfiguration.java:237)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
    at org.springframework.boot.actuate.trace.WebRequestTraceFilter.doFilterInternal(WebRequestTraceFilter.java:112)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:316)
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:126)
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:90)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:114)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:122)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:111)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:169)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:48)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    at org.springframework.security.oauth2.provider.authentication.OAuth2AuthenticationProcessingFilter.doFilter(OAuth2AuthenticationProcessingFilter.java:176)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:120)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:64)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:91)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:53)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:213)
    at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:176)
    at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
    at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:262)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
    at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
    at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:87)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
    at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:77)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
    at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:121)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:522)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1095)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:672)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1500)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1456)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Thread.java:745)
    Caused by: org.hibernate.HibernateException: Unable to access lob stream
    at org.hibernate.type.descriptor.java.DataHelper.extractString(DataHelper.java:287)
    at org.hibernate.type.descriptor.java.StringTypeDescriptor.wrap(StringTypeDescriptor.java:89)
    at org.hibernate.type.descriptor.java.StringTypeDescriptor.wrap(StringTypeDescriptor.java:39)
    at org.hibernate.type.descriptor.sql.ClobTypeDescriptor$1.doExtract(ClobTypeDescriptor.java:61)
    at org.hibernate.type.descriptor.sql.BasicExtractor.extract(BasicExtractor.java:64)
    at org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:267)
    at org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:263)
    at org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:253)
    at org.hibernate.type.AbstractStandardBasicType.hydrate(AbstractStandardBasicType.java:338)
    at org.hibernate.persister.entity.AbstractEntityPersister.hydrate(AbstractEntityPersister.java:2969)
    at org.hibernate.loader.Loader.loadFromResultSet(Loader.java:1696)
    at org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:1628)
    at org.hibernate.loader.Loader.getRow(Loader.java:1515)
    at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:726)
    at org.hibernate.loader.Loader.processResultSet(Loader.java:953)
    at org.hibernate.loader.Loader.doQuery(Loader.java:921)
    at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:355)
    at org.hibernate.loader.Loader.doList(Loader.java:2554)
    at org.hibernate.loader.Loader.doList(Loader.java:2540)
    at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2370)
    at org.hibernate.loader.Loader.list(Loader.java:2365)
    at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:497)
    at org.hibernate.hql.internal.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:387)
    at org.hibernate.engine.query.spi.HQLQueryPlan.performList(HQLQueryPlan.java:236)
    at org.hibernate.internal.SessionImpl.list(SessionImpl.java:1300)
    at org.hibernate.internal.QueryImpl.list(QueryImpl.java:103)
    at org.hibernate.jpa.internal.QueryImpl.list(QueryImpl.java:573)
    at org.hibernate.jpa.internal.QueryImpl.getResultList(QueryImpl.java:449)
    at org.hibernate.jpa.criteria.compile.CriteriaQueryTypeQueryAdapter.getResultList(CriteriaQueryTypeQueryAdapter.java:67)
    at sun.reflect.GeneratedMethodAccessor478.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.springframework.orm.jpa.SharedEntityManagerCreator$DeferredQueryInvocationHandler.invoke(SharedEntityManagerCreator.java:368)
    at com.sun.proxy.$Proxy262.getResultList(Unknown Source)
    at org.springframework.data.jpa.repository.query.JpaQueryExecution$PagedExecution.doExecute(JpaQueryExecution.java:191)
    at org.springframework.data.jpa.repository.query.JpaQueryExecution.execute(JpaQueryExecution.java:78)
    at org.springframework.data.jpa.repository.query.AbstractJpaQuery.doExecute(AbstractJpaQuery.java:100)
    at org.springframework.data.jpa.repository.query.AbstractJpaQuery.execute(AbstractJpaQuery.java:91)
    at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.doInvoke(RepositoryFactorySupport.java:462)
    at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:440)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
    at org.springframework.data.projection.DefaultMethodInvokingMethodInterceptor.invoke(DefaultMethodInvokingMethodInterceptor.java:61)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
    at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
    at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281)
    at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
    at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:136)
    ... 129 common frames omitted
    Caused by: org.postgresql.util.PSQLException: Large Objects may not be used in auto-commit mode.
    at org.postgresql.largeobject.LargeObjectManager.open(LargeObjectManager.java:263)
    at org.postgresql.largeobject.LargeObjectManager.open(LargeObjectManager.java:248)
    at org.postgresql.jdbc2.AbstractJdbc2BlobClob.getLo(AbstractJdbc2BlobClob.java:306)
    at org.postgresql.jdbc2.AbstractJdbc2BlobClob.getBinaryStream(AbstractJdbc2BlobClob.java:140)
    at org.postgresql.jdbc2.AbstractJdbc2Clob.getCharacterStream(AbstractJdbc2Clob.java:36)
    at org.hibernate.type.descriptor.java.DataHelper.extractString(DataHelper.java:280)
    ... 176 common frames omitted

JHipster Version(s)

Version 3.1

Browsers and Operating System

Chrome and OS X (version 10.11.4).

JHipster configuration, a .yo-rc.json file generated in the root folder

 {
    "generator-jhipster": {
    "jhipsterVersion": "3.1.0",
    "baseName": "social",
    "packageName": "com.mymac",
    "packageFolder": "com/mymac",
    "serverPort": "8080",
    "authenticationType": "oauth2",
    "hibernateCache": "ehcache",
    "clusteredHttpSession": "no",
    "websocket": "spring-websocket",
    "databaseType": "sql",
    "devDatabaseType": "postgresql",
    "prodDatabaseType": "postgresql",
    "searchEngine": "elasticsearch",
    "buildTool": "maven",
    "useSass": false,
    "applicationType": "monolith",
    "testFrameworks": [
    "gatling",
    "cucumber",
    "protractor"
    ],
    "enableTranslation": true,
    "nativeLanguage": "ru",
    "languages": [
    "ru",
    "en"
    ],
    "enableSocialSignIn": false,
    "jhiPrefix": "jhi"
    },
    "generator-jhipster-entity-audit": {
    "auditFramework": "custom"
    }
}

Reproduce the error

  1. Create JHipster app
  2. Generate an entity
  3. Install module Entity Audit
  4. Access http://localhost:8080/#/entity-audits
  5. Select from drop-down list the entity and fetch the result

Entity configuration(s) entityName.json files generated in the .jhipster directory
Not relevant.

Related issues
No

Suggest a Fix

  1. Change below code in EntityAuditEvent.java

from

  @Lob  
  @Column(name = "entity_value")
  private String entityValue;

to

  @Column(name = "entity_value")
  private String entityValue;
  1. Change below code in xxxxxxxxxxxxxxxxx_added_entity_EntityAuditEvent.xml

from

  <column name="entity_value" type="clob"/>

to

  <column name="entity_value" type="varchar(2048)"/>

Summary

I didn't realise the reason in using the type clob.

P.S.S. I can send PR if you don't mind?

Cannot find module 'glob'

Hi Deepu,

When I run yo jhipster-entity-audit, I get an error:
Error: Cannot find module 'glob'

node -v
v4.2.3

I solved it by npm install -g glob, maybe a dep is missing in package.json

No need to have @NotNull on AbstractAuditingDTO

I have opened an issue on generator-hipster (jhipster/generator-jhipster#3135) in order to ask to not have @NotNull annotation on AbstractAuditingEntity because it is unnecessary once you have @createdby, @CreatedDate, ..., annotations that makes @NotNull irrelevant.

Once they remove that annotation, AbstractAuditingDTO can have only @ReadOnlyProperty as annotation on its fields. That way it will deliver the information and not request to be sent once you create a new resource.

Generator fails to start, module load issue

Entity audit generator (v.2.0.1 from npm) fails to start:

module.js:341
    throw err;
    ^

Error: Cannot find module 'generator-jhipster'
    at Function.Module._resolveFilename (module.js:339:15)
    at Function.Module._load (module.js:290:25)
    at Module.require (module.js:367:17)
    at require (internal/module.js:16:19)
    at Object.<anonymous> (/usr/lib/node_modules/generator-jhipster-entity-audit/generators/app/index.js:6:16)
    at Module._compile (module.js:413:34)
    at Object.Module._extensions..js (module.js:422:10)
    at Module.load (module.js:357:32)
    at Function.Module._load (module.js:314:12)
    at Module.require (module.js:367:17)

NodeJS 5.9.0 or 4.4.0 installed from nodesource deb repository, npm 3.8.2, freshly installed ubuntu 14.04.
Installed via
sudo npm install -g yo bower gulp generator-jhipster generator-jhipster-entity-audit

Could not compose module generator-jhipster-entity-audit

At the end of the process of creating a new entity using JHipster entity I would expect to be asked to enable audit since "jhipster-entity-audit module registers itself as a hook for Jhipster and the question to enable audit should be available during any new entity generation".
Instead I get the following error:

Could not compose module generator-jhipster-entity-audit.
Make sure you have installed the module with 'npm -g generator-jhipster-entity-audit

Actually the generator IS installed. Executing yo jhipster-entity-audit manually completes the process.

Could anybody explain to me why the module is not properly composed?
Am I missing anything?

Thanks in advance

Roles based access is broken

Hi m8,

"New" Jhipster generator uses authorities in stead of roles property key in data attribute of state config:

data: {
                **_authorities_**: ['ROLE_ADMIN'],
                pageTitle: 'Entity Audits'
            },

when I run jhipster:upgrade the overwrite question hangs the update

I am trying to upgrade jhipster using jhipster:upgrade, but when it re-generates the entities it hangs over the question to overwrite me domain files once it runs the hook for this module.

The option I took was to remove the hook, run the upgrade then get it back.

Does anyone think that might have another better solution?

TypeError: jhipsterFunc.copyTemplate is not a function

I get this error when running the module.

yo jhipster-entity-audit
Composing JHipster configuration with module entity-audit
Welcome to the JHipster Entity Audit Generator! v0.1.6

? Do you want to enable audit for all existing entities? Yes, update all
? Do you want to add an audit log page for entities? Yes

Could not register as a post entity creation hook
Reading the JHipster project configuration for your module
events.js:141
      throw er; // Unhandled 'error' event
      ^

TypeError: jhipsterFunc.copyTemplate is not a function
    at module.exports.yeoman.generators.Base.extend.writing (/home/gael/.nvm/versions/node/v4.2.3/lib/node_modules/generator-jhipster-entity-audit/generators/app/index.js:123:18)
    at /home/gael/.nvm/versions/node/v4.2.3/lib/node_modules/generator-jhipster-entity-audit/node_modules/yeoman-generator/lib/base.js:430:16
    at processImmediate [as _immediateCallback] (timers.js:383:17)

disable info logs on production build

Why the info logs are not disabled while running the app on product mode, I am not talking about entity audit logs, this are info logs that are written into log file.


    Application 'mallService' is running! Access URLs:
    Local:          http://localhost:9091
    External:       http://192.168.33.1:9091
    Profile(s):     [prod]

2017-06-15 12:05:39.248 ERROR 7184 --- [ XNIO-2 task-5] c.nearbuy.mall.web.rest.util.HeaderUtil : Entity creation failed, Could not read file: logo/11874f43-c33c-4d58-8d40-e5935c0b7b34.png
2017-06-15 12:05:39.248 ERROR 7184 --- [ XNIO-2 task-4] c.nearbuy.mall.web.rest.util.HeaderUtil : Entity creation failed, Could not read file: logo/5666ac47-2f22-4c95-b0e2-cfa8800911e8.png
2017-06-15 12:06:28.083 ERROR 7184 --- [ XNIO-2 task-9] c.nearbuy.mall.web.rest.util.HeaderUtil : Entity creation failed, Could not read file: logo/11874f43-c33c-4d58-8d40-e5935c0b7b34.png
2017-06-15 12:06:28.133 ERROR 7184 --- [ XNIO-2 task-10] c.nearbuy.mall.web.rest.util.HeaderUtil : Entity creation failed, Could not read file: logo/5666ac47-2f22-4c95-b0e2-cfa8800911e8.png
2017-06-15 12:06:31.640 ERROR 7184 --- [ XNIO-2 task-15] c.nearbuy.mall.web.rest.util.HeaderUtil : Entity creation failed, Could not read file: logo/11874f43-c33c-4d58-8d40-e5935c0b7b34.png
2017-06-15 12:06:31.641 ERROR 7184 --- [ XNIO-2 task-16] c.nearbuy.mall.web.rest.util.HeaderUtil : Entity creation failed, Could not read file: banner/b71c5cba-ace2-40c9-8d75-4a32dcad7963.jpg
2017-06-15 12:06:40.855 INFO 7184 --- [ XNIO-2 task-23] org.javers.core.Javers : Commit(id:79.0, snapshots:3, author:admin, changes - ValueChange:6)
2017-06-15 12:06:41.051 ERROR 7184 --- [ XNIO-2 task-28] c.nearbuy.mall.web.rest.util.HeaderUtil : Entity creation failed, Could not read file: logo/5666ac47-2f22-4c95-b0e2-cfa8800911e8.png

Liquibase error when generating entity audit module to an existing project

When running entity audit module on an existing project the generator creates new columns to the existing changelog of each entity, due to this liquibase throws database changelog validation error during the build.

Suggestion: Instead of creating in the existing changeset create a new changelog file similar to when running liquibase:diff

yo jhipster-entity-audit default fails

Hello,
I tried to run the entity-audit-generator and it failed with this error:

TypeError: this.addEntityToCache is not a function
    at Object.addEntityToEhcache (/usr/lib/node_modules/generator-jhipster/generators/generator-base.js:718:14)
    at child.writeBaseFiles (/usr/lib/node_modules/generator-jhipster-entity-audit/generators/app/index.js:212:24)
    at Object.<anonymous> (/usr/lib/node_modules/generator-jhipster-entity-audit/node_modules/yeoman-generator/lib/base.js:436:25)
    at /usr/lib/node_modules/generator-jhipster-entity-audit/node_modules/yeoman-generator/node_modules/run-async/index.js:25:25
    at /usr/lib/node_modules/generator-jhipster-entity-audit/node_modules/yeoman-generator/node_modules/run-async/index.js:24:19
    at /usr/lib/node_modules/generator-jhipster-entity-audit/node_modules/yeoman-generator/lib/base.js:448:8
    at runCallback (timers.js:672:20)
    at tryOnImmediate (timers.js:645:5)
    at processImmediate [as _immediateCallback] (timers.js:617:5)

npm: 3.10.10
node: v6.11.0
yo: 2.0.0
generator-jhipster: v4.5.6
generator-jhipster-entity-audit: v2.4.1

What does this mean?
The full output is below.

Thank you in advance.

micoud

--8<--

$ yo jhipster-entity-audit
Composing JHipster configuration with module entity-audit
Welcome to the JHipster Entity Audit Generator! v2.4.1

Reading the JHipster project configuration for your module
? Choose which audit framework you would like to use. Custom JHipster auditing (works with SQL)
? Do you want to enable audit for all existing entities? No, let me choose the entities to update
? Please choose the entities to be audited Incident
? Do you want to add an audit log page for entities? Yes
TypeError: this.addEntityToCache is not a function
    at Object.addEntityToEhcache (/usr/lib/node_modules/generator-jhipster/generators/generator-base.js:718:14)
    at child.writeBaseFiles (/usr/lib/node_modules/generator-jhipster-entity-audit/generators/app/index.js:212:24)
    at Object.<anonymous> (/usr/lib/node_modules/generator-jhipster-entity-audit/node_modules/yeoman-generator/lib/base.js:436:25)
    at /usr/lib/node_modules/generator-jhipster-entity-audit/node_modules/yeoman-generator/node_modules/run-async/index.js:25:25
    at /usr/lib/node_modules/generator-jhipster-entity-audit/node_modules/yeoman-generator/node_modules/run-async/index.js:24:19
    at /usr/lib/node_modules/generator-jhipster-entity-audit/node_modules/yeoman-generator/lib/base.js:448:8
    at runCallback (timers.js:672:20)
    at tryOnImmediate (timers.js:645:5)
    at processImmediate [as _immediateCallback] (timers.js:617:5)

Error to generate entity audit

Hello i have this error when i trying to ejecute yo jhipster-entity-audit
i have jhipster 4.7.0, my app is microservice. jhipster-entity-audit 2.6.0

`module.js:471
throw err;
^

Error: Cannot find module 'utils'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object. (/home/jlopez/.npm-global/lib/node_modules/generator-jhipster-entity-audit/generators/app/index.js:10:18)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
`

my .yo-rc.json

{ "generator-jhipster": { "promptValues": { "packageName": "com.seguritech.cadmobile", "nativeLanguage": "es" }, "jhipsterVersion": "4.7.0", "baseName": "cadgateway", "packageName": "com.seguritech.cadmobile", "packageFolder": "com/seguritech/cadmobile", "serverPort": "8081", "authenticationType": "jwt", "hibernateCache": "hazelcast", "clusteredHttpSession": false, "websocket": false, "databaseType": "sql", "devDatabaseType": "h2Disk", "prodDatabaseType": "oracle", "searchEngine": false, "messageBroker": false, "serviceDiscoveryType": "eureka", "buildTool": "maven", "enableSocialSignIn": false, "jwtSecretKey": "91c5f31d5705b964700cff9f97985aac13b71fd5", "enableTranslation": true, "applicationType": "microservice", "testFrameworks": [ "gatling" ], "jhiPrefix": "jhi", "skipClient": true, "skipUserManagement": true, "nativeLanguage": "es", "languages": [ "es" ], "clientPackageManager": "yarn" }, "generator-jhipster-entity-audit": { "auditFramework": "custom" } }

Unable to install/create docker using yo jhipster-docker default

I tried to create micro-services gateway and try to run it via docker. But running below command gives error.

yo jhipster-docker default
module.js:327
    throw err;
    ^

Error: Cannot find module 'generator-jhipster'
    at Function.Module._resolveFilename (module.js:325:15)
    at Function.Module._load (module.js:276:25)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (D:\Users\balakumar\AppData\Roaming\npm\node_modules\generator-jhipster-docker\generators\app\index.js:6:16)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Module.require (module.js:353:17)`

Timeouts when table gets too big

Hi

I was having a problem with this plugin, the following query was taking too long and causing a timeout:

select max(entityaudi0_.commit_version) as col_0_0_ from jhi_entity_audit_event entityaudi0_ where entityaudi0_.entity_type='xxxxxxxxxx' and entityaudi0_.entity_id=128200;

Doing an explain the result is:

id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE entityaudi0_ ALL NULL NULL NULL NULL 504808

So what I did to fix was adding an index on the where fields (sorry, no command as I used a visual tool and too lazy).

That changed my explain to:

id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE entityaudi0_ ref entity_id_type entity_id_type 265 const,const 1

And that speed up the query almost 99% (was taking 40s now taking less than 1 second).

I think it would be nice if you'd automatically add it to the liquibase table creation.

Entity Test failed because of Unmatched Zone in ZonedDateTime between DB and ElasticSearch

After I install Entity-audit on Jhipster 3.4.0, All XXXResourceIntTest failed because lastModifiedDate and createdDate are not matched in following test. Also you can find the failure trace below. It seems that Entity has different time zones between DB and ElasticSearch.

FYI, if run ZonedDateTime.now(), I get London TimeZone which different from UTC from ElasticSearch.

` @test
@transactional
public void createAddress() throws Exception {
int databaseSizeBeforeCreate = addressRepository.findAll().size();

    // Create the Address
    AddressDTO addressDTO = addressMapper.addressToAddressDTO(address);

    restAddressMockMvc
            .perform(post("/api/addresses").contentType(TestUtil.APPLICATION_JSON_UTF8)
                    .content(TestUtil.convertObjectToJsonBytes(addressDTO)))
            .andExpect(status().isCreated());

    // Validate the Address in the database
    List<Address> addresses = addressRepository.findAll();
    assertThat(addresses).hasSize(databaseSizeBeforeCreate + 1);
    Address testAddress = addresses.get(addresses.size() - 1);
    assertThat(testAddress.getName()).isEqualTo(DEFAULT_NAME);
    assertThat(testAddress.getAddress()).isEqualTo(DEFAULT_ADDRESS);

    // Validate the Address in ElasticSearch
    Address addressEs = addressSearchRepository.findOne(testAddress.getId());
    assertThat(addressEs).isEqualToComparingFieldByField(testAddress);
}`

The failure trace are:

java.lang.AssertionError:
Expecting values:
<[2016-06-23T09:30:33.072+01:00[Europe/London],
2016-06-23T09:30:33.072+01:00[Europe/London]]>
in fields:
<["createdDate", "lastModifiedDate"]>
but were:
<[2016-06-23T08:30:33.072Z[UTC], 2016-06-23T08:30:33.072Z[UTC]]>
in <Address{id=5, name='AAAAA', address='AAAAA'}>.
Comparison was performed on all fields
at com.espion.ems.web.rest.AddressResourceIntTest.createAddress(AddressResourceIntTest.java:115)

javers support not working anymore

Running the generator and selecting Javers auditing framework fails with:

ERROR! Copying template src/main/java/package/web/rest/_JaversEntityAuditResource.java failed. [ReferenceError: /home/gimoh/wrk/github.com/gimoh/generator-jhipster-entity-audit/generators/app/templates/src/main/java/package/web/rest/_JaversEntityAuditResource.java:58
    56|     public List<String> getAuditedEntities() {
    57| 
 >> 58|       return Arrays.asList(<%- auditedEntities %>);
    59|     }
    60| 
    61|     /**

After commit 72d0ae8 auditedEntities is now assigned inside utils.js in #updateEntityAudit but only conditionally and when I run it both conditions are false, i.e. updateIndex === undefined and this.fs.exists(`${javaDir}web/rest/JaversEntityAuditResource.java`) === false.

I can submit a PR but will need some guidance on what the code is supposed to do. Could this block to update list of audited entities be moved out of updateEntityAudit and back into the main? In fact, would it make sense to put it into #writeAuditPageFiles?

entity audits are not saved in H2 database

Overview of the issue

I am using the custom (it means not Javers) version of the entity audit module.
After saving or deleting entity row, error is thrown on saving entity audit:

2017-01-21 00:49:27.018 DEBUG 12056 --- [ster-Executor-2] c.m.m.c.a.AsyncEntityAuditEventWriter    : -------------- Post CREATE audit  --------------
Hibernate: call next value for hibernate_sequence
2017-01-21 00:49:27.040  WARN 12056 --- [ster-Executor-2] o.h.engine.jdbc.spi.SqlExceptionHelper   : SQL Error: 90036, SQLState: 90036
2017-01-21 00:49:27.040 ERROR 12056 --- [ster-Executor-2] o.h.engine.jdbc.spi.SqlExceptionHelper   : Sequence "HIBERNATE_SEQUENCE" not found; SQL statement:
call next value for hibernate_sequence [90036-193]
2017-01-21 00:49:27.052 ERROR 12056 --- [ster-Executor-2] c.m.m.c.a.AsyncEntityAuditEventWriter    : Exception while persisting audit entity for Category{id=1, code=
'1', name='a'} error: {}

org.springframework.orm.jpa.JpaSystemException: could not prepare statement; nested exception is org.hibernate.exception.GenericJDBCException: could not prepare stat
ement
        at org.springframework.orm.jpa.vendor.HibernateJpaDialect.convertHibernateAccessException(HibernateJpaDialect.java:333)
        at org.springframework.orm.jpa.vendor.HibernateJpaDialect.translateExceptionIfPossible(HibernateJpaDialect.java:244)
        at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.translateExceptionIfPossible(AbstractEntityManagerFactoryBean.java:491)
        at org.springframework.dao.support.ChainedPersistenceExceptionTranslator.translateExceptionIfPossible(ChainedPersistenceExceptionTranslator.java:59)
        at org.springframework.dao.support.DataAccessUtils.translateIfNecessary(DataAccessUtils.java:213)
        at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:147)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
        at org.springframework.data.jpa.repository.support.CrudMethodMetadataPostProcessor$CrudMethodMetadataPopulatingMethodInterceptor.invoke(CrudMethodMetadataPos
tProcessor.java:133)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
        at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213)
        at com.sun.proxy.$Proxy190.save(Unknown Source)
        at com.mycompany.myapp.config.audit.AsyncEntityAuditEventWriter.writeAuditEvent(AsyncEntityAuditEventWriter.java:40)
        at com.mycompany.myapp.config.audit.AsyncEntityAuditEventWriter$$FastClassBySpringCGLIB$$87c1b3f5.invoke(<generated>)
        at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
        at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:721)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
        at org.springframework.aop.interceptor.AsyncExecutionInterceptor$1.call(AsyncExecutionInterceptor.java:115)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at io.github.jhipster.async.ExceptionHandlingAsyncTaskExecutor.lambda$createWrappedRunnable$1(ExceptionHandlingAsyncTaskExecutor.java:63)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
Caused by: org.hibernate.exception.GenericJDBCException: could not prepare statement
        at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:47)
        at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:111)
        at org.hibernate.engine.jdbc.internal.StatementPreparerImpl$StatementPreparationTemplate.prepareStatement(StatementPreparerImpl.java:182)
        at org.hibernate.engine.jdbc.internal.StatementPreparerImpl.prepareStatement(StatementPreparerImpl.java:72)
        at org.hibernate.id.enhanced.SequenceStructure$1.getNextValue(SequenceStructure.java:93)
        at org.hibernate.id.enhanced.NoopOptimizer.generate(NoopOptimizer.java:40)
        at org.hibernate.id.enhanced.SequenceStyleGenerator.generate(SequenceStyleGenerator.java:432)
        at org.hibernate.event.internal.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:105)
        at org.hibernate.jpa.event.internal.core.JpaPersistEventListener.saveWithGeneratedId(JpaPersistEventListener.java:67)
        at org.hibernate.event.internal.DefaultPersistEventListener.entityIsTransient(DefaultPersistEventListener.java:189)
        at org.hibernate.event.internal.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:132)
        at org.hibernate.event.internal.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:58)
        at org.hibernate.internal.SessionImpl.firePersist(SessionImpl.java:763)
        at org.hibernate.internal.SessionImpl.persist(SessionImpl.java:743)
        at org.hibernate.internal.SessionImpl.persist(SessionImpl.java:748)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.springframework.orm.jpa.SharedEntityManagerCreator$SharedEntityManagerInvocationHandler.invoke(SharedEntityManagerCreator.java:298)
        at com.sun.proxy.$Proxy186.persist(Unknown Source)
        at org.springframework.data.jpa.repository.support.SimpleJpaRepository.save(SimpleJpaRepository.java:506)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.executeMethodOn(RepositoryFactorySupport.java:503
)
        at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.doInvoke(RepositoryFactorySupport.java:488)
        at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:460)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
        at org.springframework.data.projection.DefaultMethodInvokingMethodInterceptor.invoke(DefaultMethodInvokingMethodInterceptor.java:61)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
        at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
        at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:282)
        at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
        at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:136)
        ... 18 common frames omitted
Caused by: org.h2.jdbc.JdbcSQLException: Sequence "HIBERNATE_SEQUENCE" not found; SQL statement:
call next value for hibernate_sequence [90036-193]
        at org.h2.message.DbException.getJdbcSQLException(DbException.java:345)
        at org.h2.message.DbException.get(DbException.java:179)
        at org.h2.message.DbException.get(DbException.java:155)
        at org.h2.command.Parser.readSequence(Parser.java:5439)
        at org.h2.command.Parser.readTerm(Parser.java:2822)
        at org.h2.command.Parser.readFactor(Parser.java:2324)
        at org.h2.command.Parser.readSum(Parser.java:2311)
        at org.h2.command.Parser.readConcat(Parser.java:2281)
        at org.h2.command.Parser.readCondition(Parser.java:2128)
        at org.h2.command.Parser.readAnd(Parser.java:2100)
        at org.h2.command.Parser.readExpression(Parser.java:2092)
        at org.h2.command.Parser.parseCall(Parser.java:4478)
        at org.h2.command.Parser.parsePrepared(Parser.java:364)
        at org.h2.command.Parser.parse(Parser.java:317)
        at org.h2.command.Parser.parse(Parser.java:289)
        at org.h2.command.Parser.prepareCommand(Parser.java:254)
        at org.h2.engine.Session.prepareLocal(Session.java:561)
        at org.h2.engine.Session.prepareCommand(Session.java:502)
        at org.h2.jdbc.JdbcConnection.prepareCommand(JdbcConnection.java:1203)
        at org.h2.jdbc.JdbcPreparedStatement.<init>(JdbcPreparedStatement.java:73)
        at org.h2.jdbc.JdbcConnection.prepareStatement(JdbcConnection.java:287)
        at com.zaxxer.hikari.pool.ProxyConnection.prepareStatement(ProxyConnection.java:313)
        at com.zaxxer.hikari.pool.HikariProxyConnection.prepareStatement(HikariProxyConnection.java)
        at org.hibernate.engine.jdbc.internal.StatementPreparerImpl$1.doPrepare(StatementPreparerImpl.java:87)
        at org.hibernate.engine.jdbc.internal.StatementPreparerImpl$StatementPreparationTemplate.prepareStatement(StatementPreparerImpl.java:172)
        ... 52 common frames omitted
Motivation for or Use Case

Entity audit is not usable.

Reproduce the error

Generate new project with .yo-rc.json below.
Then run yo jhipster-entity-audit and choose custom version.

Related issues
Suggest a Fix

In file _EntityAuditEvent.java change (like it is in the main generator) from:

    @GeneratedValue(strategy = GenerationType.AUTO)

to

        <%_ if (prodDatabaseType === 'mysql' || prodDatabaseType === 'mariadb') { _%>
    @GeneratedValue(strategy = GenerationType.IDENTITY)
        <%_ }  else { _%>
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sequenceGenerator")
    @SequenceGenerator(name = "sequenceGenerator")
        <%_ } _%>
JHipster Version(s)
[email protected] C:\projects\jhipster-test-cfw
`-- [email protected]  -> c:\projects\kaido-github\generator-jhipster
  `-- [email protected]  extraneous

JHipster configuration, a .yo-rc.json file generated in the root folder
{
  "generator-jhipster": {
    "jhipsterVersion": "3.12.2",
    "baseName": "jhipster",
    "packageName": "com.mycompany.myapp",
    "packageFolder": "com/mycompany/myapp",
    "serverPort": "8080",
    "authenticationType": "session",
    "hibernateCache": "ehcache",
    "clusteredHttpSession": false,
    "websocket": false,
    "databaseType": "sql",
    "devDatabaseType": "h2Disk",
    "prodDatabaseType": "mysql",
    "searchEngine": "false",
    "messageBroker": false,
    "buildTool": "gradle",
    "enableSocialSignIn": true,
    "rememberMeKey": "xxx",
    "useSass": false,
    "applicationType": "monolith",
    "testFrameworks": [
      "gatling",
      "cucumber",
      "protractor"
    ],
    "jhiPrefix": "jhi",
    "enableTranslation": true,
    "nativeLanguage": "et",
    "languages": [
      "et",
      "en"
    ],
    "serviceDiscoveryType": false,
    "clientPackageManager": "yarn",
    "clientFramework": "angular1"
  },
  "generator-jhipster-entity-audit": {
    "auditFramework": "custom"
  }
}
Entity configuration(s) entityName.json files generated in the .jhipster directory

Category.json

{
    "fluentMethods": true,
    "relationships": [],
    "fields": [
        {
            "fieldName": "code",
            "fieldType": "Integer"
        },
        {
            "fieldName": "name",
            "fieldType": "String",
            "fieldValidateRules": [
                "required"
            ]
        }
    ],
    "changelogDate": "20170119225339",
    "javadoc": "Category.",
    "entityTableName": "category",
    "dto": "no",
    "pagination": "no",
    "service": "no",
    "enableEntityAudit": true
}
Browsers and Operating System

java version "1.8.0_112"
Java(TM) SE Runtime Environment (build 1.8.0_112-b15)
Java HotSpot(TM) 64-Bit Server VM (build 25.112-b15, mixed mode)

git version 2.7.0.windows.1

node: v6.9.1

npm: 3.10.9

bower: 1.8.0

gulp:
[01:08:45] CLI version 1.2.2
[01:08:45] Local version 3.9.1

yeoman: 1.8.5

yarn: 0.18.1

entityAuditInterceptor required?

Sorry, I probably do not understand the benefits of entityAuditInterceptor. Is this interceptor really required? Because auditing fields are set on backend side (by AuditingEntityListener).

Does this work with JHipster 4.5.3?

Hi, I'm trying to use this generator with JHipster 4.5.3 (Running Spring Boot 1.5.4.RELEASE) with MySQL DB.

I get various BUILD FAILURE errors.

I investigated the code and there are some issues like the following that I can point out:

  • AsyncEntityAuditEventWriter class in config.audit (as well as EntityAuditResource in web.rest) make use of @Inject instead of @Autowired (and this causes error since javax.inject.Inject has been removed from JHipster generator);
  • EntityAuditEvent class is added in the domain but has a "private ZonedDateTime modifiedDate" attribute which is not compatible with created_date and lastModifiedDate in AbstractAuditingEntity class (AbstractAuditingEntity attributes are of type Instant and this cause the following Compilation Errors:
    AsyncEntityAuditEventWriter.java:[82,77] incompatible types: java.time.Instant cannot be converted to java.time.ZonedDateTime
    and
    AsyncEntityAuditEventWriter.java:[86,82] incompatible types: java.time.Instant cannot be converted to java.time.ZonedDateTime
    ).

Even if I try and fix those issues I get this error:

:: JHipster 🤓 :: Running Spring Boot 1.5.4.RELEASE ::
:: http://jhipster.github.io ::

2017-06-14 16:04:34.197 INFO 3922 --- [ restartedMain] com.tbit.jhbase.TBitJhTest01App : Starting TBitJhTest01App on centos7_dev01.tbit.local with PID 3922 (/home/io/workspace_neon/_TBit_JH_Test01/target/classes started by io in /home/io/workspace_neon/_TBit_JH_Test01)
2017-06-14 16:04:34.200 DEBUG 3922 --- [ restartedMain] com.tbit.jhbase.TBitJhTest01App : Running with Spring Boot v1.5.4.RELEASE, Spring v4.3.9.RELEASE
2017-06-14 16:04:34.201 INFO 3922 --- [ restartedMain] com.tbit.jhbase.TBitJhTest01App : The following profiles are active: swagger,dev
2017-06-14 16:04:34.779 DEBUG 3922 --- [kground-preinit] org.jboss.logging : Logging Provider: org.jboss.logging.Slf4jLoggerProvider found via system property
2017-06-14 16:04:38.199 DEBUG 3922 --- [ restartedMain] c.tbit.jhbase.config.AsyncConfiguration : Creating Async Task Executor
2017-06-14 16:04:39.532 DEBUG 3922 --- [ restartedMain] c.e.c.E.tbit.jhbase.domain.User : Initialize successful.
2017-06-14 16:04:39.575 DEBUG 3922 --- [ restartedMain] c.e.c.E.tbit.jhbase.domain.Authority : Initialize successful.
2017-06-14 16:04:39.592 DEBUG 3922 --- [ restartedMain] c.e.c.E.t.j.domain.User.authorities : Initialize successful.
2017-06-14 16:04:39.599 DEBUG 3922 --- [ restartedMain] c.e.c.E.t.jhbase.domain.PersistentToken : Initialize successful.
2017-06-14 16:04:39.604 DEBUG 3922 --- [ restartedMain] c.e.c.E.t.j.d.User.persistentTokens : Initialize successful.
2017-06-14 16:04:39.610 DEBUG 3922 --- [ restartedMain] c.e.c.E.t.j.d.E.persistentTokens : Initialize successful.
2017-06-14 16:04:40.039 DEBUG 3922 --- [ restartedMain] c.t.jhbase.config.MetricsConfiguration : Registering JVM gauges
2017-06-14 16:04:40.062 DEBUG 3922 --- [ restartedMain] c.t.jhbase.config.MetricsConfiguration : Monitoring the datasource
2017-06-14 16:04:40.063 DEBUG 3922 --- [ restartedMain] c.t.jhbase.config.MetricsConfiguration : Initializing Metrics JMX reporting
2017-06-14 16:04:41.293 DEBUG 3922 --- [ restartedMain] com.tbit.jhbase.config.WebConfigurer : Registering CORS filter
2017-06-14 16:04:41.534 INFO 3922 --- [ restartedMain] com.tbit.jhbase.config.WebConfigurer : Web application configuration, using profiles: swagger
2017-06-14 16:04:41.535 DEBUG 3922 --- [ restartedMain] com.tbit.jhbase.config.WebConfigurer : Initializing Metrics registries
2017-06-14 16:04:41.540 DEBUG 3922 --- [ restartedMain] com.tbit.jhbase.config.WebConfigurer : Registering Metrics Filter
2017-06-14 16:04:41.541 DEBUG 3922 --- [ restartedMain] com.tbit.jhbase.config.WebConfigurer : Registering Metrics Servlet
2017-06-14 16:04:41.547 INFO 3922 --- [ restartedMain] com.tbit.jhbase.config.WebConfigurer : Web application fully configured
2017-06-14 16:04:41.998 DEBUG 3922 --- [ restartedMain] c.t.jhbase.config.DatabaseConfiguration : Configuring Liquibase
2017-06-14 16:04:42.021 WARN 3922 --- [t-01-Executor-1] i.g.j.c.liquibase.AsyncSpringLiquibase : Starting Liquibase asynchronously, your database might not be ready at startup!
2017-06-14 16:04:43.998 WARN 3922 --- [ restartedMain] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.class]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory
2017-06-14 16:04:44.056 DEBUG 3922 --- [ restartedMain] c.e.c.E.t.j.d.User.persistentTokens : Close successful.
2017-06-14 16:04:44.057 DEBUG 3922 --- [ restartedMain] c.e.c.E.t.jhbase.domain.PersistentToken : Close successful.
2017-06-14 16:04:44.058 DEBUG 3922 --- [ restartedMain] c.e.c.E.t.j.d.E.persistentTokens : Close successful.
2017-06-14 16:04:44.059 DEBUG 3922 --- [ restartedMain] c.e.c.E.tbit.jhbase.domain.Authority : Close successful.
2017-06-14 16:04:44.063 DEBUG 3922 --- [ restartedMain] c.e.c.E.t.j.domain.User.authorities : Close successful.
2017-06-14 16:04:44.066 DEBUG 3922 --- [ restartedMain] c.e.c.E.tbit.jhbase.domain.User : Close successful.
2017-06-14 16:04:44.093 WARN 3922 --- [t-01-Executor-1] com.zaxxer.hikari.pool.ProxyConnection : HikariPool-1 - Connection com.mysql.jdbc.JDBC4Connection@78d7856a marked as broken because of SQLSTATE(08003), ErrorCode(0)

com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: No operations allowed after connection closed.
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:425)
at com.mysql.jdbc.Util.getInstance(Util.java:408)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:918)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:897)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:886)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:860)
at com.mysql.jdbc.ConnectionImpl.throwConnectionClosedException(ConnectionImpl.java:1187)
at com.mysql.jdbc.ConnectionImpl.checkClosed(ConnectionImpl.java:1182)
at com.mysql.jdbc.ConnectionImpl.rollback(ConnectionImpl.java:4505)
at com.zaxxer.hikari.pool.ProxyConnection.rollback(ProxyConnection.java:360)
at com.zaxxer.hikari.pool.HikariProxyConnection.rollback(HikariProxyConnection.java)
at liquibase.database.jvm.JdbcConnection.rollback(JdbcConnection.java:337)
at liquibase.database.AbstractJdbcDatabase.rollback(AbstractJdbcDatabase.java:1166)
at liquibase.lockservice.StandardLockService.acquireLock(StandardLockService.java:205)
at liquibase.lockservice.StandardLockService.waitForLock(StandardLockService.java:170)
at liquibase.Liquibase.update(Liquibase.java:196)
at liquibase.Liquibase.update(Liquibase.java:192)
at liquibase.integration.spring.SpringLiquibase.performUpdate(SpringLiquibase.java:431)
at liquibase.integration.spring.SpringLiquibase.afterPropertiesSet(SpringLiquibase.java:388)
at io.github.jhipster.config.liquibase.AsyncSpringLiquibase.initDb(AsyncSpringLiquibase.java:82)
at io.github.jhipster.config.liquibase.AsyncSpringLiquibase.lambda$afterPropertiesSet$0(AsyncSpringLiquibase.java:64)
at io.github.jhipster.async.ExceptionHandlingAsyncTaskExecutor.lambda$createWrappedRunnable$1(ExceptionHandlingAsyncTaskExecutor.java:66)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)

2017-06-14 16:04:44.096 WARN 3922 --- [t-01-Executor-1] liquibase : Failed to restore the auto commit to true
2017-06-14 16:04:44.096 ERROR 3922 --- [t-01-Executor-1] i.g.j.c.liquibase.AsyncSpringLiquibase : Liquibase could not start correctly, your database is NOT ready: java.sql.SQLException: Connection is closed

liquibase.exception.DatabaseException: java.sql.SQLException: Connection is closed
at liquibase.database.jvm.JdbcConnection.setAutoCommit(JdbcConnection.java:363)
at liquibase.database.AbstractJdbcDatabase.close(AbstractJdbcDatabase.java:1202)
at liquibase.integration.spring.SpringLiquibase.afterPropertiesSet(SpringLiquibase.java:397)
at io.github.jhipster.config.liquibase.AsyncSpringLiquibase.initDb(AsyncSpringLiquibase.java:82)
at io.github.jhipster.config.liquibase.AsyncSpringLiquibase.lambda$afterPropertiesSet$0(AsyncSpringLiquibase.java:64)
at io.github.jhipster.async.ExceptionHandlingAsyncTaskExecutor.lambda$createWrappedRunnable$1(ExceptionHandlingAsyncTaskExecutor.java:66)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.sql.SQLException: Connection is closed
at com.zaxxer.hikari.pool.ProxyConnection$ClosedConnection$1.invoke(ProxyConnection.java:468)
at com.sun.proxy.$Proxy106.setAutoCommit(Unknown Source)
at com.zaxxer.hikari.pool.ProxyConnection.setAutoCommit(ProxyConnection.java:378)
at com.zaxxer.hikari.pool.HikariProxyConnection.setAutoCommit(HikariProxyConnection.java)
at liquibase.database.jvm.JdbcConnection.setAutoCommit(JdbcConnection.java:361)
... 8 common frames omitted

2017-06-14 16:04:44.105 ERROR 3922 --- [ restartedMain] o.s.boot.SpringApplication : Application startup failed

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.class]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1628)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1078)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:857)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:303)
at com.tbit.jhbase.TBitJhTest01App.main(TBitJhTest01App.java:66)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)
Caused by: javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.persistenceException(EntityManagerFactoryBuilderImpl.java:967)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:892)
at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:60)
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:353)
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:370)
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:359)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1687)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1624)
... 19 common frames omitted
Caused by: java.lang.IllegalStateException: All Hibernate caches should be created upfront. Please update CacheConfiguration.java to add com.tbit.jhbase.domain.EntityAuditEvent
at io.github.jhipster.config.jcache.NoDefaultJCacheRegionFactory.createCache(NoDefaultJCacheRegionFactory.java:37)
at org.hibernate.cache.jcache.JCacheRegionFactory.getOrCreateCache(JCacheRegionFactory.java:190)
at org.hibernate.cache.jcache.JCacheRegionFactory.buildEntityRegion(JCacheRegionFactory.java:113)
at org.hibernate.cache.spi.RegionFactory.buildEntityRegion(RegionFactory.java:132)
at org.hibernate.internal.CacheImpl.determineEntityRegionAccessStrategy(CacheImpl.java:439)
at org.hibernate.metamodel.internal.MetamodelImpl.initialize(MetamodelImpl.java:120)
at org.hibernate.internal.SessionFactoryImpl.(SessionFactoryImpl.java:297)
at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:445)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:889)
... 25 common frames omitted

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 18.362 s
[INFO] Finished at: 2017-06-14T16:04:44+02:00
[INFO] Final Memory: 34M/493M
[INFO] ------------------------------------------------------------------------

Anyone can help?

Many thanks in advance

EntityAuditEvent: Hibernate Wrong Column Type Exception in Unit Tests

Hi,

when i generate a new jhipster project and create some entities, all my unit tests work just fine. [2] [3]
However, after generating the audit feature for all entities [4], all unit tests fail with the following exception under [1].
I created the Project with MySQL as Develop DB and here it works. For Unit Tests H2 is used, so my assumption was that there must be a problem between liquibase, H2 dialect and / or hibernate ?
Liquibase Changelog xml [5] shows me
<column name="entity_value" type="clob"/>
, so i cannot figure out where the expected varchar(255) does come from.

Can you confirm this problem?

PS: JHipster and Subgenerators are up to date.

Thanks in advance
Felix

[1]
Caused by: org.hibernate.HibernateException: Wrong column type in TESTPROJ.PUBLIC.JHI_ENTITY_AUDIT_EVENT for column entity_value. Found: clob, expected: varchar(255) at org.hibernate.mapping.Table.validateColumns(Table.java:373) ~[hibernate-core-4.3.11.Final.jar:4.3.11.Final] at org.hibernate.cfg.Configuration.validateSchema(Configuration.java:1338) ~[hibernate-core-4.3.11.Final.jar:4.3.11.Final] at org.hibernate.tool.hbm2ddl.SchemaValidator.validate(SchemaValidator.java:175) ~[hibernate-core-4.3.11.Final.jar:4.3.11.Final] at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:525) ~[hibernate-core-4.3.11.Final.jar:4.3.11.Final] at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1859) ~[hibernate-core-4.3.11.Final.jar:4.3.11.Final] at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:857) ~[hibernate-entitymanager-4.3.11.Final.jar:4.3.11.Final] at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:850) ~[hibernate-entitymanager-4.3.11.Final.jar:4.3.11.Final] at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.withTccl(ClassLoaderServiceImpl.java:425) ~[hibernate-core-4.3.11.Final.jar:4.3.11.Final] at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:849) ~[hibernate-entitymanager-4.3.11.Final.jar:4.3.11.Final] at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:60) ~[spring-orm-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:343) ~[spring-orm-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:318) ~[spring-orm-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1637) ~[spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1574) ~[spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE] ... 41 common frames omitted

[2] yo jhipster

? (1/15) What is the base name of your application? testProj
? (2/15) What is your default Java package name? de.test
? (3/15) Which type of authentication would you like to use? HTTP Session Auth
entication (stateful, default Spring Security mechanism)
? (4/15) Which type of database would you like to use? SQL (H2, MySQL, Postgre
SQL, Oracle)
? (5/15) Which production database would you like to use? MySQL
? (6/15) Which development database would you like to use? H2 with in-memory p
ersistence
? (7/15) Do you want to use Hibernate 2nd level cache? No
? (8/15) Do you want to use a search engine in your application? No
? (9/15) Do you want to use clustered HTTP sessions? No
? (10/15) Do you want to use WebSockets? No
? (11/15) Would you like to use Maven or Gradle for building the backend? Maven
? (12/15) Would you like to use Grunt or Gulp.js for building the frontend? Grun
t (recommended)
? (13/15) Would you like to use the LibSass stylesheet preprocessor for your CSS
? No
? (14/15) Would you like to enable translation support with Angular Translate? N
o
? (15/15) Which testing frameworks would you like to use? Gatling

[3] yo jhipster:entity Foo

The entity Foo is being created.
Generating field #1
? Do you want to add a field to your entity? Yes
? What is the name of your field? bar
? What is the type of your field? String
? Do you want to add validation rules to your field? Yes
? Which validation rules do you want to add? Required

[4]yo jhipster-entity-audit

(!) require('yeoman-generator').generators.Base is deprecated. Use require('yeoman-generator').Base directly
Composing JHipster configuration with module entity-audit
Welcome to the JHipster Entity Audit Generator! v1.0.7

Reading the JHipster project configuration for your module
? Do you want to enable audit for all existing entities? Yes, update all
? Do you want to add an audit log page for entities? Yes

[5] liquibase changelog

<!-- Added the entity EntityAuditEvent. --> <changeSet id="20160222094031" author="jhipster"> <createTable tableName="jhi_entity_audit_event"> <column name="id" type="bigint" autoIncrement="${autoIncrement}"> <constraints primaryKey="true" nullable="false"/> </column> <column name="entity_id" type="bigint"> <constraints nullable="false" /> </column> <column name="entity_type" type="varchar(255)"> <constraints nullable="false" /> </column> <column name="action" type="varchar(20)"> <constraints nullable="false" /> </column> <column name="entity_value" type="clob"/> <column name="commit_version" type="integer"/> <column name="modified_by" type="varchar(100)"/> <column name="modified_date" type="timestamp"> <constraints nullable="false" /> </column> </createTable> <dropDefaultValue tableName="jhi_entity_audit_event" columnName="modified_date" columnDataType="datetime"/> <!-- TODO add an archival job for the table --> </changeSet> </databaseChangeLog>

Install and test generator-jhipster-entity-audit

I open an issue here, it will be easier than by mail because we got markdown!
I hope it's ok for you, @deepu105

So I made some tests with our devbox. Here all my commands. Hope it will help you...

Step1 : clone your fork deepu105/generator-jhipster, branch module-hook

mkdir -p ~/workspace/deepu
cd ~/workspace/deepu
git clone -b module-hook https://github.com/deepu105/generator-jhipster
cd generator-jhipster
npm install
npm link
ls -l /usr/lib/node_modules

Step2 : clone your module deepu105/generator-jhipster-entity-audit

cd ~/workspace/deepu
git clone https://github.com/deepu105/generator-jhipster-entity-audit
cd generator-jhipster-entity-audit
npm install
npm link
npm link generator-jhipster
ls -l node_modules
ls -l /usr/lib/node_modules

Step3 : create a sample project

cd ~/workspace/deepu
mkdir 01-mysql
cd 01-mysql
npm link generator-jhipster
yo jhipster

I answered to all questions, all by default

Step4 : launch your sub module

$ yo jhipster-entity-audit
Composing JHipster configuration with module entity-audit
Welcome to the JHipster Entity Audit Generator! v0.1.4

events.js:141
      throw er; // Unhandled 'error' event
      ^

Error: ENOENT: no such file or directory, scandir '.jhipster'
    at Error (native)
    at Object.fs.readdirSync (fs.js:808:18)
    at module.exports.yeoman.generators.Base.extend.initializing.getEntitityNames (/home/vagrant/workspace/deepu/generator-jhipster-entity-audit/generators/app/index.js:51:32)
    at /home/vagrant/workspace/deepu/generator-jhipster-entity-audit/node_modules/yeoman-generator/lib/base.js:430:16
    at processImmediate [as _immediateCallback] (timers.js:383:17)

⚠️ Error, because there is no .jhipster directory --> maybe it's intentional

Step5 : create simple entity

$ yo jhipster:entity hello1
(...)
Everything is configured, generating the entity...

Running post run module hooks
   create .jhipster/Hello1.json
   create src/main/java/com/mycompany/myapp/domain/Hello1.java
   create src/main/java/com/mycompany/myapp/repository/Hello1Repository.java
   create src/main/java/com/mycompany/myapp/web/rest/Hello1Resource.java
   create src/main/resources/config/liquibase/changelog/20160103171718_added_entity_Hello1.xml
   create src/main/webapp/scripts/app/entities/hello1/hello1s.html
   create src/main/webapp/scripts/app/entities/hello1/hello1-detail.html
   create src/main/webapp/scripts/app/entities/hello1/hello1-dialog.html
   create src/main/webapp/scripts/app/entities/hello1/hello1-delete-dialog.html
   create src/main/webapp/scripts/app/entities/hello1/hello1.js
   create src/main/webapp/scripts/app/entities/hello1/hello1.controller.js
   create src/main/webapp/scripts/app/entities/hello1/hello1-dialog.controller.js
   create src/main/webapp/scripts/app/entities/hello1/hello1-delete-dialog.controller.js
   create src/main/webapp/scripts/app/entities/hello1/hello1-detail.controller.js
   create src/test/javascript/spec/app/entities/hello1/hello1-detail.controller.spec.js
   create src/main/webapp/scripts/components/entities/hello1/hello1.service.js
   create src/test/java/com/mycompany/myapp/web/rest/Hello1ResourceIntTest.java
   create src/main/webapp/i18n/en/hello1.json
   create src/main/webapp/i18n/fr/hello1.json

Step6 : launch sub module

$ yo jhipster-entity-audit
Composing JHipster configuration with module entity-audit
Welcome to the JHipster Entity Audit Generator! v0.1.4

? Do you want to enable audit for all existing entities? Yes, update all
? Do you want to add an audit log page for entities? Yes

Could not register as a post entity creation hook
Reading the JHipster project configuration for your module

Updating selected entities Hello1

Make sure these classes does not extend any other class to avoid any errors during compilation.
errorError: ENOENT: no such file or directory, open '/home/vagrant/workspace/deepu/generator-jhipster-entity-audit/generators/app/templates/src/main/webapp/i18n/en/_Audits.json'
   create src/main/java/com/mycompany/myapp/config/audit/AsyncEntityAuditEventWriter.java
   create src/main/java/com/mycompany/myapp/config/audit/EntityAuditEventListener.java
   create src/main/java/com/mycompany/myapp/config/audit/EntityAuditAction.java
   (...)

⚠️ There is one error here. See logs.
And the .jhipster-modules.json file is empty too.

Step 7 : I modify manually the .jhipster-modules.json

[
  {
    "name": "Entity Audit",
    "npmPackageName": "generator-jhipster-entity-audit",
    "description": "Add support for entity audit and audit log page",
    "hookFor" : "entity",
    "hookType" : "post",
    "generatorCallback" : "jhipster-entity-audit:entity"
  }
]

Step 8 : I create a new entity, it should be hook by your sub module

$ yo jhipster:entity world1
The entity world1 is being created.
Generating field #1
? Do you want to add a field to your entity? Yes
? What is the name of your field? name
? What is the type of your field? String
? Do you want to add validation rules to your field? No
=================World1=================
name (String)
Generating field #2
? Do you want to add a field to your entity? No
=================World1=================
name (String)
Generating relationships with other entities
? Do you want to add a relationship to another entity? No
===========World1==============
name (String)
-------------------
? Do you want to use a Data Transfer Object (DTO)? No, use the entity directly
? Do you want to use separate service class for your business logic? No, the REST controller should use the repository directly
? Do you want pagination on your entity? No
Everything is configured, generating the entity...

Running post run module hooks
Composing JHipster configuration with module entity-audit
Running JHipster Entity Audit Generator! v0.1.4

? Do you want to enable audit for this entity? Yes
Reading the JHipster project configuration for your module

Updating the entity for audit World1

Unable to find src/main/java/com/mycompany/myapp/domain/World1.java or missing required pattern. File rewrite failed.
Error: ENOENT: no such file or directory, open '/home/vagrant/workspace/deepu/01-mysql/src/main/java/com/mycompany/myapp/domain/World1.java'

Unable to find undefined or missing required jhipster-needle. Column not added.
TypeError: Path must be a string. Received undefined
   create .jhipster/World1.json
   create src/main/java/com/mycompany/myapp/domain/World1.java
   create src/main/java/com/mycompany/myapp/repository/World1Repository.java
   create src/main/java/com/mycompany/myapp/web/rest/World1Resource.java
   create src/main/resources/config/liquibase/changelog/20160103172323_added_entity_World1.xml
   create src/main/webapp/scripts/app/entities/world1/world1s.html
   create src/main/webapp/scripts/app/entities/world1/world1-detail.html
   create src/main/webapp/scripts/app/entities/world1/world1-dialog.html
   create src/main/webapp/scripts/app/entities/world1/world1-delete-dialog.html
   create src/main/webapp/scripts/app/entities/world1/world1.js
   create src/main/webapp/scripts/app/entities/world1/world1.controller.js
   create src/main/webapp/scripts/app/entities/world1/world1-dialog.controller.js
   create src/main/webapp/scripts/app/entities/world1/world1-delete-dialog.controller.js
   create src/main/webapp/scripts/app/entities/world1/world1-detail.controller.js
   create src/test/javascript/spec/app/entities/world1/world1-detail.controller.spec.js
   create src/main/webapp/scripts/components/entities/world1/world1.service.js
   create src/test/java/com/mycompany/myapp/web/rest/World1ResourceIntTest.java
   create src/main/webapp/i18n/en/world1.json
   create src/main/webapp/i18n/fr/world1.json

End of entity-audit

⚠️ again, I got error.

Exception after deletion of unmodified entity

If an entity will be deleted before making any modifications, the lastModificationData is missing. Because modifiedDate of EntityAuditEvent is mandatory, the createdBy/createdAt-values could be used instead.

2016-03-23 14:16:45.967 DEBUG 5457 --- [Executor-2] d.i.r.w.c.a.AsyncEntityAuditEventWriter  : -------------- Post DELETE audit  --------------
Hibernate: select max(entityaudi0_.commit_version) as col_0_0_ from jhi_entity_audit_event entityaudi0_ where entityaudi0_.entity_type=? and entityaudi0_.entity_id=?
2016-03-23 14:16:45.971 ERROR 5457 --- [Executor-2] d.i.r.w.c.a.AsyncEntityAuditEventWriter  : Exception while persisting audit entity for User{...} error: {}

javax.validation.ConstraintViolationException: Validation failed for classes [domain.EntityAuditEvent] during persist time for groups [javax.validation.groups.Default, ]
List of constraint violations:[
    ConstraintViolationImpl{interpolatedMessage='darf nicht null sein', propertyPath=modifiedDate, rootBeanClass=class domain.EntityAuditEvent, messageTemplate='{javax.validation.constraints.NotNull.message}'}
]
    at org.hibernate.cfg.beanvalidation.BeanValidationEventListener.validate(BeanValidationEventListener.java:160)
    at org.hibernate.cfg.beanvalidation.BeanValidationEventListener.onPreInsert(BeanValidationEventListener.java:95)
´´´

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.