From d2b7cba0ff3116f2c416bddc65c39ba15ffc6b51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20Garc=C3=ADa=20Sainz-Aja?= Date: Thu, 30 May 2019 09:53:28 +0200 Subject: [PATCH] fixes pkType for mondogodb/casandra... --- .../src/main/java/package/common/save_template.ejs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/generators/entity-server/templates/src/main/java/package/common/save_template.ejs b/generators/entity-server/templates/src/main/java/package/common/save_template.ejs index ff9e61a507f3..6d5bfc5d84a1 100644 --- a/generators/entity-server/templates/src/main/java/package/common/save_template.ejs +++ b/generators/entity-server/templates/src/main/java/package/common/save_template.ejs @@ -42,14 +42,14 @@ if (!viaService) { resultEntity = asEntity(entityInstance); _%> <%= asEntity(entityClass) %> <%= asEntity(entityInstance) %> = <%= dtoToEntity %>(<%= instanceName %>); <%_ if (isUsingMapsId === true) { _%> - long <%= otherEntityName %>Id = <%= instanceName %>.get<%= mapsIdAssoc.relationshipNameCapitalized %>Id(); + <%= pkType %> <%= otherEntityName %>Id = <%= instanceName %>.get<%= mapsIdAssoc.relationshipNameCapitalized %>Id(); <%= mapsIdRepoInstance %>.findById(<%= otherEntityName %>Id).ifPresent(<%= entityInstance%>::<%= otherEntityName %>); <%_ } _%> <%= asEntity(entityInstance) %> = <%= entityInstance %>Repository.save(<%= asEntity(entityInstance) %>); <%= returnPrefix %> <%= entityToDto %>(<%= asEntity(entityInstance) %>); <%_ } else { resultEntity = 'result'; _%> <%_ if (isUsingMapsId === true) { _%> - long <%= otherEntityName %>Id = <%= instanceName %>.get<%= mapsIdAssoc.relationshipNameCapitalized %>().getId(); + <%= pkType %> <%= otherEntityName %>Id = <%= instanceName %>.get<%= mapsIdAssoc.relationshipNameCapitalized %>().getId(); <%= mapsIdRepoInstance %>.findById(<%= otherEntityName %>Id).ifPresent(<%= instanceName%>::<%= otherEntityName %>); <%_ } _%> <%= returnPrefix %> <%= entityInstance %>Repository.save(<%= asEntity(entityInstance) %>); @@ -59,7 +59,7 @@ if (!viaService) { return result; <%_ }}} else { _%> <%_ if (isUsingMapsId === true && isController === false) { _%> - long <%= otherEntityName %>Id = <%= entityInstance %>.get<%= mapsIdAssoc.relationshipNameCapitalized %>().getId(); + <%= pkType %> <%= otherEntityName %>Id = <%= entityInstance %>.get<%= mapsIdAssoc.relationshipNameCapitalized %>().getId(); <%= mapsIdRepoInstance %>.findById(<%= otherEntityName %>Id).ifPresent(<%= entityInstance%>::<%= otherEntityName %>); <%_ } _%> <%= returnPrefix %> <%= entityInstance %>Service.save(<%= instanceName %>);