Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using distinct creating the specification fails with composite keys #111

Open
thmasker opened this issue Jul 21, 2023 · 1 comment
Open

Comments

@thmasker
Copy link

thmasker commented Jul 21, 2023

Hi,

I just found out that for entities with composite keys, the generated query fails. For instance:

@Entity
@Table(name = "offices")
public class Office implements Serializable {

    @EmbeddedId
    private OfficeId id;

    ...

    @Embeddable
    @EqualsAndHashCode
    public static class OfficeId implements Serializable {

        @Column(name = "entity")
        private String entity;

        @Column(name = "code")
        private String office;

    }

}

This entity will generate the following query when using pagination:

select distinct count(distinct office0_.entity, office0_.code) as col_0_0_ 
from offices office0_

which obviously fails in Oracle since count does not support two arguments...

@thmasker
Copy link
Author

I guess this is really a problem of JPA rather than this library...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant