diff --git a/generators/spring-boot/templates/src/main/resources/config/application.yml.ejs b/generators/spring-boot/templates/src/main/resources/config/application.yml.ejs index 00382797c53a..f2c49128b53a 100644 --- a/generators/spring-boot/templates/src/main/resources/config/application.yml.ejs +++ b/generators/spring-boot/templates/src/main/resources/config/application.yml.ejs @@ -317,6 +317,9 @@ spring: # modify fetch size as necessary hibernate.jdbc.fetch_size: 150 hibernate.criteria.literal_handling_mode: BIND + <%_ if (prodDatabaseTypeMysql) { _%> + hibernate.type.preferred_boolean_jdbc_type: TINYINT + <%_ } _%> <%_ } _%> hibernate.query.fail_on_pagination_over_collection_fetch: true hibernate.query.in_clause_parameter_padding: true diff --git a/generators/spring-data-relational/templates/src/main/java/_package_/_entityPackage_/domain/_persistClass_.java.jhi.jakarta_persistence.ejs b/generators/spring-data-relational/templates/src/main/java/_package_/_entityPackage_/domain/_persistClass_.java.jhi.jakarta_persistence.ejs index e5360b26c18e..69c7b155c4e8 100644 --- a/generators/spring-data-relational/templates/src/main/java/_package_/_entityPackage_/domain/_persistClass_.java.jhi.jakarta_persistence.ejs +++ b/generators/spring-data-relational/templates/src/main/java/_package_/_entityPackage_/domain/_persistClass_.java.jhi.jakarta_persistence.ejs @@ -60,7 +60,7 @@ import org.hibernate.type.SqlTypes; @JdbcTypeCode(SqlTypes.VARCHAR) @Column(name = "<%- field.fieldNameAsDatabaseColumn %>", length = 36<% if (field.fieldValidationRequired) { %>, nullable = false<% } %><% if (field.fieldValidationUnique) { %>, unique = true<% } %>) <%_ } else { _%> - @Column(name = "<%- field.fieldNameAsDatabaseColumn %>"<% if (field.fieldValidate === true) { %><% if (field.fieldValidationMaxLength) { %>, length = <%= field.fieldValidateRulesMaxlength %><% } %><% if (field.fieldValidationRequired) { %>, nullable = false<% } %><% if (field.fieldValidationUnique) { %>, unique = true<% } %><% } %>) + @Column(name = "<%- field.fieldNameAsDatabaseColumn %>"<% if (field.fieldValidate === true) { %><% if (field.fieldValidationMaxLength) { %>, length = <%= field.fieldValidateRulesMaxlength %><% } %><% if (field.fieldValidationRequired) { %>, nullable = false<% } %><% if (field.fieldValidationUnique) { %>, unique = true<% } %><% } %><% if (field.fieldIsEnum && prodDatabaseTypeMysql) { %>, columnDefinition = "VARCHAR(255)"<% } %>) <%_ } _%> <&_ } -&> <%_ } -%> diff --git a/generators/spring-data-relational/templates/src/test/resources/config/application-testdev.yml.ejs b/generators/spring-data-relational/templates/src/test/resources/config/application-testdev.yml.ejs index 837e5111124d..8d81c76a040e 100644 --- a/generators/spring-data-relational/templates/src/test/resources/config/application-testdev.yml.ejs +++ b/generators/spring-data-relational/templates/src/test/resources/config/application-testdev.yml.ejs @@ -65,7 +65,11 @@ spring: jpa: open-in-view: false hibernate: + <%_ if (devDatabaseTypeMysql) { _%> + ddl-auto: validate + <%_ } else { _%> ddl-auto: none + <%_ } _%> naming: physical-strategy: org.hibernate.boot.model.naming.CamelCaseToUnderscoresNamingStrategy implicit-strategy: org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy @@ -75,10 +79,17 @@ spring: hibernate.cache.use_second_level_cache: false hibernate.cache.use_query_cache: false hibernate.generate_statistics: false + <%_ if (devDatabaseTypeMysql) { _%> + hibernate.hbm2ddl.auto: validate + <%_ } else { _%> hibernate.hbm2ddl.auto: none #TODO: temp relief for integration tests, revisit required + <%_ } _%> hibernate.type.preferred_instant_jdbc_type: TIMESTAMP hibernate.jdbc.time_zone: UTC hibernate.timezone.default_storage: NORMALIZE hibernate.query.fail_on_pagination_over_collection_fetch: true + <%_ if (devDatabaseTypeMysql) { _%> + hibernate.type.preferred_boolean_jdbc_type: TINYINT + <%_ } _%> <%_ } _%> diff --git a/generators/spring-data-relational/templates/src/test/resources/config/application-testprod.yml.ejs b/generators/spring-data-relational/templates/src/test/resources/config/application-testprod.yml.ejs index c230b80cdd3f..2221548c453a 100644 --- a/generators/spring-data-relational/templates/src/test/resources/config/application-testprod.yml.ejs +++ b/generators/spring-data-relational/templates/src/test/resources/config/application-testprod.yml.ejs @@ -53,7 +53,11 @@ spring: jpa: open-in-view: false hibernate: + <%_ if (prodDatabaseTypeMysql) { _%> + ddl-auto: validate + <%_ } else { _%> ddl-auto: none + <%_ } _%> naming: physical-strategy: org.hibernate.boot.model.naming.CamelCaseToUnderscoresNamingStrategy implicit-strategy: org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy @@ -63,8 +67,15 @@ spring: hibernate.cache.use_second_level_cache: false hibernate.cache.use_query_cache: false hibernate.generate_statistics: false + <%_ if (prodDatabaseTypeMysql) { _%> + hibernate.hbm2ddl.auto: validate + <%_ } else { _%> hibernate.hbm2ddl.auto: none #TODO: temp relief for integration tests, revisit required + <%_ } _%> hibernate.type.preferred_instant_jdbc_type: TIMESTAMP hibernate.jdbc.time_zone: UTC hibernate.timezone.default_storage: NORMALIZE hibernate.query.fail_on_pagination_over_collection_fetch: true + <%_ if (prodDatabaseTypeMysql) { _%> + hibernate.type.preferred_boolean_jdbc_type: TINYINT + <%_ } _%>