Reputation: 5997
I'm wondering if it's possible to use JPA or other persistence library with PL/Java together? I mean using JPA persistence for manipulationg database over the special JDBC connection provided by PL/Java in stored Java procedures.
Upvotes: 0
Views: 225
Reputation: 324731
It's possible, but a really bad idea. Most ORMs are pretty memory hungry beasts, and PL/Java spawns one JVM per PostgreSQL backend (connection), so that memory-gobbling will be multiplied per-connection. Worse, many ORMs expect to be able to get numerous connections from a pool and use them freely, but when running in PL/Java with the SPI you only really have one connection since PostgreSQL backends are single-threaded and not thread-safe.
I really don't recommend it.
Upvotes: 1