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

How to use the filter / sort operation for Entity classes having @EmbeddedId composite key #208

Open
ParthaNath28 opened this issue Dec 15, 2021 · 1 comment
Labels
question Further information is requested
Milestone

Comments

@ParthaNath28
Copy link

Hello

As discussed in the Gitter Channel I would like to know the syntax to be used while working entity classes having @EmbeddedId composite key based objects.

jpaStreamer.stream(MyOwnEntity.class)
.filter(MyOwnEntity$.<do I put property of nested composite key object ?>.equalIgnoreCase("filterIdentifier"))

@ParthaNath28
Copy link
Author

@embeddable
public class EmployeeId implements Serializable {

@Column(name = "company_id")
private Long companyId;

@Column(name = "employee_number")
private Long employeeNumber;

}

@entity(name = "Employee")
@table(name = "employee")
public class EmployeeEntity {

@EmbeddedId
private EmployeeId id;

private String name;

}

There can be scenario that distinct employees might not be identified by their employee id but a composite id needs be used with a combination of employee id and company id. However I might
functionality to find all employees having employee number 12345. Had it been a linear Entity class structure the jpaStreamer code might have looked liked the following.

final List employeeList=
jpaStreamer.stream(EmployeeEntity.class)
.filter(EmployeeEntity$.employeeNumber.equalIgnoreCase())
.toList();

@julgus julgus added the question Further information is requested label May 31, 2023
@julgus julgus added this to the 3.0.2 milestone May 31, 2023
@julgus julgus modified the milestones: 3.0.2, 3.0.3 Jun 19, 2023
@julgus julgus modified the milestones: 3.0.3, 3.0.4 Jul 10, 2023
@julgus julgus modified the milestones: 3.0.4, 3.0.5 Aug 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants