I have several entities and jpa repositories to them. It looks like:
Event:
public class Event{
@Column
private String name;
@Column
private String description;
}
Place:
public class Place{
@Column
private String name;
@Column
private String description;
@Column
private Double lon;
@Column
private Double lat;
}
And repositories to them:
public interface EventRepository extends JpaRepository<Event, String>, JpaSpecificationExecutor<Event> {
}
public interface PlaceRepository extends JpaRepository<Place, String>, JpaSpecificationExecutor<Place> {
}
It work well. But then I added one else field in each entity calls tenantId
Event:
public class Event{
@Column
private String tenantId;
@Column
private String name;
@Column
private String description;
}
Place:
public class Place{
@Column
private String tenantId;
@Column
private String name;
@Column
private String description;
@Column
private Double lon;
@Column
private Double lat;
}
But all my service works with method findAll()
. So, the question is:
How can I get from "old" method findAll()
entities only with tenantId = "1" or "2", doesnt matter? It should be work like findAllByTenantId(String tenantId)
but it should be 'findAll()'. Can I inject somehow into 'findAll()' tenantId params?
Thx.