Closed michelfigueiredojava closed 9 months ago
This issue is stale because it has been open for too long without any activity. Due to the moving nature of jhipster generated application, bugs can become invalid. If this issue still applies please comment otherwise it will be closed in 7 days
Overview of the issue
After generating an application with h2 memory as dev db, when you run the tests with
./mvnw verify
you have the following errors:[ERROR] Errors: [ERROR] DomainUserDetailsServiceIT.init:50 » DataIntegrityViolation could not execute statement; SQL [n/a]; constraint ["PRIMARY KEY ON PUBLIC.JHI_USER(ID) ( /* key:1 */ CAST(1 AS BIGINT), 'admin', '$2a$10$gSAhZrxMllrbgj/kkK9UceBPpChGWJA7SYIb1Mqo.n5aNLq1/oRrC', 'Administrator', 'Administrator', 'admin@localhost', '', TRUE, 'en', NULL, NULL, 'system', NULL, NULL, 'system', NULL)"; SQL statement: insert into jhi_user (id, created_by, created_date, last_modified_by, last_modified_date, activated, activation_key, email, first_name, image_url, lang_key, last_name, login, password_hash, reset_date, reset_key) values (default, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) [23505-214]]; nested exception is org.hibernate.exception.ConstraintViolationException: could not execute statement [ERROR] DomainUserDetailsServiceIT.init:50 » DataIntegrityViolation could not execute statement; SQL [n/a]; constraint ["PRIMARY KEY ON PUBLIC.JHI_USER(ID) ( /* key:2 */ CAST(2 AS BIGINT), 'user', '$2a$10$VEjxo0jq2YG9Rbk2HmX9S.k1uZBGYUHdUcid3g/vfiEl7lwWgOH/K', 'User', 'User', 'user@localhost', '', TRUE, 'en', NULL, NULL, 'system', NULL, NULL, 'system', NULL)"; SQL statement: insert into jhi_user (id, created_by, created_date, last_modified_by, last_modified_date, activated, activation_key, email, first_name, image_url, lang_key, last_name, login, password_hash, reset_date, reset_key) values (default, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) [23505-214]]; nested exception is org.hibernate.exception.ConstraintViolationException: could not execute statement [ERROR] UserServiceIT.assertThatOnlyActivatedUserCanRequestPasswordReset:95 » DataIntegrityViolation could not execute statement; SQL [n/a]; constraint ["PRIMARY KEY ON PUBLIC.JHI_USER(ID) ( /* key:1 */ CAST(1 AS BIGINT), 'admin', '$2a$10$gSAhZrxMllrbgj/kkK9UceBPpChGWJA7SYIb1Mqo.n5aNLq1/oRrC', 'Administrator', 'Administrator', 'admin@localhost', '', TRUE, 'en', NULL, NULL, 'system', NULL, NULL, 'system', NULL)"; SQL statement: insert into jhi_user (id, created_by, created_date, last_modified_by, last_modified_date, activated, activation_key, email, first_name, image_url, lang_key, last_name, login, password_hash, reset_date, reset_key) values (default, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) [23505-214]]; nested exception is org.hibernate.exception.ConstraintViolationException: could not execute statement [ERROR] UserServiceIT.assertThatUserMustExistToResetPassword:80 » DataIntegrityViolation could not execute statement; SQL [n/a]; constraint ["PRIMARY KEY ON PUBLIC.JHI_USER(ID) ( /* key:2 */ CAST(2 AS BIGINT), 'user', '$2a$10$VEjxo0jq2YG9Rbk2HmX9S.k1uZBGYUHdUcid3g/vfiEl7lwWgOH/K', 'User', 'User', 'user@localhost', '', TRUE, 'en', NULL, NULL, 'system', NULL, NULL, 'system', NULL)"; SQL statement: insert into jhi_user (id, created_by, created_date, last_modified_by, last_modified_date, activated, activation_key, email, first_name, image_url, lang_key, last_name, login, password_hash, reset_date, reset_key) values (default, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) [23505-214]]; nested exception is org.hibernate.exception.ConstraintViolationException: could not execute statement [ERROR] AccountResourceIT.testRequestPasswordReset:663 » DataIntegrityViolation could not execute statement; SQL [n/a]; constraint ["PRIMARY KEY ON PUBLIC.JHI_USER(ID) ( /* key:2 */ CAST(2 AS BIGINT), 'user', '$2a$10$VEjxo0jq2YG9Rbk2HmX9S.k1uZBGYUHdUcid3g/vfiEl7lwWgOH/K', 'User', 'User', 'user@localhost', '', TRUE, 'en', NULL, NULL, 'system', NULL, NULL, 'system', NULL)"; SQL statement: insert into jhi_user (id, created_by, created_date, last_modified_by, last_modified_date, activated, activation_key, email, first_name, image_url, lang_key, last_name, login, password_hash, reset_date, reset_key) values (default, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) [23505-214]]; nested exception is org.hibernate.exception.ConstraintViolationException: could not execute statement [ERROR] AccountResourceIT.testSaveInvalidEmail:449 » DataIntegrityViolation could not execute statement; SQL [n/a]; constraint ["PRIMARY KEY ON PUBLIC.JHI_USER(ID) ( /* key:1 */ CAST(1 AS BIGINT), 'admin', '$2a$10$gSAhZrxMllrbgj/kkK9UceBPpChGWJA7SYIb1Mqo.n5aNLq1/oRrC', 'Administrator', 'Administrator', 'admin@localhost', '', TRUE, 'en', NULL, NULL, 'system', NULL, NULL, 'system', NULL)"; SQL statement: insert into jhi_user (id, created_by, created_date, last_modified_by, last_modified_date, activated, activation_key, email, first_name, image_url, lang_key, last_name, login, password_hash, reset_date, reset_key) values (default, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) [23505-214]]; nested exception is org.hibernate.exception.ConstraintViolationException: could not execute statement [ERROR] PublicUserResourceIT.getAllPublicUsers:62 » DataIntegrityViolation could not execute statement; SQL [n/a]; constraint ["PRIMARY KEY ON PUBLIC.JHI_USER(ID) ( /* key:1 */ CAST(1 AS BIGINT), 'admin', '$2a$10$gSAhZrxMllrbgj/kkK9UceBPpChGWJA7SYIb1Mqo.n5aNLq1/oRrC', 'Administrator', 'Administrator', 'admin@localhost', '', TRUE, 'en', NULL, NULL, 'system', NULL, NULL, 'system', NULL)"; SQL statement: insert into jhi_user (id, created_by, created_date, last_modified_by, last_modified_date, activated, activation_key, email, first_name, image_url, lang_key, last_name, login, password_hash, reset_date, reset_key) values (default, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) [23505-214]]; nested exception is org.hibernate.exception.ConstraintViolationException: could not execute statement [ERROR] PublicUserResourceIT.getAllUsersSortedByParameters:90 » DataIntegrityViolation could not execute statement; SQL [n/a]; constraint ["PRIMARY KEY ON PUBLIC.JHI_USER(ID) ( /* key:2 */ CAST(2 AS BIGINT), 'user', '$2a$10$VEjxo0jq2YG9Rbk2HmX9S.k1uZBGYUHdUcid3g/vfiEl7lwWgOH/K', 'User', 'User', 'user@localhost', '', TRUE, 'en', NULL, NULL, 'system', NULL, NULL, 'system', NULL)"; SQL statement: insert into jhi_user (id, created_by, created_date, last_modified_by, last_modified_date, activated, activation_key, email, first_name, image_url, lang_key, last_name, login, password_hash, reset_date, reset_key) values (default, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) [23505-214]]; nested exception is org.hibernate.exception.ConstraintViolationException: could not execute statement [ERROR] UserJWTControllerIT.testAuthorize:49 » DataIntegrityViolation could not execute statement; SQL [n/a]; constraint ["PRIMARY KEY ON PUBLIC.JHI_USER(ID) ( /* key:2 */ CAST(2 AS BIGINT), 'user', '$2a$10$VEjxo0jq2YG9Rbk2HmX9S.k1uZBGYUHdUcid3g/vfiEl7lwWgOH/K', 'User', 'User', 'user@localhost', '', TRUE, 'en', NULL, NULL, 'system', NULL, NULL, 'system', NULL)"; SQL statement: insert into jhi_user (id, created_by, created_date, last_modified_by, last_modified_date, activated, activation_key, email, first_name, image_url, lang_key, last_name, login, password_hash, reset_date, reset_key) values (default, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) [23505-214]]; nested exception is org.hibernate.exception.ConstraintViolationException: could not execute statement [ERROR] UserJWTControllerIT.testAuthorizeWithRememberMe:72 » DataIntegrityViolation could not execute statement; SQL [n/a]; constraint ["PRIMARY KEY ON PUBLIC.JHI_USER(ID) ( /* key:1 */ CAST(1 AS BIGINT), 'admin', '$2a$10$gSAhZrxMllrbgj/kkK9UceBPpChGWJA7SYIb1Mqo.n5aNLq1/oRrC', 'Administrator', 'Administrator', 'admin@localhost', '', TRUE, 'en', NULL, NULL, 'system', NULL, NULL, 'system', NULL)"; SQL statement: insert into jhi_user (id, created_by, created_date, last_modified_by, last_modified_date, activated, activation_key, email, first_name, image_url, lang_key, last_name, login, password_hash, reset_date, reset_key) values (default, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) [23505-214]]; nested exception is org.hibernate.exception.ConstraintViolationException: could not execute statement [ERROR] UserResourceIT.createUserWithExistingEmail:217 » DataIntegrityViolation could not execute statement; SQL [n/a]; constraint ["PRIMARY KEY ON PUBLIC.JHI_USER(ID) ( /* key:1 */ CAST(1 AS BIGINT), 'admin', '$2a$10$gSAhZrxMllrbgj/kkK9UceBPpChGWJA7SYIb1Mqo.n5aNLq1/oRrC', 'Administrator', 'Administrator', 'admin@localhost', '', TRUE, 'en', NULL, NULL, 'system', NULL, NULL, 'system', NULL)"; SQL statement: insert into jhi_user (id, created_by, created_date, last_modified_by, last_modified_date, activated, activation_key, email, first_name, image_url, lang_key, last_name, login, password_hash, reset_date, reset_key) values (default, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) [23505-214]]; nested exception is org.hibernate.exception.ConstraintViolationException: could not execute statement [ERROR] UserResourceIT.createUserWithExistingLogin:188 » DataIntegrityViolation could not execute statement; SQL [n/a]; constraint ["PRIMARY KEY ON PUBLIC.JHI_USER(ID) ( /* key:2 */ CAST(2 AS BIGINT), 'user', '$2a$10$VEjxo0jq2YG9Rbk2HmX9S.k1uZBGYUHdUcid3g/vfiEl7lwWgOH/K', 'User', 'User', 'user@localhost', '', TRUE, 'en', NULL, NULL, 'system', NULL, NULL, 'system', NULL)"; SQL statement: insert into jhi_user (id, created_by, created_date, last_modified_by, last_modified_date, activated, activation_key, email, first_name, image_url, lang_key, last_name, login, password_hash, reset_date, reset_key) values (default, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) [23505-214]]; nested exception is org.hibernate.exception.ConstraintViolationException: could not execute statement [INFO] [ERROR] Tests run: 90, Failures: 0, Errors: 12, Skipped: 0
Motivation for or Use Case
Nothing was changed, the tests should all pass.
Reproduce the error
Just generate a new app with h2 memory selected, and run the tests with ./mvnw verify.
Suggest a Fix
I tried to fix it but couldn't find a solution.
JHipster Version(s)
7.9.3
JHipster configuration
INFO! Switching to JHipster installed locally in current project's node repository (node_modules) (node:59729) [DEP0148] DeprecationWarning: Use of deprecated folder mapping "./lib/util/" in the "exports" field module resolution of the package at /Users/mdf/projects/mdf/jhipster-h2-mem/node_modules/yeoman-environment/package.json. Update this package.json to use a subpath pattern like "./lib/util/*". (Use
node --trace-deprecation ...
to show where the warning was created)██╗ ██║ ██╔═══██║ ██║ ██╔════╝ ╚═══██╗ ██║ ██╔═══╝ ██╔══██║ ╚██████╔╝ ██║ ██║ ████████╗ ██║ ██████╔╝ ██║ ████████╗ ██║ ╚██╗ ╚═════╝ ╚═╝ ╚═╝ ╚═══════╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══════╝ ╚═╝ ╚═╝ https://www.jhipster.tech Welcome to JHipster v7.9.3
Welcome to the JHipster Information Sub-Generator
JHipster Version(s)
JHipster configuration, a
.yo-rc.json
file generated in the root folder.yo-rc.json file
JDL for the Entity configuration(s)
entityName.json
files generated in the.jhipster
directoryJDL entity definitions
Environment and Tools
java version "11.0.16.1" 2022-08-18 LTS Java(TM) SE Runtime Environment 18.9 (build 11.0.16.1+1-LTS-1) Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.16.1+1-LTS-1, mixed mode)
git version 2.37.0 (Apple Git-136)
node: v16.17.0
npm: 8.15.0
Docker version 20.10.17, build 100c701
Docker Compose version v2.10.2
No change to package.json was detected. No package manager install will be executed. Congratulations, JHipster execution is complete!
Browsers and Operating System
macOS Monterey 12.6 Apple M1 Max