From e5587da40109368b3e1abefc4ca6c8abd896a283 Mon Sep 17 00:00:00 2001 From: yhadjal Date: Mon, 4 Dec 2023 16:42:35 +0100 Subject: [PATCH 1/2] [JPA] ne pas generer de composite primary key quand JDBC --- TopModel.Generator.Jpa/JpaModelGenerator.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/TopModel.Generator.Jpa/JpaModelGenerator.cs b/TopModel.Generator.Jpa/JpaModelGenerator.cs index 3424b5f9..6e821b0e 100644 --- a/TopModel.Generator.Jpa/JpaModelGenerator.cs +++ b/TopModel.Generator.Jpa/JpaModelGenerator.cs @@ -92,7 +92,11 @@ protected override void HandleClass(string fileName, Class classe, string tag) } JpaModelPropertyGenerator.WriteProperties(fw, classe, tag); - JpaModelPropertyGenerator.WriteCompositePrimaryKeyClass(fw, classe, tag); + if (!Config.UseJdbc) + { + JpaModelPropertyGenerator.WriteCompositePrimaryKeyClass(fw, classe, tag); + } + JpaModelConstructorGenerator.WriteNoArgConstructor(fw, classe); if (Config.MappersInClass) { From 010061aa4440f4991c5e16ebe8fa9e4bc33be3e2 Mon Sep 17 00:00:00 2001 From: yhadjal Date: Mon, 4 Dec 2023 16:52:04 +0100 Subject: [PATCH 2/2] [JPA] ne pas generer de composite primary key quand JDBC --- TopModel.Generator.Jpa/JpaDaoGenerator.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TopModel.Generator.Jpa/JpaDaoGenerator.cs b/TopModel.Generator.Jpa/JpaDaoGenerator.cs index 6e736862..4c529795 100644 --- a/TopModel.Generator.Jpa/JpaDaoGenerator.cs +++ b/TopModel.Generator.Jpa/JpaDaoGenerator.cs @@ -21,7 +21,7 @@ public JpaDaoGenerator(ILogger logger) protected override bool FilterClass(Class classe) { - return classe.IsPersistent; + return classe.IsPersistent && (!Config.UseJdbc || classe.PrimaryKey.Count() <= 1); } protected override string GetFileName(Class classe, string tag)