Article From:https://segmentfault.com/q/1010000013341988
Question:

It looks hard,
I just come to complain about complaining
specificationsThere are a lot of things to learn. The tutorial is very difficult.
To make some mess or not;

querydslMaven configuration is also a mess. Why can’t it be simple?

Answer 0:

Use itspring data jpaDo not want to learnSpecificationsI can’t say it. And it’s not difficult to learn. There are not many things to learn.

Specification<User> specification = new Specification<User>() {
            @Override
            public Predicate toPredicate(Root<User> root, CriteriaQuery<?> query, CriteriaBuilder cb) {
                List<Predicate> predicateList = new ArrayList<>();
      
                predicateList.add(cb.lessThan(root.<String>get("id"), 10));
           
                Predicate[] pre = new Predicate[predicateList.size()];
                return cb.and(predicateList.toArray(pre));
            }
        };

staytoPredicateI have it.CriteriaQuery,become pregnantCriteriaBuilder ,It can be said that the implementation of the JPA specification is very good.
It’s an excuse for not knowing English documents. There are many Chinese tutorials. And look at the source code, it is very easy to understand how to use.

Maybe you can see https://www.imooc.com/learn/821.

You feel a little bit afraid. Writing code is a bad idea. Many people, including my own often do some things are now learning to use, too much knowledge, I have no way to remember all, mainly by learning ability to solve the problem. It is more meaningful to learn something difficult to learn, because there isA lot of people will not be because they can’t do it.

Similar Posts:

Leave a Reply

Your email address will not be published. Required fields are marked *