How to resolve the Hibernate global database schema and catalog for native SQL queries

Introduction

When your relation database system uses multiple schemas, then you can instruct Hibernate to use a global schema using the hibernate.default_schema configuration property:

<property name="hibernate.default_schema" value="forum"/>

While Hibernate can imply the default schema whenever dealing with entity queries, for native queries, you need a little trick. This post is going to demonstrate how you can imply the default schema for native SQL queries as well.

Continue reading “How to resolve the Hibernate global database schema and catalog for native SQL queries”