Skip to content

Commit

Permalink
Merge pull request #330 from Yachef/develop
Browse files Browse the repository at this point in the history
[JPA] ne pas generer de composite primary key quand JDBC
  • Loading branch information
gideruette authored Dec 4, 2023
2 parents 0967ce9 + 010061a commit 829eb85
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion TopModel.Generator.Jpa/JpaDaoGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public JpaDaoGenerator(ILogger<JpaDaoGenerator> 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)
Expand Down
6 changes: 5 additions & 1 deletion TopModel.Generator.Jpa/JpaModelGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down

0 comments on commit 829eb85

Please sign in to comment.