I’m currently working on an old app which is supported by an Oracle database, this app uses a lot of PL/SQL scripts to store procedures in packages, to create users, tables and execute queries. The app connect to the DB and load all the procedures with PL/SQL requests, in the same time, it also create users to be able to delimitate work. Once done, we just use the procedures stored in the DB to do manipulation on the data.
I’m looking if it’s possible to make this app works in a different database (PostgreSQL) but with only writing one main generic code.
Doing some researches, I find out that an ORM would be a good solution, and I choose to use Hibernate. I made a java code (JDK 11) to be able to test if what I want to do is possible. There is no problem when I have to create tables with mapped objects, but when I have to create user (id/password) I have to check for the dialect used and make if/else structure.
Code for creating a user with “if/else”
I was hopping there is a way in hibernate or with another ORM to create user without having to check for the dialect and making if/else. I’d like to know your opinion.
In the same way, I have to use PL/SQL but I saw that this is not a generic language, for PostgreSQL its PL/pgSQL and was wondering if there is any solution to create a generic code for procedures with Hibernate or another ORM
For detail version :
Oracle has to be in version 12 or 19
I use Java 11 and PostgreSQL 15.4
I hope you get enough details to try to help me, thanks !
user25710983 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.