Hi , inside my hibernate.cfg.xml I am mentioning hibernate.default_schema as schema name (say "testSchema") and it is working with named queries and HQL as expected.But when I am using a native sql query ,say
String queryString= 'select field1 from table1 where field2=100'; SQLQuery queryObj=session.createSQLQuery(queryString). addScalar("field1 ",Hibernate.STRING);
In that case the schema name(i.e. testSchema)is not getting appended to the table names. As a work around I had to add the schema name name before the table names. So the changed code is , String queryString= 'select field1 from testSchema.table1 where field2=100'; .....
But it is not the correct approach I guess.If there are 100 queries and in future my schema name changes, I have to change the schema name at 100 places. Can anybody provide me the correct implementation ?