Announcement Announcement Module
Collapse
No announcement yet.
spring data jpa could do shis?a simple search Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • spring data jpa could do shis?a simple search

    i have a project using spring data jpa .now i have a bussiness: i will find all data from table order by some filed,i user jpa Specification ,but failure.

    code as :
    @Entity
    @Table(name = "GSOFT_USER")
    public class GsoftUser implements java.io.Serializable {

    private static final long serialVersionUID = -8681507674322020665L;

    @GenericGenerator(name = "generator", strategy = "assigned")
    @Id
    @GeneratedValue(generator = "generator")
    /**
    * 主键
    */
    private String uuid;
    @NotEmpty(message = "请输入登录名")
    private String loginName;

    private String authType;

    private String token;

    private long tryMax;

    private String pwd;

    private int orderNum;

    @Type(type="true_false")
    private boolean enabled = true;

    @Type(type="true_false")
    private boolean sys;

    private String depId;

    @Transient
    private String deptName;
    ........
    }

    dao interface:
    public interface UserPersistence extends jpaRepository<GsoftUser, String>{
    public List<GsoftUser> findByOrderByOrderNumDesc(Pageable pageable);
    }
    This interface ,i want find All data only sort by OrderNum field. when i run junit test,it throws Null point error, why?
    i use spring data jpa,i could not track the daoImpl code, i do not know how spring data jpa reflect the interface name to search sentence? i feel this simple function cost my more time using spring data jpa.

    who can help me?
Working...
X