Queries across different database Types

We will be supporting more than one database type as a deployment option. It looks like I’m going to have to resort to using the createNativeQuery call on EntityManager as I’m going to need to run some queries not supported in JPQL. Is there a convention for hot-swapping queries depending on the target database you are working with?


No, you have to create your own mechanism. Use PersistenceManagerService#getDbmsType to determine current DBMS type and Persistence#getDbTypeConverter to convert parameters and results if needed.

Thanks. That’ll be helpful.