摘要:With the rapid development of Internet, B/S architecture has occupied the dominate place in information system engineering. Countless frameworks have emerged to boost the development of B/S systems. But how to take advantage of the convenience and avoid being tied to the chariot of these frameworks has become a dilemma for programmers. The paper analyzed the shortage of general query in layered structure, combined with idea of off-line query from Hibernate framework, named DetachedCriteria, proposed a new middle layer to accommodate the needs of off-line query to avoid the restrictions in the use of DetachedCriteria query under the Spring framework. The work principle and structure of the DetachedCriteria middle layer were illustrated using a real project on food origin tracing.