aileftech / snap-admin

A plug-and-play, auto-generated CRUD database admin panel for Spring Boot apps
MIT License
251 stars 18 forks source link

Support for composite key #46

Open daaa57150 opened 3 months ago

daaa57150 commented 3 months ago

Hi,

I was testing your library but stumbled on a problem with one of our entities because it has a composite key.

Is there a plan to support that ?

Here is the relevant code we have:

// File: UserLanguageJPA.class
@Entity
@IdClass(UserLanguageId.class)
@Table(name = "user_language", schema = "public")
public class UserLanguageJPA {
    @OneToOne
    @JoinColumn(name = "user_id")
    @Id
    private UserJPA user;

    @ManyToOne
    @Id
    @JoinColumn(name="language_code")
    private LanguageJPA language;

    // ...
}
// File: UserLanguageId.class
public class UserLanguageId implements Serializable {
    private UserJPA user;
    private LanguageJPA language;

    // ...
}