I have two entities like A and B such that:
class B {
private Integer id;
private String field1;
private String field2;
// getters and setters
}
class A {
private Date date;
//one to one mapping is there between A and B
private B b;
//getters and setters
}
I have a spring data repository such that:
@Query("from A a where a.date= :date and a.b.id =:#{#b.id}")
A findByBAndDate(@Param(value = "date") Date date,@Param(value = "b") B b);
But I am getting the exception, no parameter binding found for name b!.
However, if I modify the above query as:
@Query("from A a where a.b.id =:#{#b.id}")
A findByB(@Param(value = "b") B b);
all works fine. What's the issue with this.