Repository: jhipster/generator-jhipster
Pull request #9885 (2019-06-10 18:26:04)

CICD: set NG_CLI_ANALYTICS to false
-   Please make sure the below checklist is followed for Pull Requests.

-   [ ] [Travis tests](https://travis-ci.org/jhipster/generator-jhipster/pull_requests) are green
-   [ ] Tests are added where necessary
-   [ ] Documentation is added/updated where necessary
-   [ ] Coding Rules & Commit Guidelines as per our [CONTRIBUTING.md document](https://github.com/jhipster/generator-jhipster/blob/master/CONTRIBUTING.md) are followed

<!--
Please also reference the issue number in a commit message to [automatically close the related Github issue](https://help.github.com/articles/closing-issues-via-commit-messages/)

Note: It is also possible to add `[skip ci]` to your commit message to skip Travis tests
-->



Patch:
diff --git a/generators/ci-cd/templates/.gitlab-ci.yml.ejs b/generators/ci-cd/templates/.gitlab-ci.yml.ejs
index 2028d617a6..240b0eee42 100644
--- a/generators/ci-cd/templates/.gitlab-ci.yml.ejs
+++ b/generators/ci-cd/templates/.gitlab-ci.yml.ejs
@@ -42,6 +42,7 @@ stages:
 
 <%_ if (buildTool === 'gradle') { _%>
 before_script:
+    - export NG_CLI_ANALYTICS="false"
     - export GRADLE_USER_HOME=`pwd`/.gradle
     <%_ if (!skipClient) { _%>
     - ./gradlew <%= clientPackageManager %>_install -PnodeInstall --no-daemon
@@ -143,6 +144,7 @@ deploy-to-production:
 
 <%_ if (buildTool === 'maven') { _%>
 before_script:
+    - export NG_CLI_ANALYTICS="false"
     - export MAVEN_USER_HOME=`pwd`/.maven
     <%_ if (!skipClient) { _%>
         <%_ if (clientPackageManager === 'yarn') { _%>
diff --git a/generators/ci-cd/templates/azure-pipelines.yml.ejs b/generators/ci-cd/templates/azure-pipelines.yml.ejs
index dd7be02f5b..1e97ed26c9 100644
--- a/generators/ci-cd/templates/azure-pipelines.yml.ejs
+++ b/generators/ci-cd/templates/azure-pipelines.yml.ejs
@@ -25,6 +25,7 @@ jobs:
     SPRING_OUTPUT_ANSI_ENABLED: NEVER
     SPRING_JPA_SHOW_SQL: false
     JHI_DISABLE_WEBPACK_LOGS: true
+    NG_CLI_ANALYTICS: "false"
 
   steps:
   #----------------------------------------------------------------------
diff --git a/generators/ci-cd/templates/travis.yml.ejs b/generators/ci-cd/templates/travis.yml.ejs
index 0a1276030b..e03feaf901 100644
--- a/generators/ci-cd/templates/travis.yml.ejs
+++ b/generators/ci-cd/templates/travis.yml.ejs
@@ -44,6 +44,7 @@ env:
     - SPRING_OUTPUT_ANSI_ENABLED=ALWAYS
     - SPRING_JPA_SHOW_SQL=false
     - JHI_DISABLE_WEBPACK_LOGS=true
+    - NG_CLI_ANALYTICS="false"
 before_install:
   - jdk_switcher use oraclejdk8
   - java -version
diff --git a/generators/entity-server/templates/src/main/java/package/domain/Entity.java.ejs b/generators/entity-server/templates/src/main/java/package/domain/Entity.java.ejs
index 395ead62d9..e268418334 100644
--- a/generators/entity-server/templates/src/main/java/package/domain/Entity.java.ejs
+++ b/generators/entity-server/templates/src/main/java/package/domain/Entity.java.ejs
@@ -32,7 +32,7 @@ const uniqueEnums = {}; %><%- include imports -%>
             break;
         }
         isUsingMapsId = false;
-    } 
+    }
     for (idx in fields) {
         if ((prodDatabaseType === 'postgresql' || devDatabaseType === 'postgresql') && fields[idx].fieldTypeBlobContent === 'text') {
             hasTextBlob = true;
@@ -56,7 +56,7 @@ import io.swagger.annotations.ApiModelProperty;
 <%_ } if (enableHibernateCache) { _%>
 import org.hibernate.annotations.Cache;
 import org.hibernate.annotations.CacheConcurrencyStrategy;
-<%_ } if (hasTextBlob === true) { _%>
+<%_ } if (hasTextBlob === true || (fieldsContainUUID === true && ['mysql', 'mariadb'].includes(prodDatabaseType))) { _%>
 import org.hibernate.annotations.Type;
 <%_ } if (databaseType === 'mongodb') { _%>
 import org.springframework.data.annotation.Id;
@@ -106,7 +106,7 @@ import java.util.Objects;
 <%_ if (databaseType === 'couchbase' && hasRelationship) { _%>
 import java.util.stream.Collectors;
 <%_ } _%>
-<%_ if (databaseType === 'cassandra') { _%>
+<%_ if (databaseType === 'cassandra' || fieldsContainUUID === true) { _%>
 import java.util.UUID;
 <%_ }
 Object.keys(uniqueEnums).forEach(function(element) { _%>
@@ -216,6 +216,9 @@ public class <%= asEntity(entityClass) %> implements Serializable {
     @Column(name = "<%-fieldNameAsDatabaseColumn %>"<% if (required) { %>, nullable = false<% } %><% if (unique) { %>, unique = true<% } %>)
         <%_ } else if (fieldType === 'BigDecimal') { _%>
     @Column(name = "<%-fieldNameAsDatabaseColumn %>", precision = 21, scale = 2<% if (required) { %>, nullable = false<% } %><% if (unique) { %>, unique = true<% } %>)
+        <%_ } else if (fieldType === 'UUID' && ['mysql', 'mariadb'].includes(prodDatabaseType)) { _%>
+    @Type(type = "uuid-char")
+    @Column(name = "<%-fieldNameAsDatabaseColumn %>", length = 36<% if (required) { %>, nullable = false<% } %><% if (unique) { %>, unique = true<% } %>)
         <%_ } else { _%>
     @Column(name = "<%-fieldNameAsDatabaseColumn %>"<% if (fieldValidate === true) { %><% if (fieldValidateRules.includes('maxlength')) { %>, length = <%= fieldValidateRulesMaxlength %><% } %><% if (required) { %>, nullable = false<% } %><% if (unique) { %>, unique = true<% } %><% } %>)
         <%_ }
diff --git a/generators/entity-server/templates/src/main/java/package/service/dto/EntityCriteria.java.ejs b/generators/entity-server/templates/src/main/java/package/service/dto/EntityCriteria.java.ejs
index 987d082d65..e5f3040f44 100644
--- a/generators/entity-server/templates/src/main/java/package/service/dto/EntityCriteria.java.ejs
+++ b/generators/entity-server/templates/src/main/java/package/service/dto/EntityCriteria.java.ejs
@@ -1,9 +1,6 @@
 package <%= packageName %>.service.dto;
 
 import java.io.Serializable;
-<%_ if (fieldsContainDuration === true) { _%>
-import java.time.Duration;
-<%_ } _%>
 import java.util.Objects;
 import io.github.jhipster.service.Criteria;
 <%_ for (idx in fields) { if (fields[idx].fieldIsEnum === true) { _%>
@@ -19,14 +16,17 @@ import io.github.jhipster.service.filter.StringFilter;
 <%_ if (fieldsContainBigDecimal === true) { _%>
 import io.github.jhipster.service.filter.BigDecimalFilter;
 <%_ } _%>
+<%_ if (fieldsContainDuration === true) { _%>
+import io.github.jhipster.service.filter.DurationFilter;
+<%_ } _%>
 <%_ if (fieldsContainInstant === true) { _%>
 import io.github.jhipster.service.filter.InstantFilter;
 <%_ } _%>
 <%_ if (fieldsContainLocalDate === true) { _%>
 import io.github.jhipster.service.filter.LocalDateFilter;
 <%_ } _%>
-<%_ if (fieldsContainDuration === true) { _%>
-import io.github.jhipster.service.filter.RangeFilter;
+<%_ if (fieldsContainUUID === true) { _%>
+import io.github.jhipster.service.filter.UUIDFilter;
 <%_ } _%>
 <%_ if (fieldsContainZonedDateTime === true) { _%>
 import io.github.jhipster.service.filter.ZonedDateTimeFilter;
@@ -42,8 +42,8 @@ import io.github.jhipster.service.filter.ZonedDateTimeFilter;
       var filterType;
       if (field.fieldIsEnum == true) {
         filterType = fieldType + 'Filter';
-        extraFilters[fieldType] = {type : filterType, superType: 'Filter<' + fieldType + '>', fieldType:fieldType};
-      } else if (['Duration', 'LocalDate', 'ZonedDateTime', 'Instant', 'String', 'Long', 'Integer', 'Float', 'Double', 'BigDecimal', 'Boolean'].includes(fieldType)) {
+        extraFilters[fieldType] = {type: filterType, superType: 'Filter<' + fieldType + '>', fieldType: fieldType};
+      } else if (['Duration', 'UUID', 'LocalDate', 'ZonedDateTime', 'Instant', 'String', 'Long', 'Integer', 'Float', 'Double', 'BigDecimal', 'Boolean'].includes(fieldType)) {
         filterType = fieldType + 'Filter';
       } else {
         filterType = 'Filter<' + fieldType + '>';
@@ -54,9 +54,6 @@ import io.github.jhipster.service.filter.ZonedDateTimeFilter;
             fieldInJavaBeanMethod: field.fieldInJavaBeanMethod });
     }
   });
-  if (fieldsContainDuration === true) {
-    extraFilters['java.time.Duration'] = {type : 'DurationFilter', superType: 'RangeFilter<Duration>', fieldType: 'Duration'};
-  }
   relationships.forEach((relationship) => {
     const relationshipType = relationship.relationshipType;
     // user has a String PK when using OAuth, so change relationships accordingly
diff --git a/generators/entity-server/templates/src/main/java/package/service/dto/EntityDTO.java.ejs b/generators/entity-server/templates/src/main/java/package/service/dto/EntityDTO.java.ejs
index 1ab8ce615b..8107a8804b 100644
--- a/generators/entity-server/templates/src/main/java/package/service/dto/EntityDTO.java.ejs
+++ b/generators/entity-server/templates/src/main/java/package/service/dto/EntityDTO.java.ejs
@@ -55,7 +55,7 @@ import java.util.HashSet;
 import java.util.Set;
 <%_ } _%>
 import java.util.Objects;
-<%_ if (databaseType === 'cassandra') { _%>
+<%_ if (databaseType === 'cassandra' || fieldsContainUUID === true) { _%>
 import java.util.UUID;
 <%_ } _%>
 <%_ if (fieldsContainBlob && databaseType === 'sql') { _%>
diff --git a/generators/entity-server/templates/src/main/resources/config/liquibase/changelog/added_entity.xml.ejs b/generators/entity-server/templates/src/main/resources/config/liquibase/changelog/added_entity.xml.ejs
index ecf15cd1c8..631dd60280 100644
--- a/generators/entity-server/templates/src/main/resources/config/liquibase/changelog/added_entity.xml.ejs
+++ b/generators/entity-server/templates/src/main/resources/config/liquibase/changelog/added_entity.xml.ejs
@@ -84,6 +84,8 @@
                 columnType="datetime";
             } else if (fieldType === 'Duration') {
                 columnType="bigint";
+            } else if (fieldType === 'UUID') {
+                columnType="${uuidType}";
             } else if (fieldType === 'byte[]' && fieldTypeBlobContent !== 'text') {
                 if (prodDatabaseType === 'mysql' || prodDatabaseType === 'postgresql' || prodDatabaseType === 'mariadb') {
                     columnType="longblob";
@@ -162,16 +164,17 @@
         <loadData
                   file="config/liquibase/data/<%= entityTableName %>.csv"
                   separator=";"
-                  tableName="<%= entityTableName %>"
-                  context="dev">
+                  tableName="<%= entityTableName %>">
             <column name="id" type="numeric"/>
             <%_ for (idx in fields) {
                 let loadColumnType = 'string';
                 let columnType = fields[idx].columnType;
                 if (columnType === 'integer' || columnType === 'bigint' || columnType === 'double' || columnType === 'decimal(21,2)' || columnType === '${floatType}') {
                     loadColumnType = 'numeric';
-                } else if (columnType === 'date' || columnType === 'datetime') {
+                } else if (columnType === 'date') {
                     loadColumnType = 'date';
+                } else if (columnType === 'datetime') {
+                    loadColumnType = 'datetime';
                 } else if (columnType === 'boolean') {
                     loadColumnType = 'boolean';
                 } else if (fields[idx].fieldIsEnum) {
diff --git a/generators/entity-server/templates/src/main/resources/config/liquibase/data/table.csv.ejs b/generators/entity-server/templates/src/main/resources/config/liquibase/data/table.csv.ejs
index d5d222f967..d5866c3d99 100644
--- a/generators/entity-server/templates/src/main/resources/config/liquibase/data/table.csv.ejs
+++ b/generators/entity-server/templates/src/main/resources/config/liquibase/data/table.csv.ejs
@@ -82,9 +82,13 @@ for (lineNb = 1; lineNb <= numberOfRows; lineNb++) {
                 max: fields[idx].fieldValidateRulesMax ? parseFloat(fields[idx].fieldValidateRulesMax) : undefined,
                 min: fields[idx].fieldValidateRulesMin ? parseFloat(fields[idx].fieldValidateRulesMin) : undefined
             });
+        } else if (columnType === '${uuidType}') {
+            data = this.faker.random.uuid();
         } else if (columnType === 'boolean') {
             data = this.faker.random.boolean();
-        } else if (columnType === 'date' || columnType === 'datetime') {
+        } else if (columnType === 'date') {
+            data = this.faker.date.recent().toISOString().split('T')[0];
+        } else if (columnType === 'datetime') {
             // Write the date without milliseconds so Java can parse it
             // See https://stackoverflow.com/a/34053802/150868
             data = this.faker.date.recent().toISOString().split('.')[0];
diff --git a/generators/entity/index.js b/generators/entity/index.js
index 6ee1deaf71..e840a8406f 100644
--- a/generators/entity/index.js
+++ b/generators/entity/index.js
@@ -685,6 +685,7 @@ class EntityGenerator extends BaseBlueprintGenerator {
 
                 context.fieldsContainDate = false;
                 context.fieldsContainInstant = false;
+                context.fieldsContainUUID = false;
                 context.fieldsContainZonedDateTime = false;
                 context.fieldsContainDuration = false;
                 context.fieldsContainLocalDate = false;
@@ -731,6 +732,7 @@ class EntityGenerator extends BaseBlueprintGenerator {
                         'Instant',
                         'ZonedDateTime',
                         'Duration',
+                        'UUID',
                         'Boolean',
                         'byte[]',
                         'ByteBuffer'
@@ -816,6 +818,8 @@ class EntityGenerator extends BaseBlueprintGenerator {
                         context.fieldsContainDate = true;
                     } else if (fieldType === 'BigDecimal') {
                         context.fieldsContainBigDecimal = true;
+                    } else if (fieldType === 'UUID') {
+                        context.fieldsContainUUID = true;
                     } else if (fieldType === 'byte[]' || fieldType === 'ByteBuffer') {
                         context.blobFields.push(field);
                         context.fieldsContainBlob = true;
diff --git a/generators/entity/prompts.js b/generators/entity/prompts.js
index 4ceb3a8b50..4196fcfbf7 100644
--- a/generators/entity/prompts.js
+++ b/generators/entity/prompts.js
@@ -533,6 +533,10 @@ function askForField(done) {
                     value: 'enum',
                     name: 'Enumeration (Java enum type)'
                 },
+                {
+                    value: 'UUID',
+                    name: 'UUID'
+                },
                 {
                     value: 'byte[]',
                     name: '[BETA] Blob'
diff --git a/generators/server/templates/src/main/java/package/config/DatabaseConfiguration.java.ejs b/generators/server/templates/src/main/java/package/config/DatabaseConfiguration.java.ejs
index 2f67bc75d1..4377e9e76e 100644
--- a/generators/server/templates/src/main/java/package/config/DatabaseConfiguration.java.ejs
+++ b/generators/server/templates/src/main/java/package/config/DatabaseConfiguration.java.ejs
@@ -116,6 +116,7 @@ import java.time.ZonedDateTime;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
+import java.util.UUID;
 <%_ } _%>
 
 @Configuration
@@ -244,6 +245,8 @@ public class DatabaseConfiguration {
         converters.add(BigDecimalToStringConverter.INSTANCE);
         converters.add(StringToBigDecimalConverter.INSTANCE);
         converters.add(StringToByteConverter.INSTANCE);
+        converters.add(UUIDToStringConverter.INSTANCE);
+        converters.add(StringToUUIDConverter.INSTANCE);
         return new CouchbaseCustomConversions(converters);
     }
 
@@ -344,5 +347,34 @@ public class DatabaseConfiguration {
             return Base64.decodeBase64(source);
         }
     }
+
+    /**
+    * Simple singleton to convert {@link UUID}s to their {@link String} representation.
+    */
+    @WritingConverter
+    public enum UUIDToStringConverter implements Converter<UUID, String> {
+
+        INSTANCE;
+
+        @Override
+        public String convert(UUID source) {
+            return source == null ? null : source.toString();
+        }
+    }
+
+    /**
+    * Simple singleton to convert from {@link String} {@link UUID} representation.
+    */
+    @ReadingConverter
+    public enum StringToUUIDConverter implements Converter<String, UUID> {
+
+        INSTANCE;
+
+        @Override
+        public UUID convert(String source) {
+            return source == null ? null : UUID.fromString(source);
+        }
+
+    }
 <%_ } _%>
 }
diff --git a/generators/server/templates/src/main/resources/config/liquibase/master.xml.ejs b/generators/server/templates/src/main/resources/config/liquibase/master.xml.ejs
index 6b1cb2f1df..0e301055fc 100644
--- a/generators/server/templates/src/main/resources/config/liquibase/master.xml.ejs
+++ b/generators/server/templates/src/main/resources/config/liquibase/master.xml.ejs
@@ -20,13 +20,17 @@
 
     <property name="floatType" value="float4" dbms="postgresql, h2"/>
     <property name="floatType" value="float" dbms="mysql, oracle, mssql, mariadb"/>
-    <%_ if (prodDatabaseType === 'postgresql' || devDatabaseType === 'postgresql') { _%>
+    <%_ if (prodDatabaseType === 'postgresql') { _%>
     <property name="clobType" value="longvarchar" dbms="h2"/>
     <%_ } else { _%>
     <property name="clobType" value="clob" dbms="h2"/>
     <%_ } _%>
-    
     <property name="clobType" value="clob" dbms="mysql, oracle, mssql, mariadb, postgresql"/>
+    <%_ if (prodDatabaseType === 'mysql' || prodDatabaseType === 'mariadb') { _%>
+    <property name="uuidType" value="varchar(36)" dbms="h2, <%= prodDatabaseType %>"/>
+    <%_ } else { _%>
+    <property name="uuidType" value="uuid" dbms="h2, <%= prodDatabaseType %>"/>
+    <%_ } _%>
 
     <include file="config/liquibase/changelog/00000000000000_initial_schema.xml" relativeToChangelogFile="false"/>
     <!-- jhipster-needle-liquibase-add-changelog - JHipster will add liquibase changelogs here -->
diff --git a/package-lock.json b/package-lock.json
index 55a47040e4..9d859d5389 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -568,9 +568,9 @@
             "dev": true
         },
         "chevrotain": {
-            "version": "4.3.3",
-            "resolved": "https://registry.npmjs.org/chevrotain/-/chevrotain-4.3.3.tgz",
-            "integrity": "sha512-DsmAmF5urXboHHXqEr26Ot//S+l3yrOr7UwwgWQ+aNNlYpmnYK1flxplwJ5cIUgP9toKFsJ0VeLT1sq350A9Hg==",
+            "version": "4.4.0",
+            "resolved": "https://registry.npmjs.org/chevrotain/-/chevrotain-4.4.0.tgz",
+            "integrity": "sha512-CS0auzIhlLxo9RCVarVZJIsKj339jJrLIdCbX3rwk/kTu7+VkYdiXiAD8aJOXJEcRc1GGcbOQ587e/85+xLxaA==",
             "requires": {
                 "regexp-to-ast": "0.4.0"
             }
@@ -2689,11 +2689,11 @@
             }
         },
         "jhipster-core": {
-            "version": "3.6.14",
-            "resolved": "https://registry.npmjs.org/jhipster-core/-/jhipster-core-3.6.14.tgz",
-            "integrity": "sha512-X8rQ1hPXMaj9ri4QvbGyUmbMOAsLn2dbJQH14dE/A/4HBT+ODBu83ptQCLXtSmysumyqgHrOiHiLVYa3Qq74rg==",
+            "version": "4.0.0",
+            "resolved": "https://registry.npmjs.org/jhipster-core/-/jhipster-core-4.0.0.tgz",
+            "integrity": "sha512-lxcdMzqgbsdvHnEDnluiXShG5vooMts+jlmY/Op6s3BmkAeu5IhgTNCt1yZRA66O2RuFRv8kmJ8ySlWw2+bwfQ==",
             "requires": {
-                "chevrotain": "4.3.3",
+                "chevrotain": "4.4.0",
                 "fs-extra": "8.0.1",
                 "lodash": "4.17.11",
                 "winston": "3.2.1"
@@ -5331,9 +5331,9 @@
             },
             "dependencies": {
                 "readable-stream": {
-                    "version": "3.3.0",
-                    "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.3.0.tgz",
-                    "integrity": "sha512-EsI+s3k3XsW+fU8fQACLN59ky34AZ14LoeVZpYwmZvldCFo0r0gnelwF2TcMjLor/BTL5aDJVBMkss0dthToPw==",
+                    "version": "3.4.0",
+                    "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.4.0.tgz",
+                    "integrity": "sha512-jItXPLmrSR8jmTRmRWJXCnGJsfy85mB3Wd/uINMXA65yrnFo0cPClFIUWzo2najVNSl+mx7/4W8ttlLWJe99pQ==",
                     "requires": {
                         "inherits": "^2.0.3",
                         "string_decoder": "^1.1.1",
diff --git a/package.json b/package.json
index f971d1c250..160d496b93 100644
--- a/package.json
+++ b/package.json
@@ -59,7 +59,7 @@
         "glob": "7.1.3",
         "gulp-filter": "5.1.0",
         "insight": "0.10.1",
-        "jhipster-core": "3.6.14",
+        "jhipster-core": "4.0.0",
         "js-object-pretty-print": "0.3.0",
         "js-yaml": "3.13.1",
         "lodash": "4.17.11",


Test patch:
diff --git a/generators/entity-server/templates/src/test/java/package/web/rest/EntityResourceIT.java.ejs b/generators/entity-server/templates/src/test/java/package/web/rest/EntityResourceIT.java.ejs
index b03e1a95e7..0671bbe960 100644
--- a/generators/entity-server/templates/src/test/java/package/web/rest/EntityResourceIT.java.ejs
+++ b/generators/entity-server/templates/src/test/java/package/web/rest/EntityResourceIT.java.ejs
@@ -129,7 +129,7 @@ import java.util.ArrayList;
 import java.util.Collections;
 <%_ } _%>
 import java.util.List;
-<%_ if (databaseType === 'cassandra') { _%>
+<%_ if (databaseType === 'cassandra' || fieldsContainUUID === true) { _%>
 import java.util.UUID;
 <%_ } _%>
 <%_ if (databaseType === 'couchbase') { _%>
diff --git a/test-integration/samples/.jhipster/BankAccount.json b/test-integration/samples/.jhipster/BankAccount.json
index bf556dbd1f..b9133f7b36 100644
--- a/test-integration/samples/.jhipster/BankAccount.json
+++ b/test-integration/samples/.jhipster/BankAccount.json
@@ -22,6 +22,10 @@
                 "required"
             ]
         },
+        {
+            "fieldName": "guid",
+            "fieldType": "UUID"
+        },
         {
             "fieldName": "bankNumber",
             "fieldType": "Integer"
diff --git a/test-integration/samples/.jhipster/FieldTestEntity.json b/test-integration/samples/.jhipster/FieldTestEntity.json
index 0635b10132..59d3ef4d33 100644
--- a/test-integration/samples/.jhipster/FieldTestEntity.json
+++ b/test-integration/samples/.jhipster/FieldTestEntity.json
@@ -233,6 +233,17 @@
                 "required"
             ]
         },
+        {
+            "fieldName": "uuidTom",
+            "fieldType": "UUID"
+        },
+        {
+            "fieldName": "uuidRequiredTom",
+            "fieldType": "UUID",
+            "fieldValidateRules": [
+                "required"
+            ]
+        },
         {
             "fieldName": "byteImageTom",
             "fieldType": "byte[]",
diff --git a/test-integration/samples/.jhipster/FieldTestInfiniteScrollEntity.json b/test-integration/samples/.jhipster/FieldTestInfiniteScrollEntity.json
index 01c015e5e8..519575cf64 100644
--- a/test-integration/samples/.jhipster/FieldTestInfiniteScrollEntity.json
+++ b/test-integration/samples/.jhipster/FieldTestInfiniteScrollEntity.json
@@ -198,6 +198,17 @@
                 "required"
             ]
         },
+        {
+            "fieldName": "durationHugo",
+            "fieldType": "Duration"
+        },
+        {
+            "fieldName": "durationRequiredHugo",
+            "fieldType": "Duration",
+            "fieldValidateRules": [
+                "required"
+            ]
+        },
         {
             "fieldName": "booleanHugo",
             "fieldType": "Boolean"
@@ -222,6 +233,17 @@
                 "required"
             ]
         },
+        {
+            "fieldName": "uuidHugo",
+            "fieldType": "UUID"
+        },
+        {
+            "fieldName": "uuidRequiredHugo",
+            "fieldType": "UUID",
+            "fieldValidateRules": [
+                "required"
+            ]
+        },
         {
             "fieldName": "byteImageHugo",
             "fieldType": "byte[]",
diff --git a/test-integration/samples/.jhipster/FieldTestMapstructEntity.json b/test-integration/samples/.jhipster/FieldTestMapstructEntity.json
index 6fd3a8e189..22ca066141 100644
--- a/test-integration/samples/.jhipster/FieldTestMapstructEntity.json
+++ b/test-integration/samples/.jhipster/FieldTestMapstructEntity.json
@@ -198,6 +198,17 @@
                 "required"
             ]
         },
+        {
+            "fieldName": "durationEva",
+            "fieldType": "Duration"
+        },
+        {
+            "fieldName": "durationRequiredEva",
+            "fieldType": "Duration",
+            "fieldValidateRules": [
+                "required"
+            ]
+        },
         {
             "fieldName": "booleanEva",
             "fieldType": "Boolean"
@@ -222,6 +233,17 @@
                 "required"
             ]
         },
+        {
+            "fieldName": "uuidEva",
+            "fieldType": "UUID"
+        },
+        {
+            "fieldName": "uuidRequiredEva",
+            "fieldType": "UUID",
+            "fieldValidateRules": [
+                "required"
+            ]
+        },
         {
             "fieldName": "byteImageEva",
             "fieldType": "byte[]",
diff --git a/test-integration/samples/.jhipster/FieldTestPagerEntity.json b/test-integration/samples/.jhipster/FieldTestPagerEntity.json
index d73cb22f85..ae8b6367e8 100644
--- a/test-integration/samples/.jhipster/FieldTestPagerEntity.json
+++ b/test-integration/samples/.jhipster/FieldTestPagerEntity.json
@@ -198,6 +198,17 @@
                 "required"
             ]
         },
+        {
+            "fieldName": "durationJade",
+            "fieldType": "Duration"
+        },
+        {
+            "fieldName": "durationRequiredJade",
+            "fieldType": "Duration",
+            "fieldValidateRules": [
+                "required"
+            ]
+        },
         {
             "fieldName": "booleanJade",
             "fieldType": "Boolean"
@@ -222,6 +233,17 @@
                 "required"
             ]
         },
+        {
+            "fieldName": "uuidJade",
+            "fieldType": "UUID"
+        },
+        {
+            "fieldName": "uuidRequiredJade",
+            "fieldType": "UUID",
+            "fieldValidateRules": [
+                "required"
+            ]
+        },
         {
             "fieldName": "byteImageJade",
             "fieldType": "byte[]",
diff --git a/test-integration/samples/.jhipster/FieldTestPaginationEntity.json b/test-integration/samples/.jhipster/FieldTestPaginationEntity.json
index db9bb53efa..4fdeda9f0c 100644
--- a/test-integration/samples/.jhipster/FieldTestPaginationEntity.json
+++ b/test-integration/samples/.jhipster/FieldTestPaginationEntity.json
@@ -198,6 +198,17 @@
                 "required"
             ]
         },
+        {
+            "fieldName": "durationAlice",
+            "fieldType": "Duration"
+        },
+        {
+            "fieldName": "durationRequiredAlice",
+            "fieldType": "Duration",
+            "fieldValidateRules": [
+                "required"
+            ]
+        },
         {
             "fieldName": "booleanAlice",
             "fieldType": "Boolean"
@@ -222,6 +233,17 @@
                 "required"
             ]
         },
+        {
+            "fieldName": "uuidAlice",
+            "fieldType": "UUID"
+        },
+        {
+            "fieldName": "uuidRequiredAlice",
+            "fieldType": "UUID",
+            "fieldValidateRules": [
+                "required"
+            ]
+        },
         {
             "fieldName": "byteImageAlice",
             "fieldType": "byte[]",
diff --git a/test-integration/samples/.jhipster/FieldTestServiceClassEntity.json b/test-integration/samples/.jhipster/FieldTestServiceClassEntity.json
index cb3e761f65..5666a7feb1 100644
--- a/test-integration/samples/.jhipster/FieldTestServiceClassEntity.json
+++ b/test-integration/samples/.jhipster/FieldTestServiceClassEntity.json
@@ -198,6 +198,17 @@
                 "required"
             ]
         },
+        {
+            "fieldName": "durationBob",
+            "fieldType": "Duration"
+        },
+        {
+            "fieldName": "durationRequiredBob",
+            "fieldType": "Duration",
+            "fieldValidateRules": [
+                "required"
+            ]
+        },
         {
             "fieldName": "booleanBob",
             "fieldType": "Boolean"
@@ -222,6 +233,17 @@
                 "required"
             ]
         },
+        {
+            "fieldName": "uuidBob",
+            "fieldType": "UUID"
+        },
+        {
+            "fieldName": "uuidRequiredBob",
+            "fieldType": "UUID",
+            "fieldValidateRules": [
+                "required"
+            ]
+        },
         {
             "fieldName": "byteImageBob",
             "fieldType": "byte[]",
diff --git a/test-integration/samples/.jhipster/FieldTestServiceImplEntity.json b/test-integration/samples/.jhipster/FieldTestServiceImplEntity.json
index 2c09197c41..bdcb03bd57 100644
--- a/test-integration/samples/.jhipster/FieldTestServiceImplEntity.json
+++ b/test-integration/samples/.jhipster/FieldTestServiceImplEntity.json
@@ -198,6 +198,17 @@
                 "required"
             ]
         },
+        {
+            "fieldName": "durationMika",
+            "fieldType": "Duration"
+        },
+        {
+            "fieldName": "durationRequiredMika",
+            "fieldType": "Duration",
+            "fieldValidateRules": [
+                "required"
+            ]
+        },
         {
             "fieldName": "booleanMika",
             "fieldType": "Boolean"
@@ -222,6 +233,17 @@
                 "required"
             ]
         },
+        {
+            "fieldName": "uuidMika",
+            "fieldType": "UUID"
+        },
+        {
+            "fieldName": "uuidRequiredMika",
+            "fieldType": "UUID",
+            "fieldValidateRules": [
+                "required"
+            ]
+        },
         {
             "fieldName": "byteImageMika",
             "fieldType": "byte[]",
diff --git a/test/templates/export-jdl/.jhipster/Employee.json b/test/templates/export-jdl/.jhipster/Employee.json
index 25582d4aa3..9a064a710d 100644
--- a/test/templates/export-jdl/.jhipster/Employee.json
+++ b/test/templates/export-jdl/.jhipster/Employee.json
@@ -24,6 +24,10 @@
             "fieldName": "employeeId",
             "fieldType": "Long"
         },
+        {
+            "fieldName": "employeeUuid",
+            "fieldType": "UUID"
+        },
         {
             "fieldName": "firstName",
             "javadoc": "The firstname attribute.",
diff --git a/test/templates/import-jdl/jdl.jdl b/test/templates/import-jdl/jdl.jdl
index ebedec62b9..a13fcdacf0 100644
--- a/test/templates/import-jdl/jdl.jdl
+++ b/test/templates/import-jdl/jdl.jdl
@@ -1,5 +1,6 @@
 entity Region {
 	regionName String
+	guid UUID
 }
 
 entity Country {