I have the following entities:
@Entity
@Table("table_x")
public class X{
@id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@ManyToOne
private Y y;
}
@Entity
@Table("table_y")
public class Y{
@id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
}
@Repository
public interface XRepository extends JpaRepository, JpaSpecificationExecutor{
@Query(value= "select x.* from X x where x.y in :yList")
List getX(List yList);
}
when trying to call getX from XRepository while table_y is empty it throws:
Method threw 'org.springframework.dao.InvalidDataAccessResourceUsageException' exception.
could not extract ResultSet; SQL [n/a]
if table_y has records in the database, everything works fine
Top comments (0)