# Is using an ORM like Hibernate recommended in a Gateway module?

**URL:** <https://forum.inductiveautomation.com/t/is-using-an-orm-like-hibernate-recommended-in-a-gateway-module/116802>\
**Category:** Ignition\
**Created:** [August 17, 2026, 10:49am UTC](https://forum.inductiveautomation.com/t/is-using-an-orm-like-hibernate-recommended-in-a-gateway-module/116802 "2026-08-17T10:49:54Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![rockson.agyeman](https://avatars.discourse-cdn.com/v4/letter/r/7c8e57/32.png) [@rockson.agyeman](https://forum.inductiveautomation.com/u/rockson.agyeman)\
**Post date:** [August 17, 2026, 10:49am UTC](https://forum.inductiveautomation.com/t/is-using-an-orm-like-hibernate-recommended-in-a-gateway-module/116802/1 "2026-08-17T10:49:54Z")

</div>

I'm building a Gateway-scoped module with a decent-sized relational domain model, and I'd like to use an ORM like Hibernate rather than hand-writing data access objects over SRConnection. I'd like some clarification on whether that's a recommended approach here in Ignition 8.3. I couldn't find any prior discussion of it on the forum. Thank you!

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [August 17, 2026, 12:27pm UTC](https://forum.inductiveautomation.com/t/is-using-an-orm-like-hibernate-recommended-in-a-gateway-module/116802/2 "2026-08-17T12:27:36Z")

</div>

There's no recommendation for or against such. If it helps you maintain **correctness** , go for it.

---

<div class="post-metadata">

**Author:** ![rockson.agyeman](https://avatars.discourse-cdn.com/v4/letter/r/7c8e57/32.png) [@rockson.agyeman](https://forum.inductiveautomation.com/u/rockson.agyeman)\
**Post date:** [August 17, 2026, 1:05pm UTC](https://forum.inductiveautomation.com/t/is-using-an-orm-like-hibernate-recommended-in-a-gateway-module/116802/3 "2026-08-17T13:05:09Z")

</div>

Thanks a lot Phil for your answer. That's useful to know, and it's the answer I was hoping for rather than a hard no.

I have got a bare-bones bootstrap running, that is, Hibernate ORM 8.0.0.Beta1 against MariaDB 11.8, with `SessionFactory` built in the Gateway hook. So the basic feasibility question is answered. What I'm less sure about is the design around it, so I'll be happy to get some expert advice.

**1. Delegating to `DatasourceManager`, or not.**  
Right now Hibernate is using `DriverManagerConnectionProvider` and opening its own connections, which means the pool is invisible to Ignition (Database Connections). Naturally, it gets none of the platform's failover. The alternative is a custom `ConnectionProvider` that delegates `getConnection()` to `context.getDatasourceManager().getConnection(name)` and closes on release, with `hibernate.connection.handling_mode` set to release-after-transaction so connections return promptly.

**Question:** Is `SRConnection` safe to hand to a framework like this, or does it assume `SRConnection` being used directly?

**2. JDBC driver visibility.**  
We're currently naming the driver class explicitly.

**Question:** If we move to a real pool, will `DriverManager`'s `ServiceLoader` discovery find a driver jar bundled inside the module's ClassLoader, or should we always construct the vendor `DataSource` directly?

Essentially, I'd like to know if there are any ignition platform expectations I am likely to be quietly breaking? Thanks a lot for your time!

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [August 17, 2026, 1:34pm UTC](https://forum.inductiveautomation.com/t/is-using-an-orm-like-hibernate-recommended-in-a-gateway-module/116802/4 "2026-08-17T13:34:01Z")

</div>

1. `SRConnection` extends JDBC's `Connection`, so it is safe to use for any **vanilla** JDBC purposes. It is **necessary** to use it to get Ignition's connection setup and pooling, and **not** using it will seriously break users' expectations for status/performance monitoring. As well as breaking users' expectations for things like secrets management.

I strongly recommend you use a custom `ConnectionProvider` to bridge Hibernate to Ignition's vanilla connections.

1. Ignition's JDBC drivers are in isolated classloaders. It is difficult to get access to the actual JDBC driver instances (via reflection on connection pool objects), and may be entirely protected in future Ignition versions. You **may** be able to declare a module dependency on v8.3's new modularized drivers. If you cannot make Hibernate work without bundling a driver jar in your module, I would drop the idea entirely.

---

<div class="post-metadata">

**Author:** ![rockson.agyeman](https://avatars.discourse-cdn.com/v4/letter/r/7c8e57/32.png) [@rockson.agyeman](https://forum.inductiveautomation.com/u/rockson.agyeman)\
**Post date:** [August 17, 2026, 1:46pm UTC](https://forum.inductiveautomation.com/t/is-using-an-orm-like-hibernate-recommended-in-a-gateway-module/116802/5 "2026-08-17T13:46:40Z")

</div>

Thank you!
