Repository navigation
Commit 4ad86d7
authored
test(jdbc): add Hibernate integration smoke tests (#264)
## Summary
Promotes the Hibernate smoke prototype into `libsql-jdbc` as a Failsafe
integration test.
- `HibernateIT` drives the in-tree driver through Hibernate ORM 7.4:
identity-generated keys, scalar mapping, `@ManyToOne` associations, HQL
joins and pagination, repeated inserts, schema validation, and
optimistic locking.
- `HibernateSqldSupport` starts the pinned sqld Testcontainer and
creates the schema through JDBC. Hibernate 7.4's SQLite dialect emits an
untyped identity column for `book`, so its own DDL is not used; the
validator test still reads the schema back through the driver's
`DatabaseMetaData`.
- Optimistic locking coverage:
- version increment on a successful update;
- explicit `OPTIMISTIC_FORCE_INCREMENT`;
- stale detached merge;
- stale delete;
- versioned update through a foreign-key association;
- timestamp-valued `@Version` round-trip and stale merge.
- Stale-write tests assert Hibernate receives an update count of `0`,
throws an optimistic-lock exception, and leaves the stored row
unchanged.
- Test-only dependencies: Hibernate 7.4.13, Testcontainers, and Failsafe
`*IT` wiring. `./mvnw test` stays unit-only.
- The module copies the shared Docker config into `target/docker-config`
and sets `DOCKER_CONFIG` for Failsafe, so sandboxed runs work without a
shell override.
## Driver findings
No driver-level defects surfaced in the covered Hibernate paths.
Generated keys, versioned update/delete counts, timestamp comparisons,
and schema validation all behaved correctly.
## Auto-commit identity
`#83` already tracks the relevant limitation: in auto-commit, a direct
`SELECT last_insert_rowid()` reads a fresh Hrana stream. Hibernate's
`GenerationType.IDENTITY` uses that same query, so this suite keeps
auto-commit disabled (Hibernate's default) and documents the dependency.
No duplicate issue was created.
Refs #83
## Test plan
- [x] `./mvnw -pl libsql-jdbc -am -Dit.test=HibernateIT
-Dtest=NoSuchTest -Dsurefire.failIfNoSpecifiedTests=false verify` — 11
tests pass
- [x] `./mvnw spotless:check`
- [x] `./prototype/hibernate-smoke/run.sh` — 11 prototype tests pass
against a throwaway sqld container1 parent 08a3531 commit 4ad86d7
7 files changed
Lines changed: 649 additions & 0 deletions
File tree
- libsql-jdbc
- src/test/java/io/github/magnusp/libsql/jdbc/hibernate
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
41 | 53 | | |
42 | 54 | | |
43 | 55 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
0 commit comments