Skip to content

Commit

Permalink
use js method to generate UUID
Browse files Browse the repository at this point in the history
  • Loading branch information
Tcharl committed Apr 13, 2021
1 parent cceec9b commit 2ec5ff7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
limitations under the License.
-%>
// Initialize the database
<%_ if (primaryKey.isUuid && !databaseTypeSql) { _%>
<%= persistInstance %>.set<%= primaryKey.nameCapitalized %>(UUID.randomUUID());
<%_ if (!primaryKey.autoGenerate && !databaseTypeSql) { _%>
<%= persistInstance %>.set<%= primaryKey.nameCapitalized %>(<%- getPrimaryKeyValue(primaryKey.type, databaseType, '1') %>);
<%_ } _%>
<%= entityInstance %>Repository.<%= saveMethod %>(<%= persistInstance %>)<%= callBlock %>;
Expand Down
3 changes: 1 addition & 2 deletions utils/entity.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const { MapperTypes } = require('../jdl/jhipster/entity-options');
const { OAUTH2 } = require('../jdl/jhipster/authentication-types');
const { CommonDBTypes } = require('../jdl/jhipster/field-types');

const { BOOLEAN, UUID } = CommonDBTypes;
const { BOOLEAN } = CommonDBTypes;
const { MAPSTRUCT } = MapperTypes;
const { PAGINATION, INFINITE_SCROLL } = PaginationTypes;
const NO_PAGINATION = PaginationTypes.NO;
Expand Down Expand Up @@ -360,7 +360,6 @@ function prepareEntityPrimaryKeyForTemplates(entityWithConfig, generator, enable
type: primaryKeyType,
tsType: generator.getTypescriptKeyType(primaryKeyType),
composite,
isUuid: primaryKeyType === UUID,
relationships: idRelationships,
// Fields declared in this entity
ownFields: idFields,
Expand Down

0 comments on commit 2ec5ff7

Please sign in to comment.