import org.hibernate.SessionFactory; import org.hibernate.boot.MetadataSources; import org.hibernate.boot.registry.StandardServiceRegistryBuilder; /** Not part of the test run. Compiled against one Hibernate, then run on another to see linkage errors. */ public class BinaryProbe { public static void main(String[] args) { var registry = new StandardServiceRegistryBuilder() .applySetting("hibernate.connection.url", "jdbc:h2:mem:probe;DB_CLOSE_DELAY=-1") .applySetting("hibernate.connection.username", "sa") .applySetting("hibernate.hbm2ddl.auto", "create-drop").build(); try (SessionFactory sf = new MetadataSources(registry).addAnnotatedClass(com.ankurm.h8.Author.class) .buildMetadata().buildSessionFactory()) { try (var s = sf.openSession()) { var q = s.createQuery("from Author", com.ankurm.h8.Author.class); System.out.println("createQuery ran, rows = " + q.getResultList().size()); } } } }