Issue
Is there a way to get some information of the underlying database version through the Hibernate 3.2 API? I failed to find relevant bits both here and the javadoc.
Solution
Getting the version of your database engine is implementation specific. This means that there's no shared method for getting the version and so Hibernate cannot really provide an API since it is not bound to any particular RDBMS. For example, here are some different ways you get the version with SELECT statements from some well-known RDBMSs:
- Oracle: SELECT * FROM v$version;
- SQL Server: SELECT @@version
- MySQL: SELECT VERSION()
- ...
You could create a view that reports the version and then add that to your ORM which would then be accessible as any other Hibernate object.
Answered By - Paul Sasik
Answer Checked By - Marilyn (JavaFixing Volunteer)