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,26 @@
|
||||
package com.ankurm.h8;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import org.hibernate.SessionFactory;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/** A JPA @NamedQuery whose text is an UPDATE: accepted or rejected at start-up? */
|
||||
class MutatingNamedQueryTest {
|
||||
|
||||
@Test
|
||||
void recordsStartupOutcome() {
|
||||
Transcript t = new Transcript("03-mutating-named-query");
|
||||
String outcome;
|
||||
try (SessionFactory sf = Db.open(MutatingNamedQueryEntity.class)) {
|
||||
int rows = sf.fromTransaction(s -> s.createNamedQuery("Mutating.rename").setParameter("name", "x").executeUpdate());
|
||||
outcome = "session factory built; createNamedQuery(..).executeUpdate() returned " + rows;
|
||||
}
|
||||
catch (RuntimeException ex) {
|
||||
outcome = "threw " + Db.describe(ex) + " :: " + String.valueOf(Db.root(ex).getMessage()).lines().findFirst().orElse("");
|
||||
}
|
||||
t.line(outcome);
|
||||
t.write();
|
||||
assertThat(outcome).isNotBlank();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user