Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Database-dependent SQL statements

EclipseLink uses something called a DatasourcePlatform to represent the DB you are running on.

To get the DatasourcePlatform use:

org.eclipse.persistence.jpa.JpaHelper.getServerSession(entityManagerFactory).getPlatform()

DatasourcePlatform has methods like: isOracle(), isMySQL() etc...

-Tom

Tim Hollosy wrote:
Could you run a native sql query to return the name of the db?

./tch



On Mon, Jan 11, 2010 at 10:45 AM, Michael Simons
<michael.simons@xxxxxxxxxxx> wrote:
Hello,

We've got some native native SQL queries to be executed by our program.
These are database-dependent, so we cannot use the Native Query Annotation on the entities.
We retrieve the dependent SQL statements from a file named like the current database, e.g.
the database is mysql so the file's called "mysql.sql".

With JDO the PersistenceManagerFactory told use the name of the database currently accessed.

I couldn't find any method in EntityManagerFactory that tells me this.
How or where can we achieve this Information, please?
Any hints are appreciated.

Kind Regards,
Michael

_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users

_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users


Back to the top