Repository: jhipster/generator-jhipster
Pull request #6875 (2017-12-16 14:29:47)

use SERVER_API_URL in gateway entities using uaa
The SERVER_API_URL be used everywhere.  Related to https://github.com/jhipster/generator-jhipster/pull/6833, I forgot to change the entity services.

- Please make sure the below checklist is followed for Pull Requests.

- [ ] [Travis tests](https://travis-ci.org/jhipster/generator-jhipster/pull_requests) are green
- [X] Tests are added where necessary
- [X] Documentation is added/updated where necessary
- [X] Coding Rules & Commit Guidelines as per our [CONTRIBUTING.md document](https://github.com/jhipster/generator-jhipster/blob/master/CONTRIBUTING.md) are followed



Patch:
diff --git a/.travis.yml b/.travis.yml
index 7ce17a49c1..a79d172b56 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -31,8 +31,8 @@ env:
     - SPRING_OUTPUT_ANSI_ENABLED=ALWAYS
     - SPRING_JPA_SHOW_SQL=false
   matrix:
-    - JHIPSTER=app-ng2-default-from-scratch PROFILE=prod RUN_APP=0
-    - JHIPSTER=app-ng2-cache-nol2 PROTRACTOR=1
+    - JHIPSTER=app-default-from-scratch PROFILE=prod RUN_APP=0
+    - JHIPSTER=app-ng2-default PROTRACTOR=1
     - JHIPSTER=app-ng2-psql-es-noi18n PROFILE=prod PROTRACTOR=1
     - JHIPSTER=app-ng2-gradle-jwt-psql PROTRACTOR=1
     - JHIPSTER=app-ng2-social-websocket PROTRACTOR=1
@@ -72,7 +72,7 @@ install:
   - cd "$TRAVIS_BUILD_DIR"/
   - yarn install
   - yarn global add file:"$TRAVIS_BUILD_DIR"
-  - if [ "$JHIPSTER" == "app-ng2-default-from-scratch" ]; then
+  - if [ "$JHIPSTER" == "app-default-from-scratch" ]; then
         yarn run test;
     fi
   - $JHIPSTER_SCRIPTS/01-generate-entities.sh
diff --git a/generators/cleanup.js b/generators/cleanup.js
index 5bc05d3c7b..d13835a51e 100644
--- a/generators/cleanup.js
+++ b/generators/cleanup.js
@@ -108,7 +108,4 @@ function cleanupOldServerFiles(generator, javaDir, testDir) {
     if (generator.isJhipsterVersionLessThan('4.11.1')) {
         generator.removeFile(`${CLIENT_MAIN_SRC_DIR}app/app.main-aot.ts`);
     }
-    if (generator.isJhipsterVersionLessThan('4.13.1')) {
-        generator.config.delete('hibernateCache');
-    }
 }
diff --git a/generators/client/index.js b/generators/client/index.js
index b432a9c26b..8e2ca16fba 100644
--- a/generators/client/index.js
+++ b/generators/client/index.js
@@ -85,18 +85,10 @@ module.exports = class extends BaseGenerator {
             type: String
         });
 
-        // This adds support for a `--cache-provider` flag
-        this.option('cache-provider', {
-            desc: 'Provide a cache provider option for the application',
-            type: String,
-            defaults: 'no'
-        });
-
-        // This adds support for a `--hb-cache` flag
+        // This adds support for a `--search-engine` flag
         this.option('hb-cache', {
             desc: 'Provide hibernate cache option for the application',
-            type: Boolean,
-            default: false
+            type: String
         });
 
         // This adds support for a `--jhi-prefix` flag
@@ -260,8 +252,7 @@ module.exports = class extends BaseGenerator {
                 if (this.skipServer) {
                     this.authenticationType && this.config.set('authenticationType', this.authenticationType);
                     this.uaaBaseName && this.config.set('uaaBaseName', this.uaaBaseName);
-                    this.cacheProvider && this.config.set('cacheProvider', this.cacheProvider);
-                    this.enableHibernateCache && this.config.set('enableHibernateCache', this.enableHibernateCache);
+                    this.hibernateCache && this.config.set('hibernateCache', this.hibernateCache);
                     this.websocket && this.config.set('websocket', this.websocket);
                     this.databaseType && this.config.set('databaseType', this.databaseType);
                     this.devDatabaseType && this.config.set('devDatabaseType', this.devDatabaseType);
@@ -277,11 +268,8 @@ module.exports = class extends BaseGenerator {
         if (useBlueprint) return;
         return {
             getSharedConfigOptions() {
-                if (this.configOptions.cacheProvider) {
-                    this.cacheProvider = this.configOptions.cacheProvider;
-                }
-                if (this.configOptions.enableHibernateCache) {
-                    this.enableHibernateCache = this.configOptions.enableHibernateCache;
+                if (this.configOptions.hibernateCache) {
+                    this.hibernateCache = this.configOptions.hibernateCache;
                 }
                 if (this.configOptions.websocket !== undefined) {
                     this.websocket = this.configOptions.websocket;
diff --git a/generators/client/templates/angular/src/main/webapp/app/admin/metrics/_metrics.component.html b/generators/client/templates/angular/src/main/webapp/app/admin/metrics/_metrics.component.html
index de9d0d60e7..f3d6c56c7b 100644
--- a/generators/client/templates/angular/src/main/webapp/app/admin/metrics/_metrics.component.html
+++ b/generators/client/templates/angular/src/main/webapp/app/admin/metrics/_metrics.component.html
@@ -194,7 +194,7 @@
             </tbody>
         </table>
     </div>
-<% if (['ehcache', 'infinispan'].includes(cacheProvider)) { %>
+<%_ if (hibernateCache === 'ehcache' || hibernateCache === 'infinispan') { _%>
     <h3 jhiTranslate="metrics.cache.title">Cache statistics</h3>
     <div class="table-responsive" *ngIf="!updatingMetrics">
         <table class="table table-striped">
diff --git a/generators/client/templates/angularjs/src/main/webapp/app/admin/metrics/_metrics.controller.js b/generators/client/templates/angularjs/src/main/webapp/app/admin/metrics/_metrics.controller.js
index 00972b7b8e..1418b512b0 100644
--- a/generators/client/templates/angularjs/src/main/webapp/app/admin/metrics/_metrics.controller.js
+++ b/generators/client/templates/angularjs/src/main/webapp/app/admin/metrics/_metrics.controller.js
@@ -28,7 +28,7 @@
     function <%=jhiPrefixCapitalized%>MetricsMonitoringController ($scope, <%=jhiPrefixCapitalized%>MetricsService, $uibModal) {
         var vm = this;
 
-        <%_ if (['ehcache', 'infinispan'].includes(cacheProvider)) { _%>
+        <%_ if (hibernateCache === 'ehcache' || hibernateCache === 'infinispan') { _%>
         vm.cachesStats = {};
         <%_ } _%>
         vm.metrics = {};
@@ -47,7 +47,7 @@
                 }
             });
 
-            <%_ if (['ehcache', 'infinispan'].includes(cacheProvider)) { _%>
+            <%_ if (hibernateCache === 'ehcache' || hibernateCache === 'infinispan') { _%>
             vm.cachesStats = {};
             angular.forEach(newValue.gauges, function (value, key) {
                 if (key.includes('jcache.statistics')) {
diff --git a/generators/client/templates/angularjs/src/main/webapp/app/admin/metrics/_metrics.html b/generators/client/templates/angularjs/src/main/webapp/app/admin/metrics/_metrics.html
index da6a0eda50..27ea5baf35 100644
--- a/generators/client/templates/angularjs/src/main/webapp/app/admin/metrics/_metrics.html
+++ b/generators/client/templates/angularjs/src/main/webapp/app/admin/metrics/_metrics.html
@@ -188,7 +188,7 @@
             </tbody>
         </table>
     </div>
-<%_ if (['ehcache', 'infinispan'].includes(cacheProvider)) { _%>
+<%_ if (hibernateCache === 'ehcache' || hibernateCache === 'infinispan') { _%>
     <h3 data-translate="metrics.cache.title">Cache statistics</h3>
     <div class="table-responsive">
         <table class="table table-striped">
diff --git a/generators/cloudfoundry/index.js b/generators/cloudfoundry/index.js
index 2bf35db265..c19bdad153 100644
--- a/generators/cloudfoundry/index.js
+++ b/generators/cloudfoundry/index.js
@@ -35,8 +35,7 @@ module.exports = class extends BaseGenerator {
         this.buildTool = this.config.get('buildTool');
         this.packageName = this.config.get('packageName');
         this.packageFolder = this.config.get('packageFolder');
-        this.cacheProvider = this.config.get('cacheProvider') || this.config.get('hibernateCache') || 'no';
-        this.enableHibernateCache = this.config.get('enableHibernateCache') || (this.config.get('hibernateCache') !== undefined && this.config.get('hibernateCache') !== 'no');
+        this.hibernateCache = this.config.get('hibernateCache');
         this.databaseType = this.config.get('databaseType');
         this.devDatabaseType = this.config.get('devDatabaseType');
         this.prodDatabaseType = this.config.get('prodDatabaseType');
diff --git a/generators/entity-client/templates/angular/src/main/webapp/app/entities/_entity.service.ts b/generators/entity-client/templates/angular/src/main/webapp/app/entities/_entity.service.ts
index b8fb940d5a..b58a84dfc6 100644
--- a/generators/entity-client/templates/angular/src/main/webapp/app/entities/_entity.service.ts
+++ b/generators/entity-client/templates/angular/src/main/webapp/app/entities/_entity.service.ts
@@ -25,9 +25,7 @@ _%>
 import { Injectable } from '@angular/core';
 import { Http, Response } from '@angular/http';
 import { Observable } from 'rxjs/Rx';
-<%_ if (!(applicationType === 'gateway' && locals.microserviceName) && authenticationType !== 'uaa') { _%>
 import { SERVER_API_URL } from '../../app.constants';
-<%_ } _%>
 <%_ if (hasDate) { _%>
 
 import { JhiDateUtils } from 'ng-jhipster';
@@ -39,9 +37,9 @@ import { ResponseWrapper, createRequestOption } from '../../shared';
 @Injectable()
 export class <%= entityAngularName %>Service {
 
-    private resourceUrl = <% if (applicationType === 'gateway' && locals.microserviceName) { %>'/<%= microserviceName.toLowerCase() %>/<% } else if (authenticationType === 'uaa') { %>'<% } else { %>SERVER_API_URL + '<% } %>api/<%= entityApiUrl %>';
+    private resourceUrl =  SERVER_API_URL + '<% if (applicationType === 'gateway' && locals.microserviceName) { %>/<%= microserviceName.toLowerCase() %>/<% } %>api/<%= entityApiUrl %>';
     <%_ if(searchEngine === 'elasticsearch') { _%>
-    private resourceSearchUrl = <% if (applicationType === 'gateway' && locals.microserviceName) { %>'/<%= microserviceName.toLowerCase() %>/<% } else if (authenticationType === 'uaa') { %>'<% } else { %>SERVER_API_URL + '<% } %>api/_search/<%= entityApiUrl %>';
+    private resourceSearchUrl = SERVER_API_URL + '<% if (applicationType === 'gateway' && locals.microserviceName) { %>/<%= microserviceName.toLowerCase() %>/<% } %>api/_search/<%= entityApiUrl %>';
     <%_ } _%>
 
     constructor(private http: Http<% if (hasDate) { %>, private dateUtils: JhiDateUtils<% } %>) { }
diff --git a/generators/entity-server/files.js b/generators/entity-server/files.js
index 16eb5478fb..f5c0a36e7f 100644
--- a/generators/entity-server/files.js
+++ b/generators/entity-server/files.js
@@ -198,8 +198,8 @@ function writeFiles() {
                 }
                 this.addChangelogToLiquibase(`${this.changelogDate}_added_entity_${this.entityClass}`);
 
-                if (['ehcache', 'infinispan'].includes(this.cacheProvider) && this.enableHibernateCache) {
-                    this.addEntityToCache(this.entityClass, this.relationships, this.packageName, this.packageFolder, this.cacheProvider);
+                if (this.hibernateCache === 'ehcache' || this.hibernateCache === 'infinispan') {
+                    this.addEntityToCache(this.entityClass, this.relationships, this.packageName, this.packageFolder, this.hibernateCache);
                 }
             }
         },
diff --git a/generators/entity-server/templates/src/main/java/package/domain/_Entity.java b/generators/entity-server/templates/src/main/java/package/domain/_Entity.java
index 1e938ad92e..1c318573c5 100644
--- a/generators/entity-server/templates/src/main/java/package/domain/_Entity.java
+++ b/generators/entity-server/templates/src/main/java/package/domain/_Entity.java
@@ -30,7 +30,7 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
 import io.swagger.annotations.ApiModel;
 <%_ } if (importApiModelProperty === true) { _%>
 import io.swagger.annotations.ApiModelProperty;
-<%_ } if (enableHibernateCache) { _%>
+<%_ } if (hibernateCache !== 'no') { _%>
 import org.hibernate.annotations.Cache;
 import org.hibernate.annotations.CacheConcurrencyStrategy;
 <%_ } if (databaseType === 'mongodb') { _%>
@@ -93,8 +93,8 @@ import static org.springframework.data.couchbase.core.mapping.id.GenerationStrat
 <%_ if (databaseType === 'sql') { _%>
 @Entity
 @Table(name = "<%= entityTableName %>")
-<%_     if (enableHibernateCache) {
-            if (cacheProvider === 'infinispan') { _%>
+<%_     if (hibernateCache !== 'no') {
+            if (hibernateCache === 'infinispan') { _%>
 @Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
 <%_         } else { _%>
 @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
@@ -222,8 +222,8 @@ public class <%= entityClass %> implements Serializable {
     _%>
     @OneToMany(mappedBy = "<%= otherEntityRelationshipName %>")
     @JsonIgnore
-    <%_ if (enableHibernateCache) {
-            if (cacheProvider === 'infinispan') { _%>
+    <%_ if (hibernateCache !== 'no') {
+            if (hibernateCache === 'infinispan') { _%>
     @Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
         <%_ } else { _%>
     @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
@@ -241,8 +241,8 @@ public class <%= entityClass %> implements Serializable {
     <%_ } else if (relationshipType === 'many-to-many') { _%>
     @ManyToMany<% if (ownerSide === false) { %>(mappedBy = "<%= otherEntityRelationshipNamePlural %>")
     @JsonIgnore<% } %>
-        <%_ if (enableHibernateCache) {
-                if (cacheProvider === 'infinispan') { _%>
+        <%_ if (hibernateCache !== 'no') {
+                if (hibernateCache === 'infinispan') { _%>
     @Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
             <%_ } else { _%>
     @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
diff --git a/generators/entity/index.js b/generators/entity/index.js
index 7008550e2a..0913fe4f0f 100644
--- a/generators/entity/index.js
+++ b/generators/entity/index.js
@@ -113,8 +113,7 @@ module.exports = class extends BaseGenerator {
                 context.applicationType = this.config.get('applicationType');
                 context.packageFolder = this.config.get('packageFolder');
                 context.authenticationType = this.config.get('authenticationType');
-                context.cacheProvider = this.config.get('cacheProvider') || this.config.get('hibernateCache') || 'no';
-                context.enableHibernateCache = this.config.get('enableHibernateCache') || (this.config.get('hibernateCache') !== undefined && this.config.get('hibernateCache') !== 'no');
+                context.hibernateCache = this.config.get('hibernateCache');
                 context.websocket = this.config.get('websocket') === 'no' ? false : this.config.get('websocket');
                 context.databaseType = this.config.get('databaseType') || this.getDBTypeFromDBValue(this.options.db);
                 context.prodDatabaseType = this.config.get('prodDatabaseType') || this.options.db;
diff --git a/generators/entity/prompts.js b/generators/entity/prompts.js
index 43c019a9c8..dc8b5dee37 100644
--- a/generators/entity/prompts.js
+++ b/generators/entity/prompts.js
@@ -711,63 +711,119 @@ function askForField(done) {
             default: false
         },
         {
-            when: response => response.fieldAdd === true && response.fieldValidate === true,
+            when: response => response.fieldAdd === true &&
+                    response.fieldValidate === true &&
+                    (response.fieldType === 'String' ||
+                    response.fieldTypeBlobContent === 'text'),
             type: 'checkbox',
             name: 'fieldValidateRules',
             message: 'Which validation rules do you want to add?',
-            choices: (response) => {
-                // Default rules applicable for fieldType 'LocalDate', 'Instant',
-                // 'ZonedDateTime', 'UUID', 'Boolean', 'ByteBuffer' and 'Enum'
-                const opts = [
-                    {
-                        name: 'Required',
-                        value: 'required'
-                    }/* ,
-                    {
-                        name: 'Unique',
-                        value: 'unique'
-                    } */
-                ];
-                if (response.fieldType === 'String' || response.fieldTypeBlobContent === 'text') {
-                    opts.push(
-                        {
-                            name: 'Minimum length',
-                            value: 'minlength'
-                        },
-                        {
-                            name: 'Maximum length',
-                            value: 'maxlength'
-                        },
-                        {
-                            name: 'Regular expression pattern',
-                            value: 'pattern'
-                        }
-                    );
-                } else if (['Integer', 'Long', 'Float', 'Double', 'BigDecimal'].includes(response.fieldType)) {
-                    opts.push(
-                        {
-                            name: 'Minimum',
-                            value: 'min'
-                        },
-                        {
-                            name: 'Maximum',
-                            value: 'max'
-                        }
-                    );
-                } else if (response.fieldType === 'byte[]' && response.fieldTypeBlobContent !== 'text') {
-                    opts.push(
-                        {
-                            name: 'Minimum byte size',
-                            value: 'minbytes'
-                        },
-                        {
-                            name: 'Maximum byte size',
-                            value: 'maxbytes'
-                        }
-                    );
+            choices: [
+                {
+                    name: 'Required',
+                    value: 'required'
+                }, /**
+                {
+                    name: 'Unique',
+                    value: 'unique'
+                }, */
+                {
+                    name: 'Minimum length',
+                    value: 'minlength'
+                },
+                {
+                    name: 'Maximum length',
+                    value: 'maxlength'
+                },
+                {
+                    name: 'Regular expression pattern',
+                    value: 'pattern'
                 }
-                return opts;
-            },
+            ],
+            default: 0
+        },
+        {
+            when: response => response.fieldAdd === true &&
+                    response.fieldValidate === true &&
+                    (response.fieldType === 'Integer' ||
+                    response.fieldType === 'Long' ||
+                    response.fieldType === 'Float' ||
+                    response.fieldType === 'Double' ||
+                    response.fieldType === 'BigDecimal'),
+            type: 'checkbox',
+            name: 'fieldValidateRules',
+            message: 'Which validation rules do you want to add?',
+            choices: [
+                {
+                    name: 'Required',
+                    value: 'required'
+                }, /**
+                {
+                    name: 'Unique',
+                    value: 'unique'
+                }, */
+                {
+                    name: 'Minimum',
+                    value: 'min'
+                },
+                {
+                    name: 'Maximum',
+                    value: 'max'
+                }
+            ],
+            default: 0
+        },
+        {
+            when: response => response.fieldAdd === true &&
+                    response.fieldValidate === true &&
+                    response.fieldType === 'byte[]' &&
+                    response.fieldTypeBlobContent !== 'text',
+            type: 'checkbox',
+            name: 'fieldValidateRules',
+            message: 'Which validation rules do you want to add?',
+            choices: [
+                {
+                    name: 'Required',
+                    value: 'required'
+                }, /**
+                {
+                    name: 'Unique',
+                    value: 'unique'
+                }, */
+                {
+                    name: 'Minimum byte size',
+                    value: 'minbytes'
+                },
+                {
+                    name: 'Maximum byte size',
+                    value: 'maxbytes'
+                }
+            ],
+            default: 0
+        },
+        {
+            when: response => response.fieldAdd === true &&
+                    response.fieldValidate === true &&
+                    (response.fieldType === 'LocalDate' ||
+                    response.fieldType === 'Instant' ||
+                    response.fieldType === 'ZonedDateTime' ||
+                    response.fieldType === 'UUID' ||
+                    response.fieldType === 'Boolean' ||
+                    response.fieldType === 'ByteBuffer' ||
+                    response.fieldIsEnum === true),
+            type: 'checkbox',
+            name: 'fieldValidateRules',
+            message: 'Which validation rules do you want to add?',
+            choices: [
+                {
+                    name: 'Required',
+                    value: 'required'
+                } /** ,
+                {
+                    name: 'Unique',
+                    value: 'unique'
+                } */
+            ],
             default: 0
         },
         {
@@ -793,31 +849,51 @@ function askForField(done) {
         {
             when: response => response.fieldAdd === true &&
                     response.fieldValidate === true &&
-                    response.fieldValidateRules.includes('min'),
+                    response.fieldValidateRules.includes('min') &&
+                    (response.fieldType === 'Integer' ||
+                    response.fieldType === 'Long'),
             type: 'input',
             name: 'fieldValidateRulesMin',
             message: 'What is the minimum of your field?',
-            validate: (input, response) => {
-                if (['Float', 'Double', 'BigDecimal'].includes(response.fieldType)) {
-                    return this.isSignedDecimalNumber(input) ? true : 'Minimum must be a decimal number';
-                }
-                return this.isSignedNumber(input) ? true : 'Minimum must be a number';
-            },
+            validate: input => (this.isSignedNumber(input) ? true : 'Minimum must be a number'),
             default: 0
         },
         {
             when: response => response.fieldAdd === true &&
                     response.fieldValidate === true &&
-                    response.fieldValidateRules.includes('max'),
+                    response.fieldValidateRules.includes('max') &&
+                    (response.fieldType === 'Integer' ||
+                    response.fieldType === 'Long'),
             type: 'input',
             name: 'fieldValidateRulesMax',
             message: 'What is the maximum of your field?',
-            validate: (input, response) => {
-                if (['Float', 'Double', 'BigDecimal'].includes(response.fieldType)) {
-                    return this.isSignedDecimalNumber(input) ? true : 'Maximum must be a decimal number';
-                }
-                return this.isSignedNumber(input) ? true : 'Maximum must be a number';
-            },
+            validate: input => (this.isSignedNumber(input) ? true : 'Maximum must be a number'),
+            default: 100
+        },
+        {
+            when: response => response.fieldAdd === true &&
+                    response.fieldValidate === true &&
+                    response.fieldValidateRules.includes('min') &&
+                    (response.fieldType === 'Float' ||
+                    response.fieldType === 'Double' ||
+                    response.fieldType === 'BigDecimal'),
+            type: 'input',
+            name: 'fieldValidateRulesMin',
+            message: 'What is the minimum of your field?',
+            validate: input => (this.isSignedDecimalNumber(input, true) ? true : 'Minimum must be a decimal number'),
+            default: 0
+        },
+        {
+            when: response => response.fieldAdd === true &&
+                    response.fieldValidate === true &&
+                    response.fieldValidateRules.includes('max') &&
+                    (response.fieldType === 'Float' ||
+                    response.fieldType === 'Double' ||
+                    response.fieldType === 'BigDecimal'),
+            type: 'input',
+            name: 'fieldValidateRulesMax',
+            message: 'What is the maximum of your field?',
+            validate: input => (this.isSignedDecimalNumber(input, true) ? true : 'Maximum must be a decimal number'),
             default: 100
         },
         {
@@ -942,33 +1018,49 @@ function askForRelationship(done) {
             default: response => _.lowerFirst(response.otherEntityName)
         },
         {
-            when: response => response.relationshipAdd === true,
+            when: response => response.relationshipAdd === true && response.otherEntityName.toLowerCase() !== 'user',
             type: 'list',
             name: 'relationshipType',
             message: 'What is the type of the relationship?',
-            choices: (response) => {
-                const opts = [
-                    {
-                        value: 'many-to-one',
-                        name: 'many-to-one'
-                    },
-                    {
-                        value: 'many-to-many',
-                        name: 'many-to-many'
-                    },
-                    {
-                        value: 'one-to-one',
-                        name: 'one-to-one'
-                    }
-                ];
-                if (response.otherEntityName.toLowerCase() !== 'user') {
-                    opts.unshift({
-                        value: 'one-to-many',
-                        name: 'one-to-many'
-                    });
+            choices: [
+                {
+                    value: 'one-to-many',
+                    name: 'one-to-many'
+                },
+                {
+                    value: 'many-to-one',
+                    name: 'many-to-one'
+                },
+                {
+                    value: 'many-to-many',
+                    name: 'many-to-many'
+                },
+                {
+                    value: 'one-to-one',
+                    name: 'one-to-one'
                 }
-                return opts;
-            },
+            ],
+            default: 0
+        },
+        {
+            when: response => response.relationshipAdd === true && response.otherEntityName.toLowerCase() === 'user',
+            type: 'list',
+            name: 'relationshipType',
+            message: 'What is the type of the relationship?',
+            choices: [
+                {
+                    value: 'many-to-one',
+                    name: 'many-to-one'
+                },
+                {
+                    value: 'many-to-many',
+                    name: 'many-to-many'
+                },
+                {
+                    value: 'one-to-one',
+                    name: 'one-to-one'
+                }
+            ],
             default: 0
         },
         {
diff --git a/generators/generator-base.js b/generators/generator-base.js
index 75d29b3299..b015c38d19 100644
--- a/generators/generator-base.js
+++ b/generators/generator-base.js
@@ -2324,8 +2324,7 @@ module.exports = class extends PrivateBase {
         generator.databaseType = generator.getDBTypeFromDBValue(context.options.db) || context.configOptions.databaseType || context.config.get('databaseType');
         generator.enableSocialSignIn = context.options.social || context.config.get('enableSocialSignIn');
         generator.searchEngine = context.options['search-engine'] || context.config.get('searchEngine');
-        generator.cacheProvider = context.options['cache-provider'] || context.config.get('cacheProvider') || context.config.get('hibernateCache') || 'no';
-        generator.enableHibernateCache = context.options['hb-cache'] || context.config.get('enableHibernateCache') || (context.config.get('hibernateCache') !== undefined && context.config.get('hibernateCache') !== 'no');
+        generator.hibernateCache = context.options['hb-cache'] || context.config.get('hibernateCache');
         generator.otherModules = context.configOptions.otherModules || [];
         generator.jhiPrefix = context.configOptions.jhiPrefix || context.config.get('jhiPrefix') || context.options['jhi-prefix'];
         generator.jhiPrefixCapitalized = _.upperFirst(generator.jhiPrefix);
diff --git a/generators/heroku/index.js b/generators/heroku/index.js
index d1a36f3d09..8bd1a986cf 100644
--- a/generators/heroku/index.js
+++ b/generators/heroku/index.js
@@ -32,8 +32,7 @@ module.exports = class extends BaseGenerator {
         this.baseName = this.config.get('baseName');
         this.packageName = this.config.get('packageName');
         this.packageFolder = this.config.get('packageFolder');
-        this.cacheProvider = this.config.get('cacheProvider') || this.config.get('hibernateCache') || 'no';
-        this.enableHibernateCache = this.config.get('enableHibernateCache') || (this.config.get('hibernateCache') !== undefined && this.config.get('hibernateCache') !== 'no');
+        this.hibernateCache = this.config.get('hibernateCache');
         this.databaseType = this.config.get('databaseType');
         this.prodDatabaseType = this.config.get('prodDatabaseType');
         this.angularAppName = this.getAngularAppName();
diff --git a/generators/modules/index.js b/generators/modules/index.js
index 9b94da1c84..b0a6ca4bf9 100644
--- a/generators/modules/index.js
+++ b/generators/modules/index.js
@@ -54,8 +54,7 @@ module.exports = class extends BaseGenerator {
         jhipsterVar.jhipsterConfig = this.config.getAll();
         jhipsterVar.applicationType = this.config.get('applicationType');
         jhipsterVar.authenticationType = this.config.get('authenticationType');
-        jhipsterVar.cacheProvider = this.config.get('cacheProvider') || this.config.get('hibernateCache') || 'no';
-        jhipsterVar.enableHibernateCache = this.config.get('enableHibernateCache') || (this.config.get('hibernateCache') !== undefined && this.config.get('hibernateCache') !== 'no');
+        jhipsterVar.hibernateCache = this.config.get('hibernateCache');
         jhipsterVar.clusteredHttpSession = this.config.get('clusteredHttpSession');
         jhipsterVar.websocket = this.config.get('websocket');
         jhipsterVar.databaseType = this.config.get('databaseType');
diff --git a/generators/server/files.js b/generators/server/files.js
index d751302ae3..e53a7f5193 100644
--- a/generators/server/files.js
+++ b/generators/server/files.js
@@ -96,7 +96,7 @@ function writeFiles() {
                 this.template(`${DOCKER_DIR}cassandra/scripts/_autoMigrate.sh`, `${DOCKER_DIR}cassandra/scripts/autoMigrate.sh`);
                 this.template(`${DOCKER_DIR}cassandra/scripts/_execute-cql.sh`, `${DOCKER_DIR}cassandra/scripts/execute-cql.sh`);
             }
-            if (this.cacheProvider === 'hazelcast') {
+            if (this.hibernateCache === 'hazelcast') {
                 this.template(`${DOCKER_DIR}_hazelcast-management-center.yml`, `${DOCKER_DIR}hazelcast-management-center.yml`);
             }
             if (this.searchEngine === 'elasticsearch') {
@@ -359,7 +359,7 @@ function writeFiles() {
             }
             if (this.authenticationType === 'oauth2') {
                 this.template(`${SERVER_MAIN_SRC_DIR}package/security/oauth2/_AuthorizationHeaderUtil.java`, `${javaDir}/security/oauth2/AuthorizationHeaderUtil.java`);
-                if (this.cacheProvider !== 'no') {
+                if (this.hibernateCache !== 'no') {
                     this.template(`${SERVER_MAIN_SRC_DIR}package/security/oauth2/_CachedUserInfoTokenServices.java`, `${javaDir}/security/oauth2/CachedUserInfoTokenServices.java`);
                 }
                 this.template(`${SERVER_MAIN_SRC_DIR}package/security/oauth2/_SimplePrincipalExtractor.java`, `${javaDir}/security/oauth2/SimplePrincipalExtractor.java`);
@@ -397,10 +397,10 @@ function writeFiles() {
 
             this.template(`${SERVER_MAIN_SRC_DIR}package/config/_package-info.java`, `${javaDir}config/package-info.java`);
             this.template(`${SERVER_MAIN_SRC_DIR}package/config/_AsyncConfiguration.java`, `${javaDir}config/AsyncConfiguration.java`);
-            if (['ehcache', 'hazelcast', 'infinispan'].includes(this.cacheProvider) || this.clusteredHttpSession === 'hazelcast' || this.applicationType === 'gateway') {
+            if (this.hibernateCache === 'ehcache' || this.hibernateCache === 'hazelcast' || this.hibernateCache === 'infinispan' || this.clusteredHttpSession === 'hazelcast' || this.applicationType === 'gateway') {
                 this.template(`${SERVER_MAIN_SRC_DIR}package/config/_CacheConfiguration.java`, `${javaDir}config/CacheConfiguration.java`);
             }
-            if (this.cacheProvider === 'infinispan') {
+            if (this.hibernateCache === 'infinispan') {
                 this.template(`${SERVER_MAIN_SRC_DIR}package/config/_CacheFactoryConfiguration.java`, `${javaDir}config/CacheFactoryConfiguration.java`);
             }
             this.template(`${SERVER_MAIN_SRC_DIR}package/config/_Constants.java`, `${javaDir}config/Constants.java`);
diff --git a/generators/server/index.js b/generators/server/index.js
index d4555c56c7..68654a5ebf 100644
--- a/generators/server/index.js
+++ b/generators/server/index.js
@@ -163,39 +163,39 @@ module.exports = class extends BaseGenerator {
                     this.serviceDiscoveryType = false;
                 }
 
-                this.cacheProvider = this.config.get('cacheProvider') || this.config.get('hibernateCache') || 'no';
-                this.enableHibernateCache = this.config.get('enableHibernateCache') || (this.config.get('hibernateCache') !== undefined && this.config.get('hibernateCache') !== 'no');
-
                 this.databaseType = this.config.get('databaseType');
                 if (this.databaseType === 'mongodb') {
                     this.devDatabaseType = 'mongodb';
                     this.prodDatabaseType = 'mongodb';
-                    this.enableHibernateCache = false;
+                    this.hibernateCache = 'no';
                 } else if (this.databaseType === 'couchbase') {
                     this.devDatabaseType = 'couchbase';
                     this.prodDatabaseType = 'couchbase';
-                    this.enableHibernateCache = false;
+                    this.hibernateCache = 'no';
                 } else if (this.databaseType === 'cassandra') {
                     this.devDatabaseType = 'cassandra';
                     this.prodDatabaseType = 'cassandra';
-                    this.enableHibernateCache = false;
+                    this.hibernateCache = 'no';
                 } else if (this.databaseType === 'no') {
                     // no database, only available for microservice applications
                     this.devDatabaseType = 'no';
                     this.prodDatabaseType = 'no';
-                    this.enableHibernateCache = false;
+                    this.hibernateCache = 'no';
                 } else {
                     // sql
                     this.devDatabaseType = this.config.get('devDatabaseType');
                     this.prodDatabaseType = this.config.get('prodDatabaseType');
+                    this.hibernateCache = this.config.get('hibernateCache');
+                }
+                if (this.hibernateCache === undefined) {
+                    this.hibernateCache = 'no';
                 }
-
                 // Hazelcast is mandatory for Gateways, as it is used for rate limiting
                 if (this.applicationType === 'gateway') {
-                    this.cacheProvider = 'hazelcast';
+                    this.hibernateCache = 'hazelcast';
                 }
                 this.clusteredHttpSession = this.config.get('clusteredHttpSession') === 'no' ? false : this.config.get('clusteredHttpSession');
-                if (this.cacheProvider === 'ehcache') {
+                if (this.hibernateCache === 'ehcache') {
                     this.clusteredHttpSession = false; // cannot use HazelCast clusering AND ehcache
                 }
                 this.buildTool = this.config.get('buildTool');
@@ -232,8 +232,7 @@ module.exports = class extends BaseGenerator {
 
                 const serverConfigFound = this.packageName !== undefined &&
                     this.authenticationType !== undefined &&
-                    this.cacheProvider !== undefined &&
-                    this.enableHibernateCache !== undefined &&
+                    this.hibernateCache !== undefined &&
                     this.clusteredHttpSession !== undefined &&
                     this.websocket !== undefined &&
                     this.databaseType !== undefined &&
@@ -292,8 +291,7 @@ module.exports = class extends BaseGenerator {
 
             setSharedConfigOptions() {
                 this.configOptions.packageName = this.packageName;
-                this.configOptions.cacheProvider = this.cacheProvider;
-                this.configOptions.enableHibernateCache = this.enableHibernateCache;
+                this.configOptions.hibernateCache = this.hibernateCache;
                 this.configOptions.clusteredHttpSession = this.clusteredHttpSession;
                 this.configOptions.websocket = this.websocket;
                 this.configOptions.databaseType = this.databaseType;
@@ -330,8 +328,7 @@ module.exports = class extends BaseGenerator {
                 const insight = this.insight();
                 insight.trackWithEvent('generator', 'server');
                 insight.track('app/authenticationType', this.authenticationType);
-                insight.track('app/cacheProvider', this.cacheProvider);
-                insight.track('app/enableHibernateCache', this.enableHibernateCache);
+                insight.track('app/hibernateCache', this.hibernateCache);
                 insight.track('app/clusteredHttpSession', this.clusteredHttpSession);
                 insight.track('app/websocket', this.websocket);
                 insight.track('app/databaseType', this.databaseType);
@@ -372,8 +369,7 @@ module.exports = class extends BaseGenerator {
                 this.config.set('serverPort', this.serverPort);
                 this.config.set('authenticationType', this.authenticationType);
                 this.config.set('uaaBaseName', this.uaaBaseName);
-                this.config.set('cacheProvider', this.cacheProvider);
-                this.config.set('enableHibernateCache', this.enableHibernateCache);
+                this.config.set('hibernateCache', this.hibernateCache);
                 this.config.set('clusteredHttpSession', this.clusteredHttpSession);
                 this.config.set('websocket', this.websocket);
                 this.config.set('databaseType', this.databaseType);
diff --git a/generators/server/prompts.js b/generators/server/prompts.js
index 480f0c310f..6d78ffd2c7 100644
--- a/generators/server/prompts.js
+++ b/generators/server/prompts.js
@@ -100,37 +100,45 @@ function askForServerSideOpts(meta) {
             default: false
         },
         {
-            when: response => (
-                (applicationType === 'monolith' && response.serviceDiscoveryType !== 'eureka') ||
-                ['gateway', 'microservice'].includes(applicationType)
-            ),
+            when: response => applicationType === 'monolith' && response.serviceDiscoveryType !== 'eureka',
             type: 'list',
             name: 'authenticationType',
             message: `Which ${chalk.yellow('*type*')} of authentication would you like to use?`,
-            choices: (response) => {
-                const opts = [
-                    {
-                        value: 'jwt',
-                        name: 'JWT authentication (stateless, with a token)'
-                    },
-                    {
-                        value: 'oauth2',
-                        name: 'OAuth 2.0 / OIDC Authentication (stateful, works with Keycloak and Okta)'
-                    }
-                ];
-                if (applicationType === 'monolith' && response.serviceDiscoveryType !== 'eureka') {
-                    opts.push({
-                        value: 'session',
-                        name: 'HTTP Session Authentication (stateful, default Spring Security mechanism)'
-                    });
-                } else if (['gateway', 'microservice'].includes(applicationType)) {
-                    opts.push({
-                        value: 'uaa',
-                        name: 'Authentication with JHipster UAA server (the server must be generated separately)'
-                    });
+            choices: [
+                {
+                    value: 'jwt',
+                    name: 'JWT authentication (stateless, with a token)'
+                },
+                {
+                    value: 'session',
+                    name: 'HTTP Session Authentication (stateful, default Spring Security mechanism)'
+                },
+                {
+                    value: 'oauth2',
+                    name: 'OAuth 2.0 / OIDC Authentication (stateful, works with Keycloak and Okta)'
                 }
-                return opts;
-            },
+            ],
+            default: 0
+        },
+        {
+            when: response => applicationType === 'gateway' || applicationType === 'microservice',
+            type: 'list',
+            name: 'authenticationType',
+            message: `Which ${chalk.yellow('*type*')} of authentication would you like to use?`,
+            choices: [
+                {
+                    value: 'jwt',
+                    name: 'JWT authentication (stateless, with a token)'
+                },
+                {
+                    value: 'uaa',
+                    name: 'Authentication with JHipster UAA server (the server must be generated separately)'
+                },
+                {
+                    value: 'oauth2',
+                    name: 'OAuth 2.0 / OIDC Authentication (stateful, works with Keycloak and Okta)'
+                }
+            ],
             default: 0
         },
         {
@@ -149,39 +157,58 @@ function askForServerSideOpts(meta) {
             }
         },
         {
+            when: response => applicationType === 'microservice' || ((response.authenticationType === 'uaa' ||
+            response.authenticationType === 'oauth2') && applicationType === 'gateway'),
+            type: 'list',
+            name: 'databaseType',
+            message: `Which ${chalk.yellow('*type*')} of database would you like to use?`,
+            choices: [
+                {
+                    value: 'sql',
+                    name: 'SQL (H2, MySQL, MariaDB, PostgreSQL, Oracle)'
+                },
+                {
+                    value: 'mongodb',
+                    name: 'MongoDB'
+                },
+                {
+                    value: 'cassandra',
+                    name: 'Cassandra'
+                },
+                {
+                    value: 'couchbase',
+                    name: '[BETA] Couchbase'
+                },
+                {
+                    value: 'no',
+                    name: 'No database'
+                }
+            ],
+            default: 0
+        },
+        {
+            when: response => !response.databaseType,
             type: 'list',
             name: 'databaseType',
             message: `Which ${chalk.yellow('*type*')} of database would you like to use?`,
-            choices: (response) => {
-                const opts = [
-                    {
-                        value: 'sql',
-                        name: 'SQL (H2, MySQL, MariaDB, PostgreSQL, Oracle, MSSQL)'
-                    },
-                    {
-                        value: 'mongodb',
-                        name: 'MongoDB'
-                    },
-                    {
-                        value: 'cassandra',
-                        name: 'Cassandra'
-                    },
-                    {
-                        value: 'couchbase',
-                        name: '[BETA] Couchbase'
-                    }
-                ];
-                if (
-                    applicationType === 'microservice' || ((response.authenticationType === 'uaa' ||
-                    response.authenticationType === 'oauth2') && applicationType === 'gateway')
-                ) {
-                    opts.push({
-                        value: 'no',
-                        name: 'No database'
-                    });
+            choices: [
+                {
+                    value: 'sql',
+                    name: 'SQL (H2, MySQL, MariaDB, PostgreSQL, Oracle, MSSQL)'
+                },
+                {
+                    value: 'mongodb',
+                    name: 'MongoDB'
+                },
+                {
+                    value: 'cassandra',
+                    name: 'Cassandra'
+                },
+                {
+                    value: 'couchbase',
+                    name: '[BETA] Couchbase'
                 }
-                return opts;
-            },
+            ],
             default: 0
         },
         {
@@ -193,11 +220,11 @@ function askForServerSideOpts(meta) {
             default: 0
         },
         {
-            when: response => response.databaseType === 'sql',
+            when: response => (response.databaseType === 'sql' && response.prodDatabaseType === 'mysql'),
             type: 'list',
             name: 'devDatabaseType',
             message: `Which ${chalk.yellow('*development*')} database would you like to use?`,
-            choices: response => [
+            choices: [
                 {
                     value: 'h2Disk',
                     name: 'H2 with disk-based persistence'
@@ -205,24 +232,111 @@ function askForServerSideOpts(meta) {
                 {
                     value: 'h2Memory',
                     name: 'H2 with in-memory persistence'
+                },
+                {
+                    value: 'mysql',
+                    name: 'MySQL'
                 }
-            ].concat(constants.SQL_DB_OPTIONS.find(it => it.value === response.prodDatabaseType)),
+            ],
             default: 0
         },
         {
-            // cache is mandatory for gateway and define later to 'hazelcast' value
-            when: response => applicationType !== 'gateway',
+            when: response => (response.databaseType === 'sql' && response.prodDatabaseType === 'mariadb'),
             type: 'list',
-            name: 'cacheProvider',
-            message: 'Do you want to use spring cache?',
+            name: 'devDatabaseType',
+            message: `Which ${chalk.yellow('*development*')} database would you like to use?`,
+            choices: [
+                {
+                    value: 'h2Disk',
+                    name: 'H2 with disk-based persistence'
+                },
+                {
+                    value: 'h2Memory',
+                    name: 'H2 with in-memory persistence'
+                },
+                {
+                    value: 'mariadb',
+                    name: 'MariaDB'
+                }
+            ],
+            default: 0
+        },
+        {
+            when: response => (response.databaseType === 'sql' && response.prodDatabaseType === 'postgresql'),
+            type: 'list',
+            name: 'devDatabaseType',
+            message: `Which ${chalk.yellow('*development*')} database would you like to use?`,
+            choices: [
+                {
+                    value: 'h2Disk',
+                    name: 'H2 with disk-based persistence'
+                },
+                {
+                    value: 'h2Memory',
+                    name: 'H2 with in-memory persistence'
+                },
+                {
+                    value: 'postgresql',
+                    name: 'PostgreSQL'
+                }
+            ],
+            default: 0
+        },
+        {
+            when: response => (response.databaseType === 'sql' && response.prodDatabaseType === 'oracle'),
+            type: 'list',
+            name: 'devDatabaseType',
+            message: `Which ${chalk.yellow('*development*')} database would you like to use?`,
+            choices: [
+                {
+                    value: 'h2Disk',
+                    name: 'H2 with disk-based persistence'
+                },
+                {
+                    value: 'h2Memory',
+                    name: 'H2 with in-memory persistence'
+                },
+                {
+                    value: 'oracle',
+                    name: 'Oracle 12c'
+                }
+            ],
+            default: 0
+        },
+        {
+            when: response => (response.databaseType === 'sql' && response.prodDatabaseType === 'mssql'),
+            type: 'list',
+            name: 'devDatabaseType',
+            message: `Which ${chalk.yellow('*development*')} database would you like to use?`,
+            choices: [
+                {
+                    value: 'h2Disk',
+                    name: 'H2 with disk-based persistence'
+                },
+                {
+                    value: 'h2Memory',
+                    name: 'H2 with in-memory persistence'
+                },
+                {
+                    value: 'mssql',
+                    name: 'Microsoft SQL Server'
+                }
+            ],
+            default: 0
+        },
+        {
+            when: response => (response.databaseType === 'sql' && applicationType !== 'gateway'),
+            type: 'list',
+            name: 'hibernateCache',
+            message: 'Do you want to use Hibernate 2nd level cache?',
             choices: [
                 {
                     value: 'ehcache',
-                    name: 'Yes, with ehcache implementation (local cache, for a single node)'
+                    name: 'Yes, with ehcache (local cache, for a single node)'
                 },
                 {
                     value: 'hazelcast',
-                    name: 'Yes, with HazelCast implementation(distributed cache, for multiple nodes)'
+                    name: 'Yes, with HazelCast (distributed cache, for multiple nodes)'
                 },
                 {
                     value: 'infinispan',
@@ -230,18 +344,11 @@ function askForServerSideOpts(meta) {
                 },
                 {
                     value: 'no',
-                    name: 'No (Hibernate L2 cache won\'t be available as well)'
+                    name: 'No'
                 }
             ],
             default: (applicationType === 'microservice' || applicationType === 'uaa') ? 1 : 0
         },
-        {
-            when: response => ((response.cacheProvider !== 'no' || applicationType === 'gateway') && response.databaseType === 'sql'),
-            type: 'confirm',
-            name: 'enableHibernateCache',
-            message: 'Do you want to use Hibernate 2nd level cache?',
-            default: true
-        },
         {
             type: 'list',
             name: 'buildTool',
@@ -296,8 +403,7 @@ function askForServerSideOpts(meta) {
         if (this.serverPort === undefined) {
             this.serverPort = '8080';
         }
-        this.cacheProvider = props.cacheProvider;
-        this.enableHibernateCache = props.enableHibernateCache;
+        this.hibernateCache = props.hibernateCache;
         this.databaseType = props.databaseType;
         this.devDatabaseType = props.devDatabaseType;
         this.prodDatabaseType = props.prodDatabaseType;
@@ -308,23 +414,23 @@ function askForServerSideOpts(meta) {
         if (this.databaseType === 'no') {
             this.devDatabaseType = 'no';
             this.prodDatabaseType = 'no';
-            this.enableHibernateCache = false;
+            this.hibernateCache = 'no';
         } else if (this.databaseType === 'mongodb') {
             this.devDatabaseType = 'mongodb';
             this.prodDatabaseType = 'mongodb';
-            this.enableHibernateCache = false;
+            this.hibernateCache = 'no';
         } else if (this.databaseType === 'couchbase') {
             this.devDatabaseType = 'couchbase';
             this.prodDatabaseType = 'couchbase';
-            this.enableHibernateCache = false;
+            this.hibernateCache = 'no';
         } else if (this.databaseType === 'cassandra') {
             this.devDatabaseType = 'cassandra';
             this.prodDatabaseType = 'cassandra';
-            this.enableHibernateCache = false;
+            this.hibernateCache = 'no';
         }
         // Hazelcast is mandatory for Gateways, as it is used for rate limiting
         if (this.applicationType === 'gateway') {
-            this.cacheProvider = 'hazelcast';
+            this.hibernateCache = 'hazelcast';
         }
         done();
     });
@@ -349,7 +455,7 @@ function askForOptionalItems(meta) {
         });
     }
     if ((applicationType === 'monolith' || applicationType === 'gateway') &&
-            (this.cacheProvider === 'no' || this.cacheProvider === 'hazelcast') &&
+            (this.hibernateCache === 'no' || this.hibernateCache === 'hazelcast') &&
             this.authenticationType !== 'oauth2') {
         choices.push({
             name: 'Clustered HTTP sessions using Hazelcast',
diff --git a/generators/server/templates/_build.gradle b/generators/server/templates/_build.gradle
index d1a0ed6be4..887be93b33 100644
--- a/generators/server/templates/_build.gradle
+++ b/generators/server/templates/_build.gradle
@@ -211,12 +211,9 @@ repositories {
 }
 
 dependencies {
-    <%_ if (cacheProvider !== 'no') { _%>
-    compile "org.springframework.boot:spring-boot-starter-cache"
-    <%_ } _%>
     compile "io.github.jhipster:jhipster"
     compile "io.dropwizard.metrics:metrics-core"
-    <%_ if (['ehcache', 'infinispan'].includes(cacheProvider)) { _%>
+    <%_ if (hibernateCache === 'ehcache' || hibernateCache === 'infinispan') { _%>
     compile "io.dropwizard.metrics:metrics-jcache"
     <%_ } _%>
     compile "io.dropwizard.metrics:metrics-json"
@@ -234,24 +231,22 @@ dependencies {
     compile "com.fasterxml.jackson.core:jackson-databind"
     compile "com.fasterxml.jackson.module:jackson-module-afterburner"
     compile "com.ryantenney.metrics:metrics-spring"
-    <%_ if (cacheProvider === 'hazelcast') { _%>
+    <%_ if (hibernateCache === 'hazelcast') { _%>
     compile "com.hazelcast:hazelcast"
-    <%_ if (enableHibernateCache) { _%>
     compile "com.hazelcast:hazelcast-hibernate52"
-    <%_ } _%>
     compile "com.hazelcast:hazelcast-spring"
     <%_ } _%>
-    <%_ if ((clusteredHttpSession === 'hazelcast' || applicationType === 'gateway') && cacheProvider !== 'hazelcast') { _%>
+    <%_ if ((clusteredHttpSession === 'hazelcast' || applicationType === 'gateway') && hibernateCache !== 'hazelcast') { _%>
     compile "com.hazelcast:hazelcast"
     compile "com.hazelcast:hazelcast-spring"
     <%_ } _%>
     <%_ if (clusteredHttpSession === 'hazelcast') { _%>
     compile "com.hazelcast:hazelcast-wm"
     <%_ } _%>
-    <%_ if (enableHibernateCache && cacheProvider === 'infinispan') { _%>
+    <%_ if (hibernateCache === 'infinispan') { _%>
     compile "org.hibernate:hibernate-infinispan"
     <%_ } _%>
-    <%_ if (cacheProvider === 'infinispan') {_%>
+    <%_ if (hibernateCache === 'infinispan') {_%>
     compile "org.infinispan:infinispan-spring-boot-starter"
     compile "org.infinispan:infinispan-core"
     compile "org.infinispan:infinispan-jcache"
@@ -259,7 +254,7 @@ dependencies {
         exclude module: 'undertow-core'
     }
     <%_ } _%>
-    <%_ if (['ehcache', 'hazelcast', 'infinispan'].includes(cacheProvider) || applicationType === 'gateway') { _%>
+    <%_ if (hibernateCache === 'ehcache' || hibernateCache === 'hazelcast' || hibernateCache === 'infinispan' || applicationType === 'gateway') { _%>
     compile "javax.cache:cache-api"
     <%_ } _%>
     <%_ if (databaseType === 'sql') { _%>
@@ -275,11 +270,9 @@ dependencies {
     <%_ if (databaseType === 'cassandra') { _%>
     compile "org.lz4:lz4-java"
     <%_ } _%>
-    <%_ if (cacheProvider === 'ehcache') { _%>
+    <%_ if (hibernateCache === 'ehcache' && databaseType === 'sql') { _%>
     compile "org.ehcache:ehcache"
-        <%_ if (enableHibernateCache) { _%>
     compile "org.hibernate:hibernate-jcache"
-        <%_ } _%>
     <%_ } _%>
     <%_ if (databaseType === 'sql') { _%>
     compile "org.hibernate:hibernate-entitymanager"
diff --git a/generators/server/templates/_pom.xml b/generators/server/templates/_pom.xml
index e7d96a63fb..968976739a 100644
--- a/generators/server/templates/_pom.xml
+++ b/generators/server/templates/_pom.xml
@@ -158,12 +158,6 @@
     </dependencyManagement>
 
     <dependencies>
-        <%_ if (cacheProvider !== 'no') { _%>
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-cache</artifactId>
-        </dependency>
-        <%_ } _%>
         <dependency>
             <groupId>io.github.jhipster</groupId>
             <artifactId>jhipster</artifactId>
@@ -180,7 +174,7 @@
             <groupId>io.dropwizard.metrics</groupId>
             <artifactId>metrics-json</artifactId>
         </dependency>
-        <%_ if (['ehcache', 'infinispan'].includes(cacheProvider)) { _%>
+        <%_ if (hibernateCache === 'ehcache' || hibernateCache === 'infinispan') { _%>
         <dependency>
             <groupId>io.dropwizard.metrics</groupId>
             <artifactId>metrics-jcache</artifactId>
@@ -225,19 +219,19 @@
             <artifactId>h2</artifactId>
             <scope>test</scope>
         </dependency>
-        <%_ if (cacheProvider === 'hazelcast' || clusteredHttpSession === 'hazelcast' || applicationType === 'gateway') { _%>
+        <%_ if (hibernateCache === 'hazelcast' || clusteredHttpSession === 'hazelcast' || applicationType === 'gateway') { _%>
         <dependency>
             <groupId>com.hazelcast</groupId>
             <artifactId>hazelcast</artifactId>
         </dependency>
         <%_ } _%>
-        <%_ if (cacheProvider === 'hazelcast' && enableHibernateCache) { _%>
+        <%_ if (hibernateCache === 'hazelcast') { _%>
         <dependency>
             <groupId>com.hazelcast</groupId>
             <artifactId>hazelcast-hibernate52</artifactId>
         </dependency>
         <%_ } _%>
-        <%_ if (cacheProvider === 'hazelcast' || clusteredHttpSession === 'hazelcast' || applicationType === 'gateway') { _%>
+        <%_ if (hibernateCache === 'hazelcast' || clusteredHttpSession === 'hazelcast' || applicationType === 'gateway') { _%>
         <dependency>
             <groupId>com.hazelcast</groupId>
             <artifactId>hazelcast-spring</artifactId>
@@ -249,13 +243,13 @@
             <artifactId>hazelcast-wm</artifactId>
         </dependency>
         <%_ } _%>
-        <%_ if (cacheProvider === 'infinispan' && enableHibernateCache) { _%>
+        <%_ if (hibernateCache === 'infinispan') { _%>
         <dependency>
             <groupId>org.hibernate</groupId>
             <artifactId>hibernate-infinispan</artifactId>
         </dependency>
         <%_ } _%>
-        <%_ if (cacheProvider === 'infinispan') { _%>
+        <%_ if (hibernateCache === 'infinispan') { _%>
         <dependency>
             <groupId>org.infinispan</groupId>
             <artifactId>infinispan-spring-boot-starter</artifactId>
@@ -342,7 +336,7 @@
             <artifactId>jzlib</artifactId>
         </dependency>
         <%_ } _%>
-        <%_ if (['ehcache', 'hazelcast', 'infinispan'].includes(cacheProvider) || applicationType === 'gateway') { _%>
+        <%_ if (hibernateCache === 'ehcache' || hibernateCache === 'hazelcast' || hibernateCache === 'infinispan' || applicationType === 'gateway') { _%>
         <dependency>
             <groupId>javax.cache</groupId>
             <artifactId>cache-api</artifactId>
@@ -395,17 +389,15 @@
             <scope>test</scope>
         </dependency>
         <%_ } _%>
-        <%_ if (cacheProvider === 'ehcache') { _%>
+        <%_ if (hibernateCache === 'ehcache' && databaseType === 'sql') { _%>
         <dependency>
             <groupId>org.ehcache</groupId>
             <artifactId>ehcache</artifactId>
         </dependency>
-            <%_ if (enableHibernateCache) { _%>
         <dependency>
             <groupId>org.hibernate</groupId>
             <artifactId>hibernate-jcache</artifactId>
         </dependency>
-            <%_ } _%>
         <%_ } _%>
         <%_ if (databaseType === 'sql') { _%>
         <dependency>
diff --git a/generators/server/templates/src/main/docker/_Dockerfile b/generators/server/templates/src/main/docker/_Dockerfile
index e99f7bed6b..62e207fc61 100644
--- a/generators/server/templates/src/main/docker/_Dockerfile
+++ b/generators/server/templates/src/main/docker/_Dockerfile
@@ -20,12 +20,12 @@ FROM <%= DOCKER_JAVA_JRE %>
 
 ENV SPRING_OUTPUT_ANSI_ENABLED=ALWAYS \
     JHIPSTER_SLEEP=0 \
-    JAVA_OPTS="<%_ if (cacheProvider === 'infinispan') { _%>-Djgroups.tcp.address=NON_LOOPBACK -Djava.net.preferIPv4Stack=true<%_ } _%>"
+    JAVA_OPTS="<%_ if (hibernateCache === 'infinispan') { _%>-Djgroups.tcp.address=NON_LOOPBACK -Djava.net.preferIPv4Stack=true<%_ } _%>"
 
 CMD echo "The application will start in ${JHIPSTER_SLEEP}s..." && \
     sleep ${JHIPSTER_SLEEP} && \
     java ${JAVA_OPTS} -Djava.security.egd=file:/dev/./urandom -jar /app.war
 
-EXPOSE <%= serverPort %><% if (cacheProvider === 'hazelcast') { %> 5701/udp<% } %>
+EXPOSE <%= serverPort %><% if (hibernateCache === 'hazelcast') { %> 5701/udp<% } %>
 
 ADD *.war /app.war
diff --git a/generators/server/templates/src/main/docker/_app.yml b/generators/server/templates/src/main/docker/_app.yml
index acd52c6189..b480e196ef 100644
--- a/generators/server/templates/src/main/docker/_app.yml
+++ b/generators/server/templates/src/main/docker/_app.yml
@@ -84,7 +84,7 @@ services:
             - SPRING_CLOUD_STREAM_KAFKA_BINDER_BROKERS=kafka
             - SPRING_CLOUD_STREAM_KAFKA_BINDER_ZK_NODES=zookeeper
             <%_ } _%>
-            <%_ if (cacheProvider === 'infinispan') { _%>
+            <%_ if (hibernateCache === 'infinispan') { _%>
             - JAVA_OPTS=-Djgroups.tcp.address=NON_LOOPBACK -Djava.net.preferIPv4Stack=true
             <%_ } _%>
         <%_ if (applicationType === 'monolith' || applicationType === 'gateway') { _%>
diff --git a/generators/server/templates/src/main/java/package/config/_CacheConfiguration.java b/generators/server/templates/src/main/java/package/config/_CacheConfiguration.java
index 24227f6dd0..0cf9886eda 100644
--- a/generators/server/templates/src/main/java/package/config/_CacheConfiguration.java
+++ b/generators/server/templates/src/main/java/package/config/_CacheConfiguration.java
@@ -17,7 +17,7 @@
  limitations under the License.
 -%>
 package <%=packageName%>.config;
-<%_ if (cacheProvider === 'ehcache') { _%>
+<%_ if (hibernateCache === 'ehcache') { _%>
 
 import io.github.jhipster.config.JHipsterProperties;
 import org.ehcache.config.builders.CacheConfigurationBuilder;
@@ -29,7 +29,7 @@ import org.ehcache.jsr107.Eh107Configuration;
 import java.util.concurrent.TimeUnit;
 
 <%_ } _%>
-<%_ if (cacheProvider === 'hazelcast' || clusteredHttpSession === 'hazelcast') { _%>
+<%_ if (hibernateCache === 'hazelcast' || clusteredHttpSession === 'hazelcast') { _%>
 
 import io.github.jhipster.config.JHipsterConstants;
 import io.github.jhipster.config.JHipsterProperties;
@@ -46,10 +46,10 @@ import org.springframework.beans.factory.annotation.Autowired;
 <%_ } _%>
 import org.springframework.boot.autoconfigure.AutoConfigureAfter;
 import org.springframework.boot.autoconfigure.AutoConfigureBefore;
-<%_ if (cacheProvider === 'ehcache') { _%>
+<%_ if (hibernateCache === 'ehcache') { _%>
 import org.springframework.boot.autoconfigure.cache.JCacheManagerCustomizer;
 <%_ } _%>
-<%_ if (cacheProvider === 'hazelcast' || clusteredHttpSession === 'hazelcast') { _%>
+<%_ if (hibernateCache === 'hazelcast' || clusteredHttpSession === 'hazelcast') { _%>
     <%_ if (serviceDiscoveryType === 'eureka') { _%>
 import org.springframework.boot.autoconfigure.web.ServerProperties;
     <%_ } _%>
@@ -62,19 +62,17 @@ import org.springframework.cloud.client.ServiceInstance;
 import org.springframework.cloud.client.discovery.DiscoveryClient;
 import org.springframework.cloud.client.serviceregistry.Registration;
 <%_ } _%>
-import org.springframework.context.annotation.*;
-<%_ if (cacheProvider === 'hazelcast' || clusteredHttpSession === 'hazelcast') { _%>
-import org.springframework.core.env.Environment;
-<%_ } _%>
+import org.springframework.context.annotation.*;<% if (hibernateCache === 'hazelcast' || clusteredHttpSession === 'hazelcast') { %>
+import org.springframework.core.env.Environment;<% } %>
 <%_ if (clusteredHttpSession === 'hazelcast') { _%>
 import org.springframework.security.core.session.SessionRegistry;
 import org.springframework.security.core.session.SessionRegistryImpl;
 <%_ } _%>
-<%_ if (cacheProvider === 'hazelcast' || clusteredHttpSession === 'hazelcast') { _%>
+<%_ if (hibernateCache === 'hazelcast' || clusteredHttpSession === 'hazelcast') { _%>
 
 import javax.annotation.PreDestroy;
 <%_ } _%>
-<%_ if (cacheProvider === 'infinispan') { _%>
+<%_ if (hibernateCache === 'infinispan') { _%>
 import org.infinispan.configuration.cache.CacheMode;
 import org.infinispan.configuration.cache.ConfigurationBuilder;
 import org.infinispan.configuration.global.GlobalConfigurationBuilder;
@@ -117,11 +115,11 @@ import java.util.List;
 @EnableCaching
 @AutoConfigureAfter(value = { MetricsConfiguration.class })
 @AutoConfigureBefore(value = { WebConfigurer.class<% if (databaseType === 'sql' || databaseType === 'mongodb') { %>, DatabaseConfiguration.class<% } %> })
-<%_ if (cacheProvider === 'infinispan') { _%>
+<%_ if (hibernateCache === 'infinispan') { _%>
 @Import(InfinispanEmbeddedCacheManagerAutoConfiguration.class)
 <%_ } _%>
 public class CacheConfiguration {
-    <%_ if (cacheProvider === 'ehcache') { _%>
+    <%_ if (hibernateCache === 'ehcache') { _%>
 
     private final javax.cache.configuration.Configuration<Object, Object> jcacheConfiguration;
 
@@ -159,7 +157,7 @@ public class CacheConfiguration {
         };
     }
     <%_ } _%>
-    <%_ if (cacheProvider === 'hazelcast' || clusteredHttpSession === 'hazelcast') { _%>
+    <%_ if (hibernateCache === 'hazelcast' || clusteredHttpSession === 'hazelcast') { _%>
 
     private final Logger log = LoggerFactory.getLogger(CacheConfiguration.class);
 
@@ -173,7 +171,7 @@ public class CacheConfiguration {
     private Registration registration;
         <%_ } _%>
 
-    public CacheConfiguration(<% if (cacheProvider === 'hazelcast' || clusteredHttpSession === 'hazelcast') { %>Environment env<% if (serviceDiscoveryType === 'eureka') { %>, ServerProperties serverProperties, DiscoveryClient discoveryClient<% } } %>) {
+    public CacheConfiguration(<% if (hibernateCache === 'hazelcast' || clusteredHttpSession === 'hazelcast') { %>Environment env<% if (serviceDiscoveryType === 'eureka') { %>, ServerProperties serverProperties, DiscoveryClient discoveryClient<% } } %>) {
         this.env = env;
         <%_ if (serviceDiscoveryType === 'eureka') { _%>
         this.serverProperties = serverProperties;
@@ -259,7 +257,7 @@ public class CacheConfiguration {
 
         // Full reference is available at: http://docs.hazelcast.org/docs/management-center/3.9/manual/html/Deploying_and_Starting.html
         config.setManagementCenterConfig(initializeDefaultManagementCenterConfig(jHipsterProperties));
-        <%_ if (cacheProvider === 'hazelcast') { _%>
+        <%_ if (hibernateCache === 'hazelcast') { _%>
         config.getMapConfigs().put("<%=packageName%>.domain.*", initializeDomainMapConfig(jHipsterProperties));
         <%_ } _%>
         <%_ if (clusteredHttpSession === 'hazelcast') { _%>
@@ -305,7 +303,7 @@ public class CacheConfiguration {
 
         return mapConfig;
     }
-    <%_ if (cacheProvider === 'hazelcast') { _%>
+    <%_ if (hibernateCache === 'hazelcast') { _%>
 
     private MapConfig initializeDomainMapConfig(JHipsterProperties jHipsterProperties) {
         MapConfig mapConfig = new MapConfig();
@@ -333,7 +331,7 @@ public class CacheConfiguration {
     }
     <%_ } _%>
     <%_ } _%>
-    <%_ if (cacheProvider === 'infinispan') { _%>
+    <%_ if (hibernateCache === 'infinispan') { _%>
 
     private final Logger log = LoggerFactory.getLogger(CacheConfiguration.class);
 
diff --git a/generators/server/templates/src/main/java/package/config/_CloudDatabaseConfiguration.java b/generators/server/templates/src/main/java/package/config/_CloudDatabaseConfiguration.java
index 2c9dbcb605..019263e749 100644
--- a/generators/server/templates/src/main/java/package/config/_CloudDatabaseConfiguration.java
+++ b/generators/server/templates/src/main/java/package/config/_CloudDatabaseConfiguration.java
@@ -29,10 +29,8 @@ import io.github.jhipster.config.JHipsterConstants;
 <%_ } _%>
 
 import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-<%_ if (cacheProvider === 'hazelcast') { _%>
-import org.springframework.cache.CacheManager;
-<%_ } _%>
+import org.slf4j.LoggerFactory;<% if (hibernateCache === 'hazelcast') { %>
+import org.springframework.cache.CacheManager;<% } %>
 <%_ if (databaseType === 'mongodb') { _%>
 import org.springframework.cloud.Cloud;
 import org.springframework.cloud.CloudException;
@@ -73,7 +71,7 @@ public class CloudDatabaseConfiguration extends AbstractCloudConfig {
     <%_ if (databaseType === 'sql') { _%>
 
     @Bean
-    public DataSource dataSource(<% if (cacheProvider === 'hazelcast') { %>CacheManager cacheManager<% } %>) {
+    public DataSource dataSource(<% if (hibernateCache === 'hazelcast') { %>CacheManager cacheManager<% } %>) {
         log.info("Configuring JDBC datasource from a cloud provider");
         return connectionFactory().dataSource();
     }
diff --git a/generators/server/templates/src/main/java/package/config/_MetricsConfiguration.java b/generators/server/templates/src/main/java/package/config/_MetricsConfiguration.java
index 89509f21a7..233003aa4b 100644
--- a/generators/server/templates/src/main/java/package/config/_MetricsConfiguration.java
+++ b/generators/server/templates/src/main/java/package/config/_MetricsConfiguration.java
@@ -35,7 +35,7 @@ import com.codahale.metrics.JvmAttributeGaugeSet;
 import com.codahale.metrics.MetricRegistry;
 import com.codahale.metrics.Slf4jReporter;
 import com.codahale.metrics.health.HealthCheckRegistry;
-<%_ if (['ehcache', 'infinispan'].includes(cacheProvider)) { _%>
+<%_ if (hibernateCache === 'ehcache' || hibernateCache === 'infinispan') { _%>
 import com.codahale.metrics.jcache.JCacheGaugeSet;
 <%_ } _%>
 import com.codahale.metrics.jvm.*;
@@ -67,7 +67,7 @@ public class MetricsConfiguration extends MetricsConfigurerAdapter {
     private static final String PROP_METRIC_REG_JVM_FILES = "jvm.files";
     private static final String PROP_METRIC_REG_JVM_BUFFERS = "jvm.buffers";
     private static final String PROP_METRIC_REG_JVM_ATTRIBUTE_SET = "jvm.attributes";
-<% if (['ehcache', 'infinispan'].includes(cacheProvider)) { %>
+<% if (hibernateCache === 'ehcache' || hibernateCache === 'infinispan') { %>
     private static final String PROP_METRIC_REG_JCACHE_STATISTICS = "jcache.statistics";
 <%_ } _%>
 
@@ -115,7 +115,7 @@ public class MetricsConfiguration extends MetricsConfigurerAdapter {
         metricRegistry.register(PROP_METRIC_REG_JVM_FILES, new FileDescriptorRatioGauge());
         metricRegistry.register(PROP_METRIC_REG_JVM_BUFFERS, new BufferPoolMetricSet(ManagementFactory.getPlatformMBeanServer()));
         metricRegistry.register(PROP_METRIC_REG_JVM_ATTRIBUTE_SET, new JvmAttributeGaugeSet());
-        <%_ if (['ehcache', 'infinispan'].includes(cacheProvider)) { _%>
+        <%_ if (hibernateCache === 'ehcache' || hibernateCache === 'infinispan') { _%>
         metricRegistry.register(PROP_METRIC_REG_JCACHE_STATISTICS, new JCacheGaugeSet());
         <%_ } _%>
         <%_ if (databaseType === 'sql') { _%>
diff --git a/generators/server/templates/src/main/java/package/config/_MicroserviceSecurityConfiguration.java b/generators/server/templates/src/main/java/package/config/_MicroserviceSecurityConfiguration.java
index 37fb60b9ff..fba8c9d31c 100644
--- a/generators/server/templates/src/main/java/package/config/_MicroserviceSecurityConfiguration.java
+++ b/generators/server/templates/src/main/java/package/config/_MicroserviceSecurityConfiguration.java
@@ -245,7 +245,7 @@ public class MicroserviceSecurityConfiguration extends ResourceServerConfigurerA
     @Primary
     public UserInfoTokenServices userInfoTokenServices(PrincipalExtractor principalExtractor, AuthoritiesExtractor authoritiesExtractor) {
         UserInfoTokenServices userInfoTokenServices =
-        <%_ if (cacheProvider !== 'no') { _%>
+        <%_ if (hibernateCache !== 'no') { _%>
             new CachedUserInfoTokenServices(resourceServerProperties.getUserInfoUri(), resourceServerProperties.getClientId());
         <%_ } else { _%>
             new UserInfoTokenServices(resourceServerProperties.getUserInfoUri(), resourceServerProperties.getClientId());
diff --git a/generators/server/templates/src/main/java/package/config/_WebConfigurer.java b/generators/server/templates/src/main/java/package/config/_WebConfigurer.java
index 6a47c089b7..67e5518934 100644
--- a/generators/server/templates/src/main/java/package/config/_WebConfigurer.java
+++ b/generators/server/templates/src/main/java/package/config/_WebConfigurer.java
@@ -19,21 +19,15 @@
 package <%=packageName%>.config;
 
 import io.github.jhipster.config.JHipsterConstants;
-import io.github.jhipster.config.JHipsterProperties;
-<%_ if (!skipClient) { _%>
-import io.github.jhipster.web.filter.CachingHttpHeadersFilter;
-<%_ } _%>
+import io.github.jhipster.config.JHipsterProperties;<% if (!skipClient) { %>
+import io.github.jhipster.web.filter.CachingHttpHeadersFilter;<% } %>
 
 import com.codahale.metrics.MetricRegistry;
 import com.codahale.metrics.servlet.InstrumentedFilter;
-import com.codahale.metrics.servlets.MetricsServlet;
-<%_ if (clusteredHttpSession === 'hazelcast' || cacheProvider === 'hazelcast') { _%>
-import com.hazelcast.core.HazelcastInstance;
-<%_ } _%>
-<%_ if (clusteredHttpSession === 'hazelcast') { _%>
+import com.codahale.metrics.servlets.MetricsServlet;<% if (clusteredHttpSession === 'hazelcast' || hibernateCache === 'hazelcast') { %>
+import com.hazelcast.core.HazelcastInstance;<% } %><% if (clusteredHttpSession === 'hazelcast') { %>
 import com.hazelcast.web.SessionListener;
-import com.hazelcast.web.spring.SpringAwareWebFilter;
-<%_ } _%>
+import com.hazelcast.web.spring.SpringAwareWebFilter;<% } %>
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -65,17 +59,17 @@ public class WebConfigurer implements ServletContextInitializer, EmbeddedServlet
 
     private final Environment env;
 
-    private final JHipsterProperties jHipsterProperties;<% if (clusteredHttpSession === 'hazelcast' || cacheProvider === 'hazelcast') { %>
+    private final JHipsterProperties jHipsterProperties;<% if (clusteredHttpSession === 'hazelcast' || hibernateCache === 'hazelcast') { %>
 
     private final HazelcastInstance hazelcastInstance;<% } %>
 
     private MetricRegistry metricRegistry;
 
-    public WebConfigurer(Environment env, JHipsterProperties jHipsterProperties<% if (clusteredHttpSession === 'hazelcast' || cacheProvider === 'hazelcast') { %>, HazelcastInstance hazelcastInstance<% } %>) {
+    public WebConfigurer(Environment env, JHipsterProperties jHipsterProperties<% if (clusteredHttpSession === 'hazelcast' || hibernateCache === 'hazelcast') { %>, HazelcastInstance hazelcastInstance<% } %>) {
 
         this.env = env;
         this.jHipsterProperties = jHipsterProperties;
-        <%_ if (clusteredHttpSession === 'hazelcast' || cacheProvider === 'hazelcast') { _%>
+        <%_ if (clusteredHttpSession === 'hazelcast' || hibernateCache === 'hazelcast') { _%>
         this.hazelcastInstance = hazelcastInstance;
         <%_ } _%>
     }
diff --git a/generators/server/templates/src/main/java/package/domain/_Authority.java b/generators/server/templates/src/main/java/package/domain/_Authority.java
index ca61b91619..1d6cc518fc 100644
--- a/generators/server/templates/src/main/java/package/domain/_Authority.java
+++ b/generators/server/templates/src/main/java/package/domain/_Authority.java
@@ -18,20 +18,14 @@
 -%>
 package <%=packageName%>.domain;
 
-<%_ if (enableHibernateCache) { _%>
-import org.hibernate.annotations.Cache;
-import org.hibernate.annotations.CacheConcurrencyStrategy;
-<%_ } _%>
-<%_ if (databaseType === 'mongodb' || databaseType === 'couchbase') { _%>
+<% if (hibernateCache !== 'no' && databaseType === 'sql') { %>import org.hibernate.annotations.Cache;
+import org.hibernate.annotations.CacheConcurrencyStrategy;<% } %><% if (databaseType === 'mongodb' || databaseType === 'couchbase') { %>
 import org.springframework.data.annotation.Id;
-import org.springframework.data.<%= databaseType %>.core.mapping.Document;
-<%_ } _%>
-<%_ if (databaseType === 'sql') { _%>
+import org.springframework.data.<%= databaseType %>.core.mapping.Document;<% } %><% if (databaseType === 'sql') { %>
 import javax.persistence.Entity;
 import javax.persistence.Id;
 import javax.persistence.Table;
-import javax.persistence.Column;
-<%_ } _%>
+import javax.persistence.Column;<% } %>
 import javax.validation.constraints.NotNull;
 import javax.validation.constraints.Size;
 import java.io.Serializable;
@@ -42,8 +36,8 @@ import java.io.Serializable;
 <%_ if (databaseType === 'sql') { _%>
 @Entity
 @Table(name = "<%= jhiTablePrefix %>_authority")
-    <%_ if (enableHibernateCache) { _%>
-        <%_ if (cacheProvider === 'infinispan') { _%>
+    <%_ if (hibernateCache !== 'no') { _%>
+        <%_ if (hibernateCache === 'infinispan') { _%>
 @Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
         <%_ } else { _%>
 @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
diff --git a/generators/server/templates/src/main/java/package/domain/_PersistentToken.java b/generators/server/templates/src/main/java/package/domain/_PersistentToken.java
index a8b4cd8cbf..af1a987bb2 100644
--- a/generators/server/templates/src/main/java/package/domain/_PersistentToken.java
+++ b/generators/server/templates/src/main/java/package/domain/_PersistentToken.java
@@ -17,74 +17,48 @@
  limitations under the License.
 -%>
 package <%=packageName%>.domain;
-
-<%_ if (databaseType === 'cassandra') { _%>
-import com.datastax.driver.mapping.annotations.*;
-<%_ } _%>
-import com.fasterxml.jackson.annotation.JsonIgnore;
-<%_ if (enableHibernateCache) { _%>
+<% if (databaseType === 'cassandra') { %>
+import com.datastax.driver.mapping.annotations.*;<% } %>
+import com.fasterxml.jackson.annotation.JsonIgnore;<% if (hibernateCache !== 'no' && databaseType === 'sql') { %>
 import org.hibernate.annotations.Cache;
-import org.hibernate.annotations.CacheConcurrencyStrategy;
-<%_ } _%>
-import java.time.LocalDate;
-<%_ if (databaseType === 'mongodb') { _%>
+import org.hibernate.annotations.CacheConcurrencyStrategy;<% } %>
+import java.time.LocalDate;<% if (databaseType === 'mongodb') { %>
 import org.springframework.data.annotation.Id;
 import org.springframework.data.mongodb.core.mapping.DBRef;
-import org.springframework.data.mongodb.core.mapping.Document;
-<%_ } _%>
-<%_ if (databaseType === 'couchbase') { _%>
+import org.springframework.data.mongodb.core.mapping.Document;<% } %><% if (databaseType === 'couchbase') { %>
 import org.springframework.data.annotation.Id;
 import org.springframework.data.couchbase.core.mapping.Document;
 import org.springframework.data.couchbase.core.mapping.id.GeneratedValue;
 import org.springframework.data.couchbase.core.mapping.id.IdAttribute;
-import org.springframework.data.couchbase.core.mapping.id.IdPrefix;
-<%_ } _%>
-
-<%_ if (databaseType === 'sql') { _%>
-import javax.persistence.*;
-<%_ } _%>
+import org.springframework.data.couchbase.core.mapping.id.IdPrefix;<% } %>
+<% if (databaseType === 'sql') { %>import javax.persistence.*;<% } %>
 import javax.validation.constraints.NotNull;
 import javax.validation.constraints.Size;
-import java.io.Serializable;
-<%_ if (databaseType === 'cassandra') { _%>
-import java.util.Date;
-<%_ } _%>
-
-<%_ if (databaseType === 'couchbase') { _%>
+import java.io.Serializable;<% if (databaseType === 'cassandra') { %>
+import java.util.Date;<% } %>
+<% if (databaseType === 'couchbase') { %>
 import static <%=packageName%>.config.Constants.ID_DELIMITER;
 import static org.springframework.data.couchbase.core.mapping.id.GenerationStrategy.USE_ATTRIBUTES;
-<%_ } _%>
-
+<% } %>
 /**
  * Persistent tokens are used by Spring Security to automatically log in users.
  *
  * @see <%=packageName%>.security.PersistentTokenRememberMeServices
- */
-<%_ if (databaseType === 'sql') { _%>
+ */<% if (databaseType === 'sql') { %>
 @Entity
-@Table(name = "<%= jhiTablePrefix %>_persistent_token")
-<%_ } _%>
-<%_ if (enableHibernateCache) { if (cacheProvider === 'infinispan') { _%>
-@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
-<%_ } else { _%>
-@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
-<%_ } } _%>
-<%_ if (databaseType === 'mongodb') { _%>
-@Document(collection = "<%= jhiTablePrefix %>_persistent_token")
-<%_ } _%>
-<%_ if (databaseType === 'couchbase') { _%>
-@Document
-<%_ } _%>
-<%_ if (databaseType === 'cassandra') { _%>
-@Table(name = "persistent_token")
-<%_ } _%>
+@Table(name = "<%= jhiTablePrefix %>_persistent_token")<% } %>
+<%_ if (hibernateCache !== 'no' && databaseType === 'sql') { if (hibernateCache === 'infinispan') { _%>
+@Cache(usage = CacheConcurrencyStrategy.READ_WRITE) <%_ } else { _%>
+@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)<%_ } } _%><% if (databaseType === 'mongodb') { %>
+@Document(collection = "<%= jhiTablePrefix %>_persistent_token")<% } %><% if (databaseType === 'couchbase') { %>
+@Document<% } %><% if (databaseType === 'cassandra') { %>
+@Table(name = "persistent_token")<% } %>
 public class PersistentToken implements Serializable {
 
     private static final long serialVersionUID = 1L;
 
     private static final int MAX_USER_AGENT_LEN = 255;
-
-<%_ if (databaseType === 'couchbase') { _%>
+<% if (databaseType === 'couchbase') { %>
     public static final String PREFIX = "token";
 
     @SuppressWarnings("unused")
@@ -95,14 +69,10 @@ public class PersistentToken implements Serializable {
     @GeneratedValue(strategy = USE_ATTRIBUTES, delimiter = ID_DELIMITER)
     private String id;
 
-    @IdAttribute
-<%_ } _%>
-<%_ if (databaseType === 'sql' || databaseType === 'mongodb')  { _%>
-    @Id
-<%_ } _%>
-<%_ if (databaseType === 'cassandra') { _%>
-    @PartitionKey
-<%_ } _%>
+    @IdAttribute<%_ } _%>
+<% if (databaseType === 'sql' || databaseType === 'mongodb')  { %>
+    @Id<% } %><% if (databaseType === 'cassandra') { %>
+    @PartitionKey<% } %>
     private String series;
 
     @JsonIgnore
diff --git a/generators/server/templates/src/main/java/package/domain/_SocialUserConnection.java b/generators/server/templates/src/main/java/package/domain/_SocialUserConnection.java
index 69da72b36d..6e213a8dc3 100644
--- a/generators/server/templates/src/main/java/package/domain/_SocialUserConnection.java
+++ b/generators/server/templates/src/main/java/package/domain/_SocialUserConnection.java
@@ -32,7 +32,7 @@ import org.springframework.data.couchbase.core.mapping.Document;
 import org.springframework.data.couchbase.core.mapping.id.GeneratedValue;
 import org.springframework.data.couchbase.core.mapping.id.IdPrefix;
 <%_ } _%>
-<%_ if (enableHibernateCache) { _%>
+<%_ if (hibernateCache !== 'no') { _%>
 import org.hibernate.annotations.Cache;
 import org.hibernate.annotations.CacheConcurrencyStrategy;
 <%_ } _%>
@@ -52,17 +52,12 @@ import static org.springframework.data.couchbase.core.mapping.id.GenerationStrat
 <% } %>
 /**
  * A Social user.
- */
-<%_ if (databaseType === 'sql') { _%>
+ */<% if (databaseType === 'sql') { %>
 @Entity
 @Table(name = "<%= jhiTablePrefix %>_social_user_connection")
-    <%_ if (enableHibernateCache) { if (cacheProvider === 'infinispan') { _%>
-@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
-    <%_ } else { _%>
-@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
-    <%_ } } _%>
-<%_ } _%>
-<%_ if (databaseType === 'mongodb') { _%>
+<%_ if (hibernateCache !== 'no') { if (hibernateCache === 'infinispan') { _%>
+@Cache(usage = CacheConcurrencyStrategy.READ_WRITE) <%_ } else { _%>
+@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)<%_ } } _%><% } %><% if (databaseType === 'mongodb') { %>
 @Document(collection = "<%= jhiTablePrefix %>_social_user_connection")
 @CompoundIndexes(
     @CompoundIndex(name = "user2-prov-provusr-idx", unique = true, def = "{'user_id': 1, 'provider_id': 1, 'provider_user_id': 1}")
diff --git a/generators/server/templates/src/main/java/package/domain/_User.java b/generators/server/templates/src/main/java/package/domain/_User.java
index 01993fee94..ec83c2ae46 100644
--- a/generators/server/templates/src/main/java/package/domain/_User.java
+++ b/generators/server/templates/src/main/java/package/domain/_User.java
@@ -90,7 +90,7 @@ import <%=packageName%>.config.Constants;
 import com.datastax.driver.mapping.annotations.*;<% } %>
 import com.fasterxml.jackson.annotation.JsonIgnore;
 import org.apache.commons.lang3.StringUtils;<% if (databaseType === 'sql') { %>
-import org.hibernate.annotations.BatchSize;<% } %><% if (enableHibernateCache) { %>
+import org.hibernate.annotations.BatchSize;<% } %><% if (hibernateCache !== 'no' && databaseType === 'sql') { %>
 import org.hibernate.annotations.Cache;
 import org.hibernate.annotations.CacheConcurrencyStrategy;<% } %>
 import org.hibernate.validator.constraints.Email;
@@ -131,7 +131,7 @@ import static org.springframework.data.couchbase.core.mapping.id.GenerationStrat
  */<% if (databaseType === 'sql') { %>
 @Entity
 @Table(name = "<%= jhiTablePrefix %>_user")<% } %>
-<%_ if (enableHibernateCache) { if (cacheProvider === 'infinispan') { _%>
+<%_ if (hibernateCache !== 'no' && databaseType === 'sql') { if (hibernateCache === 'infinispan') { _%>
 @Cache(usage = CacheConcurrencyStrategy.READ_WRITE) <%_ } else { _%>
 @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE) <%_ } } _%><% if (databaseType === 'mongodb') { %>
 @org.springframework.data.mongodb.core.mapping.Document(collection = "<%= jhiTablePrefix %>_user")<% } %><% if (databaseType === 'couchbase') { %>
@@ -245,7 +245,7 @@ public class User<% if (databaseType === 'sql' || databaseType === 'mongodb' ||
         name = "<%= jhiTablePrefix %>_user_authority",
         joinColumns = {@JoinColumn(name = "user_id", referencedColumnName = "id")},
         inverseJoinColumns = {@JoinColumn(name = "authority_name", referencedColumnName = "name")})
-    <%_ if (enableHibernateCache) { if (cacheProvider === 'infinispan') { _%>
+    <%_ if (hibernateCache !== 'no') { if (hibernateCache === 'infinispan') { _%>
     @Cache(usage = CacheConcurrencyStrategy.READ_WRITE) <%_ } else { _%>
     @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE) <%_ } } _%><% if (databaseType === 'sql') { %>
     @BatchSize(size = 20)<% } %><% } %><% if (databaseType === 'sql' || databaseType === 'mongodb') { %>
@@ -254,7 +254,7 @@ public class User<% if (databaseType === 'sql' || databaseType === 'mongodb' ||
 
     @JsonIgnore
     @OneToMany(cascade = CascadeType.ALL, orphanRemoval = true, mappedBy = "user")
-    <%_ if (enableHibernateCache) { if (cacheProvider === 'infinispan') { _%>
+    <%_ if (hibernateCache !== 'no') { if (hibernateCache === 'infinispan') { _%>
     @Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
     <%_ } else { _%>
     @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
diff --git a/generators/server/templates/src/main/java/package/repository/_UserRepository.java b/generators/server/templates/src/main/java/package/repository/_UserRepository.java
index 27631a7831..a45b27b752 100644
--- a/generators/server/templates/src/main/java/package/repository/_UserRepository.java
+++ b/generators/server/templates/src/main/java/package/repository/_UserRepository.java
@@ -24,7 +24,7 @@ import com.datastax.driver.mapping.Mapper;
 import com.datastax.driver.mapping.MappingManager;
 <%_ } _%>
 import <%=packageName%>.domain.User;
-<%_ if (['ehcache', 'hazelcast', 'infinispan'].includes(cacheProvider) || clusteredHttpSession === 'hazelcast' || applicationType === 'gateway') { _%>
+<%_ if (hibernateCache === 'ehcache' || hibernateCache === 'hazelcast' || hibernateCache === 'infinispan' || clusteredHttpSession === 'hazelcast' || applicationType === 'gateway') { _%>
 import org.springframework.cache.annotation.Cacheable;
 <%_ } _%>
 <%_ if (databaseType === 'sql' || databaseType === 'mongodb' || databaseType === 'couchbase') { _%>
@@ -105,7 +105,7 @@ public interface UserRepository extends <% if (databaseType === 'sql') { %>JpaRe
     Optional<User> findOneWithAuthoritiesById(<%= pkType %> id);
 
     @EntityGraph(attributePaths = "authorities")
-    <%_ if (['ehcache', 'hazelcast', 'infinispan'].includes(cacheProvider) || clusteredHttpSession === 'hazelcast' || applicationType === 'gateway') { _%>
+    <%_ if (hibernateCache === 'ehcache' || hibernateCache === 'hazelcast' || hibernateCache === 'infinispan' || clusteredHttpSession === 'hazelcast' || applicationType === 'gateway') { _%>
     @Cacheable(cacheNames = "users")
     <%_ } _%>
     Optional<User> findOneWithAuthoritiesByLogin(String login);
diff --git a/generators/server/templates/src/main/java/package/service/_UserService.java b/generators/server/templates/src/main/java/package/service/_UserService.java
index 6dfc61caea..af0ab57805 100644
--- a/generators/server/templates/src/main/java/package/service/_UserService.java
+++ b/generators/server/templates/src/main/java/package/service/_UserService.java
@@ -18,7 +18,7 @@
 -%>
 <%_
 let cacheManagerIsAvailable = false;
-if (['ehcache', 'hazelcast', 'infinispan'].includes(cacheProvider) || clusteredHttpSession === 'hazelcast' || applicationType === 'gateway') {
+if (hibernateCache === 'ehcache' || hibernateCache === 'hazelcast' || hibernateCache === 'infinispan' || clusteredHttpSession === 'hazelcast' || applicationType === 'gateway') {
     cacheManagerIsAvailable = true;
 }
 _%>
diff --git a/generators/server/templates/src/main/resources/_logback-spring.xml b/generators/server/templates/src/main/resources/_logback-spring.xml
index abb6a8733c..79a8d22071 100644
--- a/generators/server/templates/src/main/resources/_logback-spring.xml
+++ b/generators/server/templates/src/main/resources/_logback-spring.xml
@@ -49,7 +49,7 @@
     <logger name="ch.qos.logback" level="WARN"/>
     <logger name="com.codahale.metrics" level="WARN"/><% if (databaseType === 'cassandra') { %>
     <logger name="com.datastax" level="WARN"/><% } %>
-    <%_ if (cacheProvider === 'hazelcast') { _%>
+    <%_ if (hibernateCache === 'hazelcast') { _%>
     <logger name="com.hazelcast" level="INFO"/>
     <%_ } _%>
     <%_ if (databaseType === 'couchbase') { _%>
@@ -64,7 +64,7 @@
     <logger name="com.zaxxer" level="WARN"/>
     <logger name="io.undertow" level="WARN"/>
     <logger name="io.undertow.websockets.jsr" level="ERROR"/>
-    <%_ if (cacheProvider === 'ehcache') { _%>
+    <%_ if (hibernateCache === 'ehcache') { _%>
     <logger name="org.ehcache" level="WARN"/>
     <%_ } _%>
     <logger name="org.apache" level="WARN"/>
@@ -83,7 +83,7 @@
     <%_ if (databaseType === 'mongodb' || databaseType === 'couchbase') { _%>
     <logger name="org.reflections" level="WARN"/>
     <%_ } _%>
-    <%_ if (cacheProvider === 'infinispan') { _%>
+    <%_ if (hibernateCache === 'infinispan') { _%>
     <logger name="org.infinispan" level="WARN"/>
     <%_ } _%>
     <logger name="org.springframework" level="WARN"/>
@@ -103,11 +103,11 @@
     <logger name="sun.rmi" level="WARN"/><% if (databaseType === 'sql') { %>
     <logger name="liquibase" level="WARN"/>
     <logger name="LiquibaseSchemaResolver" level="INFO"/><% } %>
-    <%_ if (applicationType === 'microservice' || applicationType === 'gateway' || cacheProvider === 'hazelcast') { _%>
+    <%_ if (applicationType === 'microservice' || applicationType === 'gateway' || hibernateCache === 'hazelcast') { _%>
     <logger name="sun.net.www" level="INFO"/>
     <%_ } _%>
     <logger name="sun.rmi.transport" level="WARN"/>
-    <%_ if (cacheProvider === 'infinispan') { _%>
+    <%_ if (hibernateCache === 'infinispan') { _%>
     <logger name="unknown.jul.logger" level="WARN"/>
     <%_ } _%>
 
diff --git a/generators/server/templates/src/main/resources/config/_application-dev.yml b/generators/server/templates/src/main/resources/config/_application-dev.yml
index 960bb206cb..cc1823132f 100644
--- a/generators/server/templates/src/main/resources/config/_application-dev.yml
+++ b/generators/server/templates/src/main/resources/config/_application-dev.yml
@@ -151,27 +151,25 @@ spring:
         show-sql: true
         properties:
             hibernate.id.new_generator_mappings: true
-            hibernate.cache.use_second_level_cache: <% if (enableHibernateCache) { %>true<% } else { %>false<% } %>
+            hibernate.cache.use_second_level_cache: <% if (hibernateCache === 'ehcache' || hibernateCache === 'hazelcast' || hibernateCache === 'infinispan') { %>true<% } else { %>false<% } %>
             hibernate.cache.use_query_cache: false
             hibernate.generate_statistics: true
-            <%_ if (enableHibernateCache) { _%>
-                <%_ if (cacheProvider === 'ehcache') { _%>
+            <%_ if (hibernateCache === 'ehcache') { _%>
             hibernate.cache.region.factory_class: io.github.jhipster.config.jcache.NoDefaultJCacheRegionFactory
-                <%_ } else if (cacheProvider === 'hazelcast') { _%>
+            <%_ } else if (hibernateCache === 'hazelcast') { _%>
             hibernate.cache.region.factory_class: com.hazelcast.hibernate.HazelcastCacheRegionFactory
             hibernate.cache.hazelcast.instance_name: <%= baseName %>
-                <%_ } else if (cacheProvider === 'infinispan') { _%>
+            <%_ } else if (hibernateCache === 'infinispan') { _%>
             hibernate.cache.region.factory_class: <%=packageName%>.config.CacheFactoryConfiguration
             hibernate.cache.inifinispan.statistics: true
             hibernate.cache.use_minimal_puts: true
             hibernate.cache.infinispan.entity.expiration.lifespan: 3600000
             hibernate.cache.infinispan.entity.eviction.max_entries: 1000
             hibernate.cache.infinispan.jgroups_cfg: default-configs/default-jgroups-tcp.xml
-                <%_ } _%>
-                <%_ if (cacheProvider === 'hazelcast') { _%>
+            <%_ } _%>
+            <%_ if (hibernateCache === 'hazelcast') { _%>
             hibernate.cache.use_minimal_puts: true
             hibernate.cache.hazelcast.use_lite_member: true
-                <%_ } _%>
             <%_ } _%>
     <%_ } _%>
     <%_ if (databaseType === 'mongodb' || databaseType === 'cassandra' || searchEngine === 'elasticsearch') { _%>
@@ -265,9 +263,9 @@ jhipster:
     <%_ } _%>
     http:
         version: V_1_1 # To use HTTP/2 you will need SSL support (see above the "server.ssl" configuration)
-    <%_ if (clusteredHttpSession === 'hazelcast' || cacheProvider !== 'no') { _%>
+    <%_ if (clusteredHttpSession === 'hazelcast' || hibernateCache === 'hazelcast' ||  hibernateCache === 'ehcache' ||  hibernateCache === 'infinispan') { _%>
     cache: # Cache configuration
-        <%_ if (clusteredHttpSession === 'hazelcast' || cacheProvider === 'hazelcast') { _%>
+        <%_ if (clusteredHttpSession === 'hazelcast' || hibernateCache === 'hazelcast') { _%>
         hazelcast: # Hazelcast distributed cache
             time-to-live-seconds: 3600
             backup-count: 1
@@ -276,12 +274,12 @@ jhipster:
                 update-interval: 3
                 url: http://localhost:8180/mancenter
         <%_ } _%>
-        <%_ if (cacheProvider === 'ehcache') { _%>
+        <%_ if (hibernateCache === 'ehcache') { _%>
         ehcache: # Ehcache configuration
             time-to-live-seconds: 3600 # By default objects stay 1 hour in the cache
             max-entries: 100 # Number of objects in each cache entry
         <%_ } _%>
-        <%_ if (cacheProvider === 'infinispan') { _%>
+        <%_ if (hibernateCache === 'infinispan') { _%>
         infinispan:
             config-file: default-configs/default-jgroups-tcp.xml
             statsEnabled: true
diff --git a/generators/server/templates/src/main/resources/config/_application-prod.yml b/generators/server/templates/src/main/resources/config/_application-prod.yml
index f4795dd5f3..9150b26fc2 100644
--- a/generators/server/templates/src/main/resources/config/_application-prod.yml
+++ b/generators/server/templates/src/main/resources/config/_application-prod.yml
@@ -130,27 +130,25 @@ spring:
         show-sql: false
         properties:
             hibernate.id.new_generator_mappings: true
-            hibernate.cache.use_second_level_cache: <% if (enableHibernateCache) { %>true<% } else { %>false<% } %>
+            hibernate.cache.use_second_level_cache: <% if (hibernateCache === 'ehcache' || hibernateCache === 'hazelcast' || hibernateCache === 'infinispan') { %>true<% } else { %>false<% } %>
             hibernate.cache.use_query_cache: false
             hibernate.generate_statistics: false
-            <%_ if (enableHibernateCache) { _%>
-                <%_ if (cacheProvider === 'ehcache') { _%>
+            <%_ if (hibernateCache === 'ehcache') { _%>
             hibernate.cache.region.factory_class: io.github.jhipster.config.jcache.NoDefaultJCacheRegionFactory
-                <%_ } else if (cacheProvider === 'hazelcast') { _%>
+            <%_ } else if (hibernateCache === 'hazelcast') { _%>
             hibernate.cache.region.factory_class: com.hazelcast.hibernate.HazelcastCacheRegionFactory
             hibernate.cache.hazelcast.instance_name: <%= baseName %>
-                <%_ } else if (cacheProvider === 'infinispan') { _%>
+            <%_ } else if (hibernateCache === 'infinispan') { _%>
             hibernate.cache.region.factory_class: <%=packageName%>.config.CacheFactoryConfiguration
             hibernate.cache.inifinispan.statistics: false
             hibernate.cache.use_minimal_puts: true
             hibernate.cache.infinispan.entity.expiration.lifespan: 3600000
             hibernate.cache.infinispan.entity.eviction.max_entries: 1000
             hibernate.cache.infinispan.jgroups_cfg: default-configs/default-jgroups-tcp.xml
-                <%_ } _%>
-                <%_ if (cacheProvider === 'hazelcast') { _%>
+            <%_ } _%>
+            <%_ if (hibernateCache === 'hazelcast') { _%>
             hibernate.cache.use_minimal_puts: true
             hibernate.cache.hazelcast.use_lite_member: true
-                <%_ } _%>
             <%_ } _%>
     <%_ } _%>
     <%_ if (databaseType === 'mongodb' || databaseType === 'cassandra' || searchEngine === 'elasticsearch') { _%>
@@ -242,9 +240,9 @@ jhipster:
         version: V_1_1 # To use HTTP/2 you will need SSL support (see above the "server.ssl" configuration)
         cache: # Used by the CachingHttpHeadersFilter
             timeToLiveInDays: 1461
-    <%_ if (clusteredHttpSession === 'hazelcast' || cacheProvider !== 'no') { _%>
+    <%_ if (clusteredHttpSession === 'hazelcast' || hibernateCache === 'hazelcast' ||  hibernateCache === 'ehcache' || hibernateCache === 'infinispan') { _%>
     cache: # Cache configuration
-        <%_ if (clusteredHttpSession === 'hazelcast' || cacheProvider === 'hazelcast') { _%>
+        <%_ if (clusteredHttpSession === 'hazelcast' || hibernateCache === 'hazelcast') { _%>
         hazelcast: # Hazelcast distributed cache
             time-to-live-seconds: 3600
             backup-count: 1
@@ -253,12 +251,12 @@ jhipster:
                 update-interval: 3
                 url:
         <%_ } _%>
-        <%_ if (cacheProvider === 'ehcache') { _%>
+        <%_ if (hibernateCache === 'ehcache') { _%>
         ehcache: # Ehcache configuration
             time-to-live-seconds: 3600 # By default objects stay 1 hour in the cache
             max-entries: 1000 # Number of objects in each cache entry
         <%_ } _%>
-        <%_ if (cacheProvider === 'infinispan') { _%>
+        <%_ if (hibernateCache === 'infinispan') { _%>
         infinispan:
             config-file: default-configs/default-jgroups-tcp.xml
             statsEnabled: true
diff --git a/travis/samples/README.md b/travis/samples/README.md
index 9f5fc562f1..a1ad8c02b2 100644
--- a/travis/samples/README.md
+++ b/travis/samples/README.md
@@ -7,7 +7,7 @@ To generate test applications, either automatically by Travis or locally on the
  Those are described in `.yo-rc.json` files which is the descriptor file created by Yeoman to keep track of the choices selected while generating an application.
 
 - app-sample-dev : left empty for local testing, launching the generator with the VSCode debugger will generate an app in this folder
-- app-ng2-default-from-scratch
+- app-default-from-scratch
 - app-mariadb-kafka
 - app-ng2-cassandra
 - app-ng2-gateway-consul
@@ -21,7 +21,7 @@ To generate test applications, either automatically by Travis or locally on the
 - app-ng2-social-websocket
 - app-hazelcast-cucumber
 - app-microservice-eureka
-- app-ng2-cache-nol2
+- app-ng2-default
 - app-ng2-gateway-uaa
 - app-ng2-oauth2
 - app-react-default
diff --git a/travis/samples/app-ng2-default-from-scratch/.yo-rc.json b/travis/samples/app-default-from-scratch/.yo-rc.json
similarity index 93%
rename from travis/samples/app-ng2-default-from-scratch/.yo-rc.json
rename to travis/samples/app-default-from-scratch/.yo-rc.json
index 02c71c79b7..6bfa3fbb4a 100644
--- a/travis/samples/app-ng2-default-from-scratch/.yo-rc.json
+++ b/travis/samples/app-default-from-scratch/.yo-rc.json
@@ -5,8 +5,7 @@
     "packageName": "io.github.jhipster.sample",
     "packageFolder": "io/github/jhipster/sample",
     "authenticationType": "jwt",
-    "cacheProvider": "ehcache",
-    "enableHibernateCache": true,
+    "hibernateCache": "ehcache",
     "clusteredHttpSession": false,
     "websocket": false,
     "databaseType": "sql",
diff --git a/travis/samples/app-gradle/.yo-rc.json b/travis/samples/app-gradle/.yo-rc.json
index 16c1fbb90c..f5edf9b9f3 100644
--- a/travis/samples/app-gradle/.yo-rc.json
+++ b/travis/samples/app-gradle/.yo-rc.json
@@ -5,8 +5,7 @@
     "packageName": "io.github.jhipster.travis",
     "packageFolder": "io/github/jhipster/travis",
     "authenticationType": "session",
-    "cacheProvider": "ehcache",
-    "enableHibernateCache": true,
+    "hibernateCache": "ehcache",
     "clusteredHttpSession": false,
     "websocket": false,
     "databaseType": "sql",
diff --git a/travis/samples/app-hazelcast-cucumber/.yo-rc.json b/travis/samples/app-hazelcast-cucumber/.yo-rc.json
index 1eecaa7576..4be1ec48c7 100644
--- a/travis/samples/app-hazelcast-cucumber/.yo-rc.json
+++ b/travis/samples/app-hazelcast-cucumber/.yo-rc.json
@@ -5,8 +5,7 @@
     "packageName": "io.github.jhipster.travis",
     "packageFolder": "io/github/jhipster/travis",
     "authenticationType": "session",
-    "cacheProvider": "hazelcast",
-    "enableHibernateCache": true,
+    "hibernateCache": "hazelcast",
     "clusteredHttpSession": "hazelcast",
     "websocket": false,
     "databaseType": "sql",
diff --git a/travis/samples/app-jwt/.yo-rc.json b/travis/samples/app-jwt/.yo-rc.json
index d3d18a264d..26b6d65a49 100644
--- a/travis/samples/app-jwt/.yo-rc.json
+++ b/travis/samples/app-jwt/.yo-rc.json
@@ -5,8 +5,7 @@
     "packageName": "io.github.jhipster.travis",
     "packageFolder": "io/github/jhipster/travis",
     "authenticationType": "jwt",
-    "cacheProvider": "ehcache",
-    "enableHibernateCache": true,
+    "hibernateCache": "ehcache",
     "clusteredHttpSession": false,
     "websocket": false,
     "databaseType": "sql",
diff --git a/travis/samples/app-mariadb-kafka/.yo-rc.json b/travis/samples/app-mariadb-kafka/.yo-rc.json
index 838b207bdc..b92022ebb3 100644
--- a/travis/samples/app-mariadb-kafka/.yo-rc.json
+++ b/travis/samples/app-mariadb-kafka/.yo-rc.json
@@ -5,8 +5,7 @@
     "packageFolder": "io/github/jhipster/travis",
     "serverPort": "8080",
     "authenticationType": "session",
-    "cacheProvider": "ehcache",
-    "enableHibernateCache": true,
+    "hibernateCache": "ehcache",
     "clusteredHttpSession": false,
     "websocket": false,
     "databaseType": "sql",
diff --git a/travis/samples/app-microservice-consul/.yo-rc.json b/travis/samples/app-microservice-consul/.yo-rc.json
index e91be4ccd1..49129db612 100644
--- a/travis/samples/app-microservice-consul/.yo-rc.json
+++ b/travis/samples/app-microservice-consul/.yo-rc.json
@@ -5,8 +5,7 @@
     "packageName": "io.github.jhipster.travis",
     "packageFolder": "io/github/jhipster/travis",
     "authenticationType": "jwt",
-    "cacheProvider": "ehcache",
-    "enableHibernateCache": true,
+    "hibernateCache": "ehcache",
     "clusteredHttpSession": false,
     "databaseType": "sql",
     "devDatabaseType": "h2Disk",
diff --git a/travis/samples/app-microservice-eureka/.yo-rc.json b/travis/samples/app-microservice-eureka/.yo-rc.json
index 468a559b54..c6de6c26f7 100644
--- a/travis/samples/app-microservice-eureka/.yo-rc.json
+++ b/travis/samples/app-microservice-eureka/.yo-rc.json
@@ -5,8 +5,7 @@
     "packageName": "io.github.jhipster.travis",
     "packageFolder": "io/github/jhipster/travis",
     "authenticationType": "jwt",
-    "cacheProvider": "ehcache",
-    "enableHibernateCache": true,
+    "hibernateCache": "ehcache",
     "clusteredHttpSession": false,
     "databaseType": "sql",
     "devDatabaseType": "h2Disk",
diff --git a/travis/samples/app-mysql/.yo-rc.json b/travis/samples/app-mysql/.yo-rc.json
index 7a1f839057..8cdf1a4f9a 100644
--- a/travis/samples/app-mysql/.yo-rc.json
+++ b/travis/samples/app-mysql/.yo-rc.json
@@ -5,8 +5,7 @@
     "packageName": "io.github.jhipster.travis",
     "packageFolder": "io/github/jhipster/travis",
     "authenticationType": "session",
-    "cacheProvider": "ehcache",
-    "enableHibernateCache": true,
+    "hibernateCache": "ehcache",
     "clusteredHttpSession": false,
     "websocket": false,
     "databaseType": "sql",
diff --git a/travis/samples/app-ng2-cassandra/.yo-rc.json b/travis/samples/app-ng2-cassandra/.yo-rc.json
index 9e89d00f0c..6e88764204 100644
--- a/travis/samples/app-ng2-cassandra/.yo-rc.json
+++ b/travis/samples/app-ng2-cassandra/.yo-rc.json
@@ -5,8 +5,7 @@
     "packageName": "io.github.jhipster.travis",
     "packageFolder": "io/github/jhipster/travis",
     "authenticationType": "session",
-    "cacheProvider": "no",
-    "enableHibernateCache": false,
+    "hibernateCache": "no",
     "clusteredHttpSession": false,
     "websocket": false,
     "databaseType": "cassandra",
diff --git a/travis/samples/app-ng2-couchbase/.yo-rc.json b/travis/samples/app-ng2-couchbase/.yo-rc.json
index 60fba5c02e..141b6b2cc3 100644
--- a/travis/samples/app-ng2-couchbase/.yo-rc.json
+++ b/travis/samples/app-ng2-couchbase/.yo-rc.json
@@ -5,8 +5,7 @@
     "packageName": "io.github.jhipster.travis",
     "packageFolder": "io/github/jhipster/travis",
     "authenticationType": "session",
-    "cacheProvider": "no",
-    "enableHibernateCache": false,
+    "hibernateCache": "no",
     "clusteredHttpSession": false,
     "websocket": false,
     "databaseType": "couchbase",
diff --git a/travis/samples/app-ng2-cache-nol2/.yo-rc.json b/travis/samples/app-ng2-default/.yo-rc.json
similarity index 93%
rename from travis/samples/app-ng2-cache-nol2/.yo-rc.json
rename to travis/samples/app-ng2-default/.yo-rc.json
index 6a4608c91d..f77ea28b2a 100644
--- a/travis/samples/app-ng2-cache-nol2/.yo-rc.json
+++ b/travis/samples/app-ng2-default/.yo-rc.json
@@ -5,8 +5,7 @@
     "packageFolder": "io/github/jhipster/travis",
     "serverPort": "8080",
     "authenticationType": "jwt",
-    "cacheProvider": "ehcache",
-    "enableHibernateCache": false,
+    "hibernateCache": "ehcache",
     "clusteredHttpSession": false,
     "websocket": false,
     "databaseType": "sql",
diff --git a/travis/samples/app-ng2-gateway-consul/.yo-rc.json b/travis/samples/app-ng2-gateway-consul/.yo-rc.json
index 8fff5bc753..a869ac989c 100644
--- a/travis/samples/app-ng2-gateway-consul/.yo-rc.json
+++ b/travis/samples/app-ng2-gateway-consul/.yo-rc.json
@@ -5,8 +5,7 @@
     "packageName": "io.github.jhipster.travis",
     "packageFolder": "io/github/jhipster/travis",
     "authenticationType": "jwt",
-    "cacheProvider": "ehcache",
-    "enableHibernateCache": true,
+    "hibernateCache": "ehcache",
     "clusteredHttpSession": false,
     "websocket": false,
     "databaseType": "sql",
diff --git a/travis/samples/app-ng2-gateway-eureka/.yo-rc.json b/travis/samples/app-ng2-gateway-eureka/.yo-rc.json
index 8741fac439..4a700281d7 100644
--- a/travis/samples/app-ng2-gateway-eureka/.yo-rc.json
+++ b/travis/samples/app-ng2-gateway-eureka/.yo-rc.json
@@ -5,8 +5,7 @@
     "packageName": "io.github.jhipster.travis",
     "packageFolder": "io/github/jhipster/travis",
     "authenticationType": "jwt",
-    "cacheProvider": "ehcache",
-    "enableHibernateCache": true,
+    "hibernateCache": "ehcache",
     "clusteredHttpSession": false,
     "websocket": false,
     "databaseType": "sql",
diff --git a/travis/samples/app-ng2-gateway-uaa/.yo-rc.json b/travis/samples/app-ng2-gateway-uaa/.yo-rc.json
index 81e677dd46..fb804cc22c 100644
--- a/travis/samples/app-ng2-gateway-uaa/.yo-rc.json
+++ b/travis/samples/app-ng2-gateway-uaa/.yo-rc.json
@@ -6,8 +6,7 @@
     "serverPort": "8080",
     "authenticationType": "uaa",
     "uaaBaseName": "travisUaa",
-    "cacheProvider": "hazelcast",
-    "enableHibernateCache": true,
+    "hibernateCache": "hazelcast",
     "clusteredHttpSession": false,
     "websocket": false,
     "databaseType": "sql",
diff --git a/travis/samples/app-ng2-gradle-jwt-psql/.yo-rc.json b/travis/samples/app-ng2-gradle-jwt-psql/.yo-rc.json
index 26020d34db..18c79284de 100644
--- a/travis/samples/app-ng2-gradle-jwt-psql/.yo-rc.json
+++ b/travis/samples/app-ng2-gradle-jwt-psql/.yo-rc.json
@@ -5,8 +5,7 @@
     "packageFolder": "io/github/jhipster/travis",
     "serverPort": "8080",
     "authenticationType": "jwt",
-    "cacheProvider": "ehcache",
-    "enableHibernateCache": true,
+    "hibernateCache": "ehcache",
     "clusteredHttpSession": false,
     "websocket": false,
     "databaseType": "sql",
diff --git a/travis/samples/app-ng2-infinispan/.yo-rc.json b/travis/samples/app-ng2-infinispan/.yo-rc.json
index e8a7266531..8d83f48b18 100644
--- a/travis/samples/app-ng2-infinispan/.yo-rc.json
+++ b/travis/samples/app-ng2-infinispan/.yo-rc.json
@@ -9,8 +9,7 @@
     "packageFolder": "io/github/jhipster/travis",
     "serverPort": "8080",
     "authenticationType": "jwt",
-    "cacheProvider": "infinispan",
-    "enableHibernateCache": true,
+    "hibernateCache": "infinispan",
     "clusteredHttpSession": false,
     "websocket": false,
     "databaseType": "sql",
diff --git a/travis/samples/app-ng2-mongodb-elasticsearch/.yo-rc.json b/travis/samples/app-ng2-mongodb-elasticsearch/.yo-rc.json
index 941155fa29..e601486b41 100644
--- a/travis/samples/app-ng2-mongodb-elasticsearch/.yo-rc.json
+++ b/travis/samples/app-ng2-mongodb-elasticsearch/.yo-rc.json
@@ -5,8 +5,7 @@
     "packageName": "io.github.jhipster.travis",
     "packageFolder": "io/github/jhipster/travis",
     "authenticationType": "session",
-    "cacheProvider": "no",
-    "enableHibernateCache": false,
+    "hibernateCache": "no",
     "clusteredHttpSession": false,
     "websocket": false,
     "databaseType": "mongodb",
diff --git a/travis/samples/app-ng2-mongodb/.yo-rc.json b/travis/samples/app-ng2-mongodb/.yo-rc.json
index fd900f7544..96fb6bef7a 100644
--- a/travis/samples/app-ng2-mongodb/.yo-rc.json
+++ b/travis/samples/app-ng2-mongodb/.yo-rc.json
@@ -5,8 +5,7 @@
     "packageName": "io.github.jhipster.travis",
     "packageFolder": "io/github/jhipster/travis",
     "authenticationType": "session",
-    "cacheProvider": "no",
-    "enableHibernateCache": false,
+    "hibernateCache": "no",
     "clusteredHttpSession": false,
     "websocket": false,
     "databaseType": "mongodb",
diff --git a/travis/samples/app-ng2-oauth2/.yo-rc.json b/travis/samples/app-ng2-oauth2/.yo-rc.json
index db685ae118..4624162719 100644
--- a/travis/samples/app-ng2-oauth2/.yo-rc.json
+++ b/travis/samples/app-ng2-oauth2/.yo-rc.json
@@ -5,8 +5,7 @@
     "packageName": "io.github.jhipster.travis",
     "packageFolder": "io/github/jhipster/travis",
     "authenticationType": "oauth2",
-    "cacheProvider": "ehcache",
-    "enableHibernateCache": true,
+    "hibernateCache": "ehcache",
     "clusteredHttpSession": false,
     "websocket": false,
     "databaseType": "sql",
diff --git a/travis/samples/app-ng2-psql-es-noi18n/.yo-rc.json b/travis/samples/app-ng2-psql-es-noi18n/.yo-rc.json
index 3ec9ef4ec8..a1185e5df5 100644
--- a/travis/samples/app-ng2-psql-es-noi18n/.yo-rc.json
+++ b/travis/samples/app-ng2-psql-es-noi18n/.yo-rc.json
@@ -5,8 +5,7 @@
     "packageName": "com.mycompany.myapp",
     "packageFolder": "com/mycompany/myapp",
     "authenticationType": "session",
-    "cacheProvider": "ehcache",
-    "enableHibernateCache": true,
+    "hibernateCache": "ehcache",
     "clusteredHttpSession": false,
     "websocket": false,
     "databaseType": "sql",
diff --git a/travis/samples/app-ng2-sass-noi18n/.yo-rc.json b/travis/samples/app-ng2-sass-noi18n/.yo-rc.json
index 13fb1fb538..d3174417dd 100644
--- a/travis/samples/app-ng2-sass-noi18n/.yo-rc.json
+++ b/travis/samples/app-ng2-sass-noi18n/.yo-rc.json
@@ -5,8 +5,7 @@
     "packageFolder": "io/github/jhipster/travis",
     "serverPort": "8080",
     "authenticationType": "session",
-    "cacheProvider": "ehcache",
-    "enableHibernateCache": true,
+    "hibernateCache": "ehcache",
     "clusteredHttpSession": false,
     "websocket": false,
     "databaseType": "sql",
diff --git a/travis/samples/app-ng2-social-websocket/.yo-rc.json b/travis/samples/app-ng2-social-websocket/.yo-rc.json
index 066d54536c..858a73d3a9 100644
--- a/travis/samples/app-ng2-social-websocket/.yo-rc.json
+++ b/travis/samples/app-ng2-social-websocket/.yo-rc.json
@@ -5,8 +5,7 @@
     "packageName": "io.github.jhipster.travis",
     "packageFolder": "io/github/jhipster/travis",
     "authenticationType": "session",
-    "cacheProvider": "ehcache",
-    "enableHibernateCache": true,
+    "hibernateCache": "ehcache",
     "clusteredHttpSession": false,
     "websocket": "spring-websocket",
     "databaseType": "sql",
diff --git a/travis/samples/app-react-default/.yo-rc.json b/travis/samples/app-react-default/.yo-rc.json
index e4b3dc39e3..c72d8c95cb 100644
--- a/travis/samples/app-react-default/.yo-rc.json
+++ b/travis/samples/app-react-default/.yo-rc.json
@@ -5,8 +5,7 @@
     "packageFolder": "io/github/jhipster/travis",
     "serverPort": "8080",
     "authenticationType": "jwt",
-    "cacheProvider": "ehcache",
-    "enableHibernateCache": true,
+    "hibernateCache": "ehcache",
     "clusteredHttpSession": false,
     "websocket": false,
     "databaseType": "sql",
diff --git a/travis/samples/uaa/.yo-rc.json b/travis/samples/uaa/.yo-rc.json
index 14ef3f0dc2..a0d82b2954 100644
--- a/travis/samples/uaa/.yo-rc.json
+++ b/travis/samples/uaa/.yo-rc.json
@@ -5,8 +5,7 @@
     "packageFolder": "io/github/jhipster/travis",
     "serverPort": "9999",
     "authenticationType": "uaa",
-    "cacheProvider": "hazelcast",
-    "enableHibernateCache": true,    
+    "hibernateCache": "hazelcast",
     "clusteredHttpSession": false,
     "websocket": false,
     "databaseType": "sql",
diff --git a/travis/scripts/06-sonar.sh b/travis/scripts/06-sonar.sh
index 386993b6a7..c4ba17efd4 100755
--- a/travis/scripts/06-sonar.sh
+++ b/travis/scripts/06-sonar.sh
@@ -4,7 +4,7 @@
 # Launch Sonar analysis
 #--------------------------------------------------
 cd "$APP_FOLDER"
-if [ "$JHIPSTER" == "app-ng2-default-from-scratch" ]; then
+if [ "$JHIPSTER" == "app-default-from-scratch" ]; then
     if [ "$TRAVIS_REPO_SLUG" = "jhipster/generator-jhipster" ] && [ "$TRAVIS_BRANCH" = "master" ] && [ "$TRAVIS_PULL_REQUEST" = "false" ]; then
         ./mvnw clean
         if [ -f "gulpfile.js" ]; then


Test patch:
diff --git a/generators/entity-client/templates/angular/src/test/javascript/spec/app/entities/_entity-management.service.spec.ts b/generators/entity-client/templates/angular/src/test/javascript/spec/app/entities/_entity-management.service.spec.ts
index a9f2db6690..67e1d21a93 100644
--- a/generators/entity-client/templates/angular/src/test/javascript/spec/app/entities/_entity-management.service.spec.ts
+++ b/generators/entity-client/templates/angular/src/test/javascript/spec/app/entities/_entity-management.service.spec.ts
@@ -27,9 +27,7 @@ import { JhiDateUtils } from 'ng-jhipster';
 
 import { <%= entityAngularName %>Service } from '../../../../../../main/webapp/app/entities/<%= entityFolderName %>/<%= entityFileName %>.service';
 import { <%= entityAngularName %> } from '../../../../../../main/webapp/app/entities/<%= entityFolderName %>/<%= entityFileName %>.model';
-<%_ if (!(applicationType === 'gateway' && locals.microserviceName) && authenticationType !== 'uaa') { _%>
 import { SERVER_API_URL } from '../../../../../../main/webapp/app/app.constants';
-<%_ } _%>
 
 describe('Service Tests', () => {
 
@@ -67,7 +65,7 @@ describe('Service Tests', () => {
 
                 expect(this.lastConnection).toBeDefined();
 
-                const resourceUrl = <% if (applicationType === 'gateway' && locals.microserviceName) { %>'/<%= microserviceName.toLowerCase() %>/<% } else if (authenticationType === 'uaa') { %>'<% } else { %>SERVER_API_URL + '<% } %>api/<%= entityApiUrl %>';
+                const resourceUrl = SERVER_API_URL + '<% if (applicationType === 'gateway' && locals.microserviceName) { %>/<%= microserviceName.toLowerCase() %>/<% } %>api/<%= entityApiUrl %>';
                 expect(this.lastConnection.request.url).toEqual(resourceUrl + '/' + <%- tsKeyId %>);
             });
             it('should return <%= entityAngularName %>', () => {
diff --git a/generators/server/templates/src/test/java/package/config/_WebConfigurerTest.java b/generators/server/templates/src/test/java/package/config/_WebConfigurerTest.java
index 1d919f312b..6a0d4f3f7a 100644
--- a/generators/server/templates/src/test/java/package/config/_WebConfigurerTest.java
+++ b/generators/server/templates/src/test/java/package/config/_WebConfigurerTest.java
@@ -21,7 +21,7 @@ package <%= packageName %>.config;
 import com.codahale.metrics.MetricRegistry;
 import com.codahale.metrics.servlet.InstrumentedFilter;
 import com.codahale.metrics.servlets.MetricsServlet;
-<%_ if (clusteredHttpSession === 'hazelcast' || cacheProvider === 'hazelcast') { _%>
+<%_ if (clusteredHttpSession === 'hazelcast' || hibernateCache === 'hazelcast') { _%>
 import com.hazelcast.cardinality.CardinalityEstimator;
 import com.hazelcast.config.Config;
 import com.hazelcast.core.*;
@@ -61,7 +61,7 @@ import org.xnio.OptionMap;
 
 import javax.servlet.*;
 import java.util.*;
-<%_ if (clusteredHttpSession === 'hazelcast' || cacheProvider === 'hazelcast') { _%>
+<%_ if (clusteredHttpSession === 'hazelcast' || hibernateCache === 'hazelcast') { _%>
 import java.util.concurrent.ConcurrentMap;
 <%_ } _%>
 
@@ -106,7 +106,7 @@ public class WebConfigurerTest {
         env = new MockEnvironment();
         props = new JHipsterProperties();
 
-        webConfigurer = new WebConfigurer(env, props<% if (clusteredHttpSession === 'hazelcast' || cacheProvider === 'hazelcast') { %>, new MockHazelcastInstance()<% } %>);
+        webConfigurer = new WebConfigurer(env, props<% if (clusteredHttpSession === 'hazelcast' || hibernateCache === 'hazelcast') { %>, new MockHazelcastInstance()<% } %>);
         metricRegistry = new MetricRegistry();
         webConfigurer.setMetricRegistry(metricRegistry);
     }
@@ -408,7 +408,7 @@ public class WebConfigurerTest {
             return null;
         }
     }
-    <%_ if (clusteredHttpSession === 'hazelcast' || cacheProvider === 'hazelcast') { _%>
+    <%_ if (clusteredHttpSession === 'hazelcast' || hibernateCache === 'hazelcast') { _%>
 
     public static class MockHazelcastInstance implements HazelcastInstance {
 
diff --git a/generators/server/templates/src/test/resources/_logback.xml b/generators/server/templates/src/test/resources/_logback.xml
index 82a418cc49..6c10fc4bd5 100644
--- a/generators/server/templates/src/test/resources/_logback.xml
+++ b/generators/server/templates/src/test/resources/_logback.xml
@@ -45,7 +45,7 @@
     <logger name="com.zaxxer" level="WARN"/>
     <logger name="io.undertow" level="WARN"/>
     <logger name="io.undertow.websockets.jsr" level="ERROR"/>
-    <%_ if (cacheProvider === 'ehcache') { _%>
+    <%_ if (hibernateCache === 'ehcache') { _%>
     <logger name="org.ehcache" level="WARN"/>
     <%_ } _%>
     <logger name="org.apache" level="WARN"/>
@@ -68,7 +68,7 @@
     <%_ if (databaseType === 'mongodb' || databaseType === 'couchbase') { _%>
     <logger name="org.reflections" level="WARN"/>
     <%_ } _%>
-    <%_ if (cacheProvider === 'infinispan') { _%>
+    <%_ if (hibernateCache === 'infinispan') { _%>
     <logger name="org.infinispan" level="WARN"/>
     <%_ } _%>
     <logger name="org.springframework" level="WARN"/>
@@ -92,7 +92,7 @@
     <logger name="sun.net.www" level="INFO"/>
     <%_ } _%>
     <logger name="sun.rmi.transport" level="WARN"/>
-    <%_ if (cacheProvider === 'infinispan') { _%>
+    <%_ if (hibernateCache === 'infinispan') { _%>
     <logger name="unknown.jul.logger" level="WARN"/>
     <%_ } _%>
 
diff --git a/test/app.spec.js b/test/app.spec.js
index 08abfdec83..3308f3237e 100644
--- a/test/app.spec.js
+++ b/test/app.spec.js
@@ -29,8 +29,7 @@ describe('JHipster generator', () => {
                         packageFolder: 'com/mycompany/myapp',
                         serviceDiscoveryType: false,
                         authenticationType: 'jwt',
-                        cacheProvider: 'ehcache',
-                        enableHibernateCache: true,
+                        hibernateCache: 'ehcache',
                         databaseType: 'sql',
                         devDatabaseType: 'h2Memory',
                         prodDatabaseType: 'mysql',
@@ -90,8 +89,7 @@ describe('JHipster generator', () => {
                         packageFolder: 'com/mycompany/myapp',
                         serviceDiscoveryType: false,
                         authenticationType: 'jwt',
-                        cacheProvider: 'ehcache',
-                        enableHibernateCache: true,
+                        hibernateCache: 'ehcache',
                         databaseType: 'sql',
                         devDatabaseType: 'h2Memory',
                         prodDatabaseType: 'mysql',
@@ -143,8 +141,7 @@ describe('JHipster generator', () => {
                         packageFolder: 'com/mycompany/myapp',
                         serviceDiscoveryType: false,
                         authenticationType: 'jwt',
-                        cacheProvider: 'ehcache',
-                        enableHibernateCache: true,
+                        hibernateCache: 'ehcache',
                         databaseType: 'sql',
                         devDatabaseType: 'h2Memory',
                         prodDatabaseType: 'mysql',
@@ -191,8 +188,7 @@ describe('JHipster generator', () => {
                         clientFramework: 'angularX',
                         serviceDiscoveryType: false,
                         authenticationType: 'jwt',
-                        cacheProvider: 'ehcache',
-                        enableHibernateCache: true,
+                        hibernateCache: 'ehcache',
                         databaseType: 'sql',
                         devDatabaseType: 'h2Memory',
                         prodDatabaseType: 'mysql',
@@ -242,8 +238,7 @@ describe('JHipster generator', () => {
                         clientFramework: 'angularX',
                         serviceDiscoveryType: false,
                         authenticationType: 'jwt',
-                        cacheProvider: 'ehcache',
-                        enableHibernateCache: true,
+                        hibernateCache: 'ehcache',
                         databaseType: 'sql',
                         devDatabaseType: 'h2Memory',
                         prodDatabaseType: 'mysql',
@@ -287,8 +282,7 @@ describe('JHipster generator', () => {
                         clientFramework: 'angularX',
                         serviceDiscoveryType: false,
                         authenticationType: 'jwt',
-                        cacheProvider: 'ehcache',
-                        enableHibernateCache: true,
+                        hibernateCache: 'ehcache',
                         databaseType: 'sql',
                         devDatabaseType: 'h2Disk',
                         prodDatabaseType: 'mariadb',
@@ -333,8 +327,7 @@ describe('JHipster generator', () => {
                         clientFramework: 'angularX',
                         serviceDiscoveryType: false,
                         authenticationType: 'jwt',
-                        cacheProvider: 'no',
-                        enableHibernateCache: false,
+                        hibernateCache: 'no',
                         databaseType: 'mongodb',
                         devDatabaseType: 'mongodb',
                         prodDatabaseType: 'mongodb',
@@ -368,8 +361,7 @@ describe('JHipster generator', () => {
                         clientFramework: 'angularX',
                         serviceDiscoveryType: false,
                         authenticationType: 'jwt',
-                        cacheProvider: 'no',
-                        enableHibernateCache: false,
+                        hibernateCache: 'no',
                         databaseType: 'couchbase',
                         devDatabaseType: 'couchbase',
                         prodDatabaseType: 'couchbase',
@@ -403,8 +395,7 @@ describe('JHipster generator', () => {
                         clientFramework: 'angularX',
                         serviceDiscoveryType: false,
                         authenticationType: 'jwt',
-                        cacheProvider: 'no',
-                        enableHibernateCache: false,
+                        hibernateCache: 'no',
                         databaseType: 'sql',
                         devDatabaseType: 'mssql',
                         prodDatabaseType: 'mssql',
@@ -440,8 +431,7 @@ describe('JHipster generator', () => {
                         clientFramework: 'angularX',
                         serviceDiscoveryType: false,
                         authenticationType: 'jwt',
-                        cacheProvider: 'no',
-                        enableHibernateCache: false,
+                        hibernateCache: 'no',
                         databaseType: 'cassandra',
                         devDatabaseType: 'cassandra',
                         prodDatabaseType: 'cassandra',
@@ -475,8 +465,7 @@ describe('JHipster generator', () => {
                         clientFramework: 'angularX',
                         serviceDiscoveryType: false,
                         authenticationType: 'jwt',
-                        cacheProvider: 'no',
-                        enableHibernateCache: false,
+                        hibernateCache: 'no',
                         databaseType: 'cassandra',
                         devDatabaseType: 'cassandra',
                         prodDatabaseType: 'cassandra',
@@ -509,8 +498,7 @@ describe('JHipster generator', () => {
                         clientFramework: 'angularX',
                         serviceDiscoveryType: false,
                         authenticationType: 'jwt',
-                        cacheProvider: 'no',
-                        enableHibernateCache: false,
+                        hibernateCache: 'no',
                         databaseType: 'sql',
                         devDatabaseType: 'postgresql',
                         prodDatabaseType: 'postgresql',
@@ -549,8 +537,7 @@ describe('JHipster generator', () => {
                         clientFramework: 'angularX',
                         serviceDiscoveryType: false,
                         authenticationType: 'oauth2',
-                        cacheProvider: 'ehcache',
-                        enableHibernateCache: true,
+                        hibernateCache: 'ehcache',
                         databaseType: 'sql',
                         devDatabaseType: 'h2Memory',
                         prodDatabaseType: 'mysql',
@@ -581,8 +568,7 @@ describe('JHipster generator', () => {
                         clientFramework: 'angularX',
                         serviceDiscoveryType: false,
                         authenticationType: 'jwt',
-                        cacheProvider: 'hazelcast',
-                        enableHibernateCache: true,
+                        hibernateCache: 'hazelcast',
                         databaseType: 'sql',
                         devDatabaseType: 'h2Memory',
                         prodDatabaseType: 'mysql',
@@ -613,8 +599,7 @@ describe('JHipster generator', () => {
                         clientFramework: 'angular1',
                         serviceDiscoveryType: false,
                         authenticationType: 'jwt',
-                        cacheProvider: 'infinispan',
-                        enableHibernateCache: true,
+                        hibernateCache: 'infinispan',
                         databaseType: 'sql',
                         devDatabaseType: 'h2Memory',
                         prodDatabaseType: 'mysql',
@@ -646,8 +631,7 @@ describe('JHipster generator', () => {
                         serviceDiscoveryType: 'eureka',
                         clientFramework: 'angular1',
                         authenticationType: 'jwt',
-                        cacheProvider: 'infinispan',
-                        enableHibernateCache: true,
+                        hibernateCache: 'infinispan',
                         databaseType: 'sql',
                         devDatabaseType: 'h2Memory',
                         prodDatabaseType: 'mysql',
@@ -681,8 +665,7 @@ describe('JHipster generator', () => {
                         serverPort: '8080',
                         serviceDiscoveryType: false,
                         authenticationType: 'jwt',
-                        cacheProvider: 'ehcache',
-                        enableHibernateCache: true,
+                        hibernateCache: 'ehcache',
                         clusteredHttpSession: false,
                         websocket: false,
                         databaseType: 'sql',
@@ -730,8 +713,7 @@ describe('JHipster generator', () => {
                         serverPort: '8080',
                         serviceDiscoveryType: false,
                         authenticationType: 'jwt',
-                        cacheProvider: 'ehcache',
-                        enableHibernateCache: true,
+                        hibernateCache: 'ehcache',
                         clusteredHttpSession: false,
                         websocket: false,
                         databaseType: 'sql',
@@ -779,8 +761,7 @@ describe('JHipster generator', () => {
                         serverPort: '8080',
                         serviceDiscoveryType: false,
                         authenticationType: 'jwt',
-                        cacheProvider: 'ehcache',
-                        enableHibernateCache: true,
+                        hibernateCache: 'ehcache',
                         clusteredHttpSession: false,
                         websocket: false,
                         databaseType: 'sql',
@@ -831,8 +812,7 @@ describe('JHipster generator', () => {
                         clientFramework: 'angularX',
                         serviceDiscoveryType: false,
                         authenticationType: 'jwt',
-                        cacheProvider: 'ehcache',
-                        enableHibernateCache: true,
+                        hibernateCache: 'ehcache',
                         databaseType: 'sql',
                         devDatabaseType: 'h2Memory',
                         prodDatabaseType: 'mysql',
@@ -867,8 +847,7 @@ describe('JHipster generator', () => {
                         clientFramework: 'angularX',
                         serviceDiscoveryType: false,
                         authenticationType: 'jwt',
-                        cacheProvider: 'ehcache',
-                        enableHibernateCache: true,
+                        hibernateCache: 'ehcache',
                         databaseType: 'sql',
                         devDatabaseType: 'h2Memory',
                         prodDatabaseType: 'mysql',
@@ -902,8 +881,7 @@ describe('JHipster generator', () => {
                         clientFramework: 'angularX',
                         serviceDiscoveryType: false,
                         authenticationType: 'jwt',
-                        cacheProvider: 'ehcache',
-                        enableHibernateCache: true,
+                        hibernateCache: 'ehcache',
                         databaseType: 'sql',
                         devDatabaseType: 'h2Memory',
                         prodDatabaseType: 'mysql',
@@ -939,8 +917,7 @@ describe('JHipster generator', () => {
                         clientFramework: 'angularX',
                         serviceDiscoveryType: false,
                         authenticationType: 'jwt',
-                        cacheProvider: 'hazelcast',
-                        enableHibernateCache: true,
+                        hibernateCache: 'hazelcast',
                         databaseType: 'sql',
                         devDatabaseType: 'h2Memory',
                         prodDatabaseType: 'mysql',
@@ -970,8 +947,7 @@ describe('JHipster generator', () => {
                         packageFolder: 'com/mycompany/myapp',
                         serviceDiscoveryType: false,
                         authenticationType: 'jwt',
-                        cacheProvider: 'ehcache',
-                        enableHibernateCache: true,
+                        hibernateCache: 'ehcache',
                         databaseType: 'sql',
                         devDatabaseType: 'h2Memory',
                         prodDatabaseType: 'mysql',
@@ -1016,8 +992,7 @@ describe('JHipster generator', () => {
                         clientFramework: 'angularX',
                         serviceDiscoveryType: false,
                         authenticationType: 'session',
-                        cacheProvider: 'ehcache',
-                        enableHibernateCache: true,
+                        hibernateCache: 'ehcache',
                         databaseType: 'sql',
                         devDatabaseType: 'h2Memory',
                         prodDatabaseType: 'mysql',
@@ -1058,8 +1033,7 @@ describe('JHipster generator', () => {
                         clientFramework: 'angularX',
                         serviceDiscoveryType: false,
                         authenticationType: 'jwt',
-                        cacheProvider: 'ehcache',
-                        enableHibernateCache: true,
+                        hibernateCache: 'ehcache',
                         databaseType: 'sql',
                         devDatabaseType: 'h2Memory',
                         prodDatabaseType: 'mysql',
@@ -1101,8 +1075,7 @@ describe('JHipster generator', () => {
                         clientFramework: 'angularX',
                         serviceDiscoveryType: false,
                         authenticationType: 'jwt',
-                        cacheProvider: 'ehcache',
-                        enableHibernateCache: true,
+                        hibernateCache: 'ehcache',
                         databaseType: 'sql',
                         devDatabaseType: 'h2Memory',
                         prodDatabaseType: 'mysql',
@@ -1140,8 +1113,7 @@ describe('JHipster generator', () => {
                         clientFramework: 'angularX',
                         serviceDiscoveryType: false,
                         authenticationType: 'session',
-                        cacheProvider: 'ehcache',
-                        enableHibernateCache: true,
+                        hibernateCache: 'ehcache',
                         databaseType: 'sql',
                         devDatabaseType: 'h2Memory',
                         prodDatabaseType: 'mysql',
@@ -1182,8 +1154,7 @@ describe('JHipster generator', () => {
                         serverPort: '8080',
                         authenticationType: 'jwt',
                         serviceDiscoveryType: false,
-                        cacheProvider: 'ehcache',
-                        enableHibernateCache: true,
+                        hibernateCache: 'ehcache',
                         clusteredHttpSession: false,
                         websocket: false,
                         databaseType: 'sql',
@@ -1238,8 +1209,7 @@ describe('JHipster generator', () => {
                         serverPort: '8080',
                         serviceDiscoveryType: false,
                         authenticationType: 'jwt',
-                        cacheProvider: 'ehcache',
-                        enableHibernateCache: true,
+                        hibernateCache: 'ehcache',
                         clusteredHttpSession: false,
                         websocket: false,
                         databaseType: 'sql',
@@ -1288,8 +1258,7 @@ describe('JHipster generator', () => {
                         packageFolder: 'com/mycompany/myapp',
                         serviceDiscoveryType: false,
                         authenticationType: 'jwt',
-                        cacheProvider: 'ehcache',
-                        enableHibernateCache: true,
+                        hibernateCache: 'ehcache',
                         databaseType: 'sql',
                         devDatabaseType: 'h2Memory',
                         prodDatabaseType: 'mysql',
@@ -1326,8 +1295,7 @@ describe('JHipster generator', () => {
                         packageFolder: 'com/mycompany/myapp',
                         serviceDiscoveryType: false,
                         authenticationType: 'jwt',
-                        cacheProvider: 'ehcache',
-                        enableHibernateCache: true,
+                        hibernateCache: 'ehcache',
                         databaseType: 'sql',
                         devDatabaseType: 'h2Memory',
                         prodDatabaseType: 'mysql',
@@ -1373,8 +1341,7 @@ describe('JHipster generator', () => {
                         packageFolder: 'com/mycompany/myapp',
                         serviceDiscoveryType: false,
                         authenticationType: 'jwt',
-                        cacheProvider: 'ehcache',
-                        enableHibernateCache: true,
+                        hibernateCache: 'ehcache',
                         databaseType: 'sql',
                         devDatabaseType: 'h2Memory',
                         prodDatabaseType: 'mysql',
@@ -1407,8 +1374,7 @@ describe('JHipster generator', () => {
                         clientFramework: 'angularX',
                         serviceDiscoveryType: 'eureka',
                         authenticationType: 'jwt',
-                        cacheProvider: 'ehcache',
-                        enableHibernateCache: true,
+                        hibernateCache: 'ehcache',
                         databaseType: 'sql',
                         devDatabaseType: 'h2Memory',
                         prodDatabaseType: 'mysql',
@@ -1442,8 +1408,7 @@ describe('JHipster generator', () => {
                         packageFolder: 'com/mycompany/myapp',
                         serviceDiscoveryType: 'eureka',
                         authenticationType: 'jwt',
-                        cacheProvider: 'ehcache',
-                        enableHibernateCache: true,
+                        hibernateCache: 'ehcache',
                         databaseType: 'sql',
                         devDatabaseType: 'mysql',
                         prodDatabaseType: 'mysql',
@@ -1478,8 +1443,7 @@ describe('JHipster generator', () => {
                         packageFolder: 'com/mycompany/myapp',
                         clientFramework: 'angular1',
                         authenticationType: 'jwt',
-                        cacheProvider: 'ehcache',
-                        enableHibernateCache: true,
+                        hibernateCache: 'ehcache',
                         databaseType: 'sql',
                         devDatabaseType: 'h2Memory',
                         prodDatabaseType: 'mysql',
@@ -1513,8 +1477,7 @@ describe('JHipster generator', () => {
                         packageFolder: 'com/mycompany/myapp',
                         serviceDiscoveryType: 'eureka',
                         authenticationType: 'jwt',
-                        cacheProvider: 'ehcache',
-                        enableHibernateCache: true,
+                        hibernateCache: 'ehcache',
                         databaseType: 'sql',
                         devDatabaseType: 'h2Memory',
                         prodDatabaseType: 'mysql',
@@ -1551,8 +1514,7 @@ describe('JHipster generator', () => {
                         packageFolder: 'com/mycompany/myapp',
                         serverPort: '9999',
                         authenticationType: 'uaa',
-                        cacheProvider: 'no',
-                        enableHibernateCache: false,
+                        hibernateCache: 'no',
                         databaseType: 'sql',
                         devDatabaseType: 'mysql',
                         prodDatabaseType: 'mysql',
@@ -1590,8 +1552,7 @@ describe('JHipster generator', () => {
                         serverPort: '8080',
                         authenticationType: 'uaa',
                         uaaBaseName: './uaa/',
-                        cacheProvider: 'hazelcast',
-                        enableHibernateCache: true,
+                        hibernateCache: 'hazelcast',
                         databaseType: 'sql',
                         devDatabaseType: 'mysql',
                         prodDatabaseType: 'mysql',
@@ -1629,8 +1590,7 @@ describe('JHipster generator', () => {
                         clientFramework: 'angularX',
                         serviceDiscoveryType: 'consul',
                         authenticationType: 'jwt',
-                        cacheProvider: 'ehcache',
-                        enableHibernateCache: true,
+                        hibernateCache: 'ehcache',
                         databaseType: 'sql',
                         devDatabaseType: 'h2Memory',
                         prodDatabaseType: 'mysql',
@@ -1664,8 +1624,7 @@ describe('JHipster generator', () => {
                         packageFolder: 'com/mycompany/myapp',
                         serviceDiscoveryType: 'consul',
                         authenticationType: 'jwt',
-                        cacheProvider: 'ehcache',
-                        enableHibernateCache: true,
+                        hibernateCache: 'ehcache',
                         databaseType: 'sql',
                         devDatabaseType: 'mysql',
                         prodDatabaseType: 'mysql',
diff --git a/test/server.spec.js b/test/server.spec.js
index 5e08ea8d92..ea4099b883 100644
--- a/test/server.spec.js
+++ b/test/server.spec.js
@@ -18,8 +18,7 @@ describe('JHipster server generator', () => {
                     packageFolder: 'com/mycompany/myapp',
                     serviceDiscoveryType: false,
                     authenticationType: 'jwt',
-                    cacheProvider: 'ehcache',
-                    enableHibernateCache: true,
+                    hibernateCache: 'ehcache',
                     databaseType: 'sql',
                     devDatabaseType: 'h2Memory',
                     prodDatabaseType: 'mysql',
diff --git a/test/templates/all-languages/.yo-rc.json b/test/templates/all-languages/.yo-rc.json
index 588b216ede..c51aef32bc 100644
--- a/test/templates/all-languages/.yo-rc.json
+++ b/test/templates/all-languages/.yo-rc.json
@@ -5,8 +5,7 @@
     "packageFolder": "com/mycompany/myapp",
     "serverPort": "8080",
     "authenticationType": "jwt",
-    "cacheProvider": "ehcache",
-    "enableHibernateCache": true,
+    "hibernateCache": "ehcache",
     "clusteredHttpSession": false,
     "websocket": false,
     "databaseType": "sql",
diff --git a/test/templates/ci-cd/gradle-ng1-npm/.yo-rc.json b/test/templates/ci-cd/gradle-ng1-npm/.yo-rc.json
index bbc4a5aafb..9c498022ec 100644
--- a/test/templates/ci-cd/gradle-ng1-npm/.yo-rc.json
+++ b/test/templates/ci-cd/gradle-ng1-npm/.yo-rc.json
@@ -5,8 +5,7 @@
     "packageName": "com.mycompany.myapp",
     "packageFolder": "com/mycompany/myapp",
     "authenticationType": "session",
-    "cacheProvider": "ehcache",
-    "enableHibernateCache": true,
+    "hibernateCache": "ehcache",
     "clusteredHttpSession": "no",
     "websocket": "no",
     "databaseType": "sql",
diff --git a/test/templates/ci-cd/gradle-ng1-yarn/.yo-rc.json b/test/templates/ci-cd/gradle-ng1-yarn/.yo-rc.json
index 83ecec96a4..67f98b731d 100644
--- a/test/templates/ci-cd/gradle-ng1-yarn/.yo-rc.json
+++ b/test/templates/ci-cd/gradle-ng1-yarn/.yo-rc.json
@@ -5,8 +5,7 @@
     "packageName": "com.mycompany.myapp",
     "packageFolder": "com/mycompany/myapp",
     "authenticationType": "session",
-    "cacheProvider": "ehcache",
-    "enableHibernateCache": true,
+    "hibernateCache": "ehcache",
     "clusteredHttpSession": "no",
     "websocket": "no",
     "databaseType": "sql",
diff --git a/test/templates/ci-cd/gradle-ng2-npm/.yo-rc.json b/test/templates/ci-cd/gradle-ng2-npm/.yo-rc.json
index c2b992740f..016e1e0c19 100644
--- a/test/templates/ci-cd/gradle-ng2-npm/.yo-rc.json
+++ b/test/templates/ci-cd/gradle-ng2-npm/.yo-rc.json
@@ -5,8 +5,7 @@
     "packageName": "com.mycompany.myapp",
     "packageFolder": "com/mycompany/myapp",
     "authenticationType": "session",
-    "cacheProvider": "ehcache",
-    "enableHibernateCache": true,
+    "hibernateCache": "ehcache",
     "clusteredHttpSession": "no",
     "websocket": "no",
     "databaseType": "sql",
diff --git a/test/templates/ci-cd/gradle-ng2-yarn/.yo-rc.json b/test/templates/ci-cd/gradle-ng2-yarn/.yo-rc.json
index 758446a8ce..fd21bae5bc 100644
--- a/test/templates/ci-cd/gradle-ng2-yarn/.yo-rc.json
+++ b/test/templates/ci-cd/gradle-ng2-yarn/.yo-rc.json
@@ -5,8 +5,7 @@
     "packageName": "com.mycompany.myapp",
     "packageFolder": "com/mycompany/myapp",
     "authenticationType": "session",
-    "cacheProvider": "ehcache",
-    "enableHibernateCache": true,
+    "hibernateCache": "ehcache",
     "clusteredHttpSession": "no",
     "websocket": "no",
     "databaseType": "sql",
diff --git a/test/templates/ci-cd/maven-ng1-npm/.yo-rc.json b/test/templates/ci-cd/maven-ng1-npm/.yo-rc.json
index ba089e099f..74a69f7245 100644
--- a/test/templates/ci-cd/maven-ng1-npm/.yo-rc.json
+++ b/test/templates/ci-cd/maven-ng1-npm/.yo-rc.json
@@ -5,8 +5,7 @@
     "packageName": "com.mycompany.myapp",
     "packageFolder": "com/mycompany/myapp",
     "authenticationType": "session",
-    "cacheProvider": "ehcache",
-    "enableHibernateCache": true,
+    "hibernateCache": "ehcache",
     "clusteredHttpSession": "no",
     "websocket": "no",
     "databaseType": "sql",
diff --git a/test/templates/ci-cd/maven-ng1-yarn/.yo-rc.json b/test/templates/ci-cd/maven-ng1-yarn/.yo-rc.json
index ae3fbe17ea..d7f3fe4ea7 100644
--- a/test/templates/ci-cd/maven-ng1-yarn/.yo-rc.json
+++ b/test/templates/ci-cd/maven-ng1-yarn/.yo-rc.json
@@ -5,8 +5,7 @@
     "packageName": "com.mycompany.myapp",
     "packageFolder": "com/mycompany/myapp",
     "authenticationType": "session",
-    "cacheProvider": "ehcache",
-    "enableHibernateCache": true,
+    "hibernateCache": "ehcache",
     "clusteredHttpSession": "no",
     "websocket": "no",
     "databaseType": "sql",
diff --git a/test/templates/ci-cd/maven-ng2-npm/.yo-rc.json b/test/templates/ci-cd/maven-ng2-npm/.yo-rc.json
index a288188550..2852820b6c 100644
--- a/test/templates/ci-cd/maven-ng2-npm/.yo-rc.json
+++ b/test/templates/ci-cd/maven-ng2-npm/.yo-rc.json
@@ -5,8 +5,7 @@
     "packageName": "com.mycompany.myapp",
     "packageFolder": "com/mycompany/myapp",
     "authenticationType": "session",
-    "cacheProvider": "ehcache",
-    "enableHibernateCache": true,
+    "hibernateCache": "ehcache",
     "clusteredHttpSession": "no",
     "websocket": "no",
     "databaseType": "sql",
diff --git a/test/templates/ci-cd/maven-ng2-yarn/.yo-rc.json b/test/templates/ci-cd/maven-ng2-yarn/.yo-rc.json
index aeceebf260..421444d8ae 100644
--- a/test/templates/ci-cd/maven-ng2-yarn/.yo-rc.json
+++ b/test/templates/ci-cd/maven-ng2-yarn/.yo-rc.json
@@ -5,8 +5,7 @@
     "packageName": "com.mycompany.myapp",
     "packageFolder": "com/mycompany/myapp",
     "authenticationType": "session",
-    "cacheProvider": "ehcache",
-    "enableHibernateCache": true,
+    "hibernateCache": "ehcache",
     "clusteredHttpSession": "no",
     "websocket": "no",
     "databaseType": "sql",
diff --git a/test/templates/compose/01-gateway/.yo-rc.json b/test/templates/compose/01-gateway/.yo-rc.json
index 9053b0c1e5..57865a7f22 100644
--- a/test/templates/compose/01-gateway/.yo-rc.json
+++ b/test/templates/compose/01-gateway/.yo-rc.json
@@ -6,8 +6,7 @@
     "packageFolder": "com/mycompany/myapp",
     "serverPort": "8080",
     "authenticationType": "jwt",
-    "cacheProvider": "hazelcast",
-    "enableHibernateCache": true,
+    "hibernateCache": "hazelcast",
     "clusteredHttpSession": "no",
     "websocket": "no",
     "databaseType": "sql",
diff --git a/test/templates/compose/02-mysql/.yo-rc.json b/test/templates/compose/02-mysql/.yo-rc.json
index 8128b3871d..b365c2dacb 100644
--- a/test/templates/compose/02-mysql/.yo-rc.json
+++ b/test/templates/compose/02-mysql/.yo-rc.json
@@ -6,8 +6,7 @@
     "packageFolder": "com/mycompany/myapp",
     "serverPort": "8081",
     "authenticationType": "jwt",
-    "cacheProvider": "hazelcast",
-    "enableHibernateCache": true,
+    "hibernateCache": "hazelcast",
     "databaseType": "sql",
     "devDatabaseType": "h2Disk",
     "prodDatabaseType": "mysql",
diff --git a/test/templates/compose/03-psql/.yo-rc.json b/test/templates/compose/03-psql/.yo-rc.json
index 7383a7661f..98c2d77a83 100644
--- a/test/templates/compose/03-psql/.yo-rc.json
+++ b/test/templates/compose/03-psql/.yo-rc.json
@@ -6,8 +6,7 @@
     "packageFolder": "com/mycompany/myapp",
     "serverPort": "8081",
     "authenticationType": "jwt",
-    "cacheProvider": "hazelcast",
-    "enableHibernateCache": true,
+    "hibernateCache": "hazelcast",
     "databaseType": "sql",
     "devDatabaseType": "h2Disk",
     "prodDatabaseType": "postgresql",
diff --git a/test/templates/compose/04-mongo/.yo-rc.json b/test/templates/compose/04-mongo/.yo-rc.json
index ec74af6897..9d5125ebdf 100644
--- a/test/templates/compose/04-mongo/.yo-rc.json
+++ b/test/templates/compose/04-mongo/.yo-rc.json
@@ -6,8 +6,7 @@
     "packageFolder": "com/mycompany/myapp",
     "serverPort": "8081",
     "authenticationType": "jwt",
-    "cacheProvider": "no",
-    "enableHibernateCache": false,
+    "hibernateCache": "no",
     "databaseType": "mongodb",
     "devDatabaseType": "mongodb",
     "prodDatabaseType": "mongodb",
diff --git a/test/templates/compose/05-cassandra/.yo-rc.json b/test/templates/compose/05-cassandra/.yo-rc.json
index 592990b8b3..acdef3cf40 100644
--- a/test/templates/compose/05-cassandra/.yo-rc.json
+++ b/test/templates/compose/05-cassandra/.yo-rc.json
@@ -6,8 +6,7 @@
     "packageFolder": "com/mycompany/myapp",
     "serverPort": "8081",
     "authenticationType": "jwt",
-    "cacheProvider": "no",
-    "enableHibernateCache": false,
+    "hibernateCache": "no",
     "databaseType": "cassandra",
     "devDatabaseType": "cassandra",
     "prodDatabaseType": "cassandra",
diff --git a/test/templates/compose/06-uaa/.yo-rc.json b/test/templates/compose/06-uaa/.yo-rc.json
index f11675420b..d5b1246921 100644
--- a/test/templates/compose/06-uaa/.yo-rc.json
+++ b/test/templates/compose/06-uaa/.yo-rc.json
@@ -6,8 +6,7 @@
     "packageFolder": "com/mycompany/myapp",
     "serverPort": "8081",
     "authenticationType": "jwt",
-    "cacheProvider": "hazelcast",
-    "enableHibernateCache": true,
+    "hibernateCache": "hazelcast",
     "databaseType": "sql",
     "devDatabaseType": "h2Disk",
     "prodDatabaseType": "mysql",
diff --git a/test/templates/compose/07-mariadb/.yo-rc.json b/test/templates/compose/07-mariadb/.yo-rc.json
index 74c90510c3..bf6a41fd0a 100644
--- a/test/templates/compose/07-mariadb/.yo-rc.json
+++ b/test/templates/compose/07-mariadb/.yo-rc.json
@@ -6,8 +6,7 @@
     "packageFolder": "com/mycompany/myapp",
     "serverPort": "8081",
     "authenticationType": "jwt",
-    "cacheProvider": "hazelcast",
-    "enableHibernateCache": true,
+    "hibernateCache": "hazelcast",
     "databaseType": "sql",
     "devDatabaseType": "h2Disk",
     "prodDatabaseType": "mariadb",
diff --git a/test/templates/compose/08-monolith/.yo-rc.json b/test/templates/compose/08-monolith/.yo-rc.json
index 07e26e1724..c975011d68 100644
--- a/test/templates/compose/08-monolith/.yo-rc.json
+++ b/test/templates/compose/08-monolith/.yo-rc.json
@@ -5,8 +5,7 @@
     "packageName": "com.mycompany.myapp",
     "packageFolder": "com/mycompany/myapp",
     "authenticationType": "session",
-    "cacheProvider": "ehcache",
-    "enableHibernateCache": true,
+    "hibernateCache": "ehcache",
     "clusteredHttpSession": false,
     "websocket": false,
     "databaseType": "sql",
diff --git a/test/templates/compose/09-kafka/.yo-rc.json b/test/templates/compose/09-kafka/.yo-rc.json
index f5e8195047..e5054aa798 100644
--- a/test/templates/compose/09-kafka/.yo-rc.json
+++ b/test/templates/compose/09-kafka/.yo-rc.json
@@ -6,8 +6,7 @@
         "packageFolder": "com/mycompany/myapp",
         "serverPort": "8080",
         "authenticationType": "session",
-        "cacheProvider": "ehcache",
-        "enableHibernateCache": true,
+        "hibernateCache": "ehcache",
         "clusteredHttpSession": false,
         "websocket": false,
         "databaseType": "sql",
diff --git a/test/templates/compose/10-couchbase/.yo-rc.json b/test/templates/compose/10-couchbase/.yo-rc.json
index 07e9e32930..78446a373f 100644
--- a/test/templates/compose/10-couchbase/.yo-rc.json
+++ b/test/templates/compose/10-couchbase/.yo-rc.json
@@ -6,8 +6,7 @@
     "packageFolder": "com/mycompany/myapp",
     "serverPort": "8081",
     "authenticationType": "jwt",
-    "cacheProvider": "no",
-    "enableHibernateCache": false,
+    "hibernateCache": "no",
     "databaseType": "couchbase",
     "devDatabaseType": "couchbase",
     "prodDatabaseType": "couchbase",
diff --git a/test/templates/default-ng2/.yo-rc.json b/test/templates/default-ng2/.yo-rc.json
index bde79f9ff6..f016f95a0b 100644
--- a/test/templates/default-ng2/.yo-rc.json
+++ b/test/templates/default-ng2/.yo-rc.json
@@ -5,8 +5,7 @@
     "packageName": "com.mycompany.myapp",
     "packageFolder": "com/mycompany/myapp",
     "authenticationType": "session",
-    "cacheProvider": "ehcache",
-    "enableHibernateCache": true,
+    "hibernateCache": "ehcache",
     "clusteredHttpSession": "no",
     "websocket": "no",
     "databaseType": "sql",
diff --git a/test/templates/default/.yo-rc.json b/test/templates/default/.yo-rc.json
index 835cc03062..9cdcdbf7ee 100644
--- a/test/templates/default/.yo-rc.json
+++ b/test/templates/default/.yo-rc.json
@@ -5,7 +5,7 @@
     "packageName": "com.mycompany.myapp",
     "packageFolder": "com/mycompany/myapp",
     "authenticationType": "session",
-    "cacheProvider": "ehcache",
+    "hibernateCache": "ehcache",
     "clusteredHttpSession": "no",
     "websocket": "no",
     "databaseType": "sql",
diff --git a/test/templates/export-jdl/.yo-rc.json b/test/templates/export-jdl/.yo-rc.json
index 21e13a17c9..71296b00d3 100644
--- a/test/templates/export-jdl/.yo-rc.json
+++ b/test/templates/export-jdl/.yo-rc.json
@@ -6,8 +6,7 @@
     "packageFolder": "com/mycompany/myapp",
     "serverPort": "8080",
     "authenticationType": "session",
-    "cacheProvider": "ehcache",
-    "enableHibernateCache": true,
+    "hibernateCache": "ehcache",
     "clusteredHttpSession": false,
     "websocket": false,
     "databaseType": "sql",
diff --git a/test/templates/import-jdl/.yo-rc.json b/test/templates/import-jdl/.yo-rc.json
index 18819d0ecc..dbde389329 100644
--- a/test/templates/import-jdl/.yo-rc.json
+++ b/test/templates/import-jdl/.yo-rc.json
@@ -5,8 +5,7 @@
     "packageName": "com.mycompany.myapp",
     "packageFolder": "com/mycompany/myapp",
     "authenticationType": "session",
-    "cacheProvider": "ehcache",
-    "enableHibernateCache": true,
+    "hibernateCache": "ehcache",
     "clusteredHttpSession": "no",
     "websocket": "no",
     "databaseType": "sql",
diff --git a/test/templates/noi18n/.yo-rc.json b/test/templates/noi18n/.yo-rc.json
index f8eedfaddc..285c8f58b1 100644
--- a/test/templates/noi18n/.yo-rc.json
+++ b/test/templates/noi18n/.yo-rc.json
@@ -6,8 +6,7 @@
     "packageFolder": "com/mycompany/myapp",
     "clientFramework": "angularX",
     "authenticationType": "session",
-    "cacheProvider": "hazelcast",
-    "enableHibernateCache": true,
+    "hibernateCache": "hazelcast",
     "clusteredHttpSession": "no",
     "websocket": "yes",
     "databaseType": "sql",
diff --git a/test/templates/social/.yo-rc.json b/test/templates/social/.yo-rc.json
index 73d613b04b..c3059c36eb 100644
--- a/test/templates/social/.yo-rc.json
+++ b/test/templates/social/.yo-rc.json
@@ -5,8 +5,7 @@
     "packageName": "com.mycompany.myapp",
     "packageFolder": "com/mycompany/myapp",
     "authenticationType": "session",
-    "cacheProvider": "ehcache",
-    "enableHibernateCache": true,  
+    "hibernateCache": "ehcache",
     "clusteredHttpSession": "no",
     "websocket": "no",
     "databaseType": "sql",
diff --git a/test/templates/uaaserver/uaa/.yo-rc.json b/test/templates/uaaserver/uaa/.yo-rc.json
index 239abe3c48..d0a6737e35 100644
--- a/test/templates/uaaserver/uaa/.yo-rc.json
+++ b/test/templates/uaaserver/uaa/.yo-rc.json
@@ -6,8 +6,7 @@
     "packageFolder": "com/mycompany/myapp",
     "serverPort": "9999",
     "authenticationType": "uaa",
-    "cacheProvider": "hazelcast",
-    "enableHibernateCache": true,
+    "hibernateCache": "hazelcast",
     "databaseType": "sql",
     "devDatabaseType": "h2Disk",
     "prodDatabaseType": "mysql",