The problem of using Specifications to dynamically build a query to query a field in Spring data JPA

novice to java, this may be a simple question for a veteran, but it really beats me as a novice to PHP. Recently, I am changing the springmvc framework used by a java project. Some of the query statements are as follows:

public Predicate toPredicate(Root<StockOrder> root,CriteriaQuery<?> query, CriteriaBuilder cb) {

                Path<Integer> orgId = root.get("organizationId");    
                Predicate p = null;
                Predicate p1 = cb.equal(orgId, clinicId);
                p = cb.and(p1);            
                query.where(p);
                return null;
            }

now you want to query a specified field, such as name. Ask for advice

Apr.23,2022

is the field you are talking about a database operation?

it is recommended to take a look at orm frameworks that are often used in java development, such as mybatis and jpa

Menu