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';
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 ?
Actually I am trying to write SQL in .hbm file and my requirment is to access the table with schema name.
I have mentioned the default schema name in .cfg file of hibernate.
and now I want to use this default schema in my .hbm file.