Spring boot app connecting to 2 H2 databases - oracle

In production, my app will need to talk to two different relational databases from different vendors (for example DB2 and MySQL or Oracle)
For development, I intend to use H2 databases to represent the two used in production.
For example TableA is what will be in DB2 and TableB will be in Oracle.
How to configure H2 this way so it knows that JPA/Hibernate generates TableA for DB2 AND TableB for Oracle?

You can separate your application into two apps. Then use restTemplate to get data from one app to another.
So in dev mode use h2 in each app.

Related

how to use one database at a time from multiple ones in springboot

i am working on a spring boot project I am using multiple databases and all databases have same table I need to pass a number in the request based on the number I need to select one database from all databases and run the query any suggestion how to do it

How to configure and Add two databases in Spring JPA

Am using Mysql database and hibernate in JPA. I have two mysql databases in my project. I want to configure these two databases in configuration class of spring JPA. Already I have configured for one datasource using jpa transaction manager bean. I want to add one more datasource to configure. Please consider below scenario.
Mysql Database db1
-Table 1, Table2, Table3
Mysql Database db2
-Table1, Table2
I want to add jpa configuration for above two sql database. Different connections. Whenever repository interface calls for the particular entity, that database should be get called. Please help anyone on this. Thanks in advance.

Spring boot - h2 and Oracle no 100% compatibility

I am using H2 in Spring boot app and Oracle DB on production.
For checking migration files I use FlyWay.
Unfortunately, H2 isn't compatible with Oracle (even if is set Oracle mode).
So, I can't validate my migrations files.
When I have a H2 query - validation in my project is ok, but when I upload it to production - it won`t work on Oracle.
Have you got any ideas how can I validate oracle migration files on my h2-db project?
The Flyway FAQ covers this under db specific SQL:
You can use the flyway.locations property. It would look like this:
TEST (Derby): flyway.locations=sql/common,sql/derby
PROD (Oracle): flyway.locations=sql/common,sql/oracle
You could then have the common statements (V1__Create_table.sql) in common and different copies of the DB-specific statements (V2__Alter_table.sql) in the db-specific locations.
Another approach if the differences are really minor ie only a few keywords, would be to have the keywords that differ as Flyway placeholders:
ALTER TABLE table_name ${alter_column} COLUMN column_name datatype;
TEST (H2): flyway.placeholders.alter_column=ALTER
PROD (Oracle): flyway.placeholders.alter_column=MODIFY

Spring boot - connect hibernate with one oracle huge table

I am creating a spring boot application and I only have one table in my oracle database (one table with more than 80 fields...), so, what is the best way to implement this in my spring boot-groovy app?
Do I need to have one entity with 80 attributes??
Can I have a hibernate entity model different from the awful oracle model? (having more than one entity in my app but connected with the same huge table).
Any ideas or tools are more than welcome.

More than one instance of any JBOSS Product with oracle not working

I am using jboss products like GateIn, JBPM, Drools Guvnor...etc. By default all of those products provide HSQL DB database. I migrated the HSQLDB database to Oracle db. Here what is the problem is when i create two instance of any product (eg: GateIn) in two machines and connect its JCR/IDM tables with same oracle by creating two user instance only one GateIn will become works fine and the other one shows some database errors of JCR and IDM tables
Is oracle shares anything common in the case of JCR and IDM tables creation other than tables?
I got same issue in the case of JBPM, Drools Guvnor too. I am running those products in JBoss server
For GateIn you must add the property "gatein.idm.datasource.schema" in the configuration.properties file, with the name of the schema. For example gatein.idm.datasource.schema=MYSCHEMA1

Resources