hibernate_generic_loader_with_optional_fetch — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited hibernate_generic_loader_with_optional_fetch (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
Create a generic Java method using Hibernate/JPA Criteria API to load all entities of a given type, conditionally applying a left-join fetch on a specified field to optimize loading and prevent N+1 issues.
Act as a Java/Hibernate expert. Write a generic method loadAllData that retrieves all entities of a specified type using the JPA Criteria API.
public <T> List<T> loadAllData(Class<T> type, String fieldName).HibernateUtil.getSessionFactory().openSession() to obtain a session.CriteriaBuilder and CriteriaQuery to construct the query.fieldName argument is not an empty String, apply a left-join fetch using root.fetch(fieldName, JoinType.LEFT).fieldName is empty, load data without applying any specific fetch (standard load).T is handled correctly in the CriteriaQuery construction (e.g., using criteria.select(root)).List<T>.setHint); use the Criteria API fetch method.fieldName; handle it gracefully by skipping the fetch.~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.