Add h8-preview module: hibernate-demo suite against Hibernate 8.0.0.Beta3 and Jakarta Persistence 4.0.0-M7
Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Gth99spB1CzQmBFofXmU4Z
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
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());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user