Sorry if this is a very nooby/stupid question, but I was wondering if there was any difference, besides implementation, between defining a query in the repository:
public interface EmployeeRepository<Employee, Integer> {
@Query("select e from Employee e where e.name like :name")
public List<Employee> findByName(@Param("name") String name);
}
and defining a query in the entity:
@Entity
@NamedQuery(name="Employee.findByName", query="select e from Employee e where e.name like :name")
public class Employee {
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
private int id;
//...
}
Like are there advantages/disadvantages to either one?