我是新的春季數據jpa和試圖使用它,但面臨與org.springframework.data.mapping.PropertyReferenceException問題:沒有找到類型用戶的屬性名稱! 有人建議我可以做些什麼?我掙扎但找不到解決方案春季數據JPA其餘
**Service**
public interface UserService {
Page<User> findAllUsers();
}
**Service Impl** where I am trying to implement the service methods
@Service("userService")
@Transactional
public class UserServiceImpl implements UserService{
/*@Autowired*/
@Qualifier("userDao")
private final UserDao dao;
@Autowired
public UserServiceImpl(UserDao dao) {
this.dao = dao;
}
private static final AtomicLong counter = new AtomicLong();
private static List<User> users;
public Page<User> findAllUsers() {
return dao.findAll(pageRequest);
}
**DAO**
public interface UserDao extends JpaRepository<User, Long> {
}
**User**
@Entity
@Table(name="USERAG")
public class User implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "users_seq")
private long id;
@Column(name = "NAME", nullable = true)
private String username;
@Column(name = "ADDRESS", nullable = true)
private String address;
@Column(name = "EMAIL", nullable = true)
private String email;
您的用戶實體是什麼樣的?它有一個屬性「名稱」嗎? –
抱歉忘了添加,現在添加請檢查@布萊恩凱特,是的,它有用戶名 –