I was wondering if there is a way to get the default schema name from session factory, somehow? The reason I need to get it is because I have to use a one native SQL and I have
I had problems with John's solution to use {h-schema} when using the Criteria api's Restrictions.sqlRestriction(...) (probably because this substitution happens within the separate HQL api). Similar to Michael's solution, I used:
SessionFactoryImplementor sfi = (SessionFactoryImplementor)sessionFactory;
String name = sfi.getSettings().getDefaultSchemaName();