From ccd6a865a0b5b33ad1bcff3e4256b8fa703cd171 Mon Sep 17 00:00:00 2001 From: jperezdelafuente Date: Fri, 13 Oct 2023 13:13:54 +0200 Subject: [PATCH 1/3] Update _persistClass_.java.jhi.ejs Using getter in equals() methods to be Hibernate-safe --- .../_entityPackage_/domain/_persistClass_.java.jhi.ejs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generators/java/templates/src/main/java/_package_/_entityPackage_/domain/_persistClass_.java.jhi.ejs b/generators/java/templates/src/main/java/_package_/_entityPackage_/domain/_persistClass_.java.jhi.ejs index c43c3b57af90..c83980fc7022 100644 --- a/generators/java/templates/src/main/java/_package_/_entityPackage_/domain/_persistClass_.java.jhi.ejs +++ b/generators/java/templates/src/main/java/_package_/_entityPackage_/domain/_persistClass_.java.jhi.ejs @@ -343,7 +343,7 @@ _%> return false; } <%_ if (!embedded) { _%> - return <%= primaryKey.name %> != null && <%= primaryKey.name %>.equals(((<%= persistClass %>) o).<%= primaryKey.name %>); + return <%= primaryKey.name %> != null && <%= primaryKey.name %>.equals(((<%= persistClass %>) o).getId()); <%_ } else { _%> return false; <%_ } _%> From 488be794b9ea7e74ff8624eb294e9c00da872d02 Mon Sep 17 00:00:00 2001 From: jperezdelafuente Date: Fri, 13 Oct 2023 17:09:08 +0200 Subject: [PATCH 2/3] Update generators/java/templates/src/main/java/_package_/_entityPackage_/domain/_persistClass_.java.jhi.ejs Co-authored-by: Marcelo Shima --- .../_entityPackage_/domain/_persistClass_.java.jhi.ejs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generators/java/templates/src/main/java/_package_/_entityPackage_/domain/_persistClass_.java.jhi.ejs b/generators/java/templates/src/main/java/_package_/_entityPackage_/domain/_persistClass_.java.jhi.ejs index c83980fc7022..2c7af62b9565 100644 --- a/generators/java/templates/src/main/java/_package_/_entityPackage_/domain/_persistClass_.java.jhi.ejs +++ b/generators/java/templates/src/main/java/_package_/_entityPackage_/domain/_persistClass_.java.jhi.ejs @@ -343,7 +343,7 @@ _%> return false; } <%_ if (!embedded) { _%> - return <%= primaryKey.name %> != null && <%= primaryKey.name %>.equals(((<%= persistClass %>) o).getId()); + return get<%= primaryKey.nameCapitalized %> != null && get<%= primaryKey.nameCapitalized %>.equals(((<%= persistClass %>) o).get<%= primaryKey.nameCapitalized %>()); <%_ } else { _%> return false; <%_ } _%> From 224600d4ff7a8978e30575b313b84890ce8cea5c Mon Sep 17 00:00:00 2001 From: jperezdelafuente Date: Fri, 13 Oct 2023 17:26:56 +0200 Subject: [PATCH 3/3] Update _persistClass_.java.jhi.ejs Fix with () --- .../_entityPackage_/domain/_persistClass_.java.jhi.ejs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generators/java/templates/src/main/java/_package_/_entityPackage_/domain/_persistClass_.java.jhi.ejs b/generators/java/templates/src/main/java/_package_/_entityPackage_/domain/_persistClass_.java.jhi.ejs index 2c7af62b9565..12f752f61301 100644 --- a/generators/java/templates/src/main/java/_package_/_entityPackage_/domain/_persistClass_.java.jhi.ejs +++ b/generators/java/templates/src/main/java/_package_/_entityPackage_/domain/_persistClass_.java.jhi.ejs @@ -343,7 +343,7 @@ _%> return false; } <%_ if (!embedded) { _%> - return get<%= primaryKey.nameCapitalized %> != null && get<%= primaryKey.nameCapitalized %>.equals(((<%= persistClass %>) o).get<%= primaryKey.nameCapitalized %>()); + return get<%= primaryKey.nameCapitalized %>() != null && get<%= primaryKey.nameCapitalized %>().equals(((<%= persistClass %>) o).get<%= primaryKey.nameCapitalized %>()); <%_ } else { _%> return false; <%_ } _%>