Dynamically setting schema name for native queries in hbm file

Description

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

<sql-query name="myQuery">
<return-scalar column="NAME" type="java.lang.String"/>
<return-scalar column="SURNAME" type="java.lang.String"/>

SELECT NAME,SURNAME FROM ${hibernate.default_schema}.TBEMPLOYEE
</sql-query>

In that case the schema name(i.e. testSchema)is not getting appended to the table names.

I tried this for Hibernate version 3.3.0 and 3.3.2. But it is not working.

Can anybody provide me the correct implementation ? Do anyone know correct syntax?

Environment

None

Activity

Show:
Niraj Gadgilwar
June 24, 2010, 8:41 AM
Edited

I gone through SQLQueryParser.java class of v 3.3.0, 3.3.1 and 3.3.2.
But I didn't find the changes related to schema which was mentioned in patch HHH-2576-R5.patch.

Am I downloading wrong jars of Hibernate?
I am using following link to download the jars.

https://olex.openlogic.com/packages/hibernate/3.3.2.GA#

Niraj Gadgilwar
June 24, 2010, 9:02 AM

Thanks Strong...

Could you provide me the link to download 3.5.3 jar?
I am trying to get it download it from http://sourceforge.net/projects/hibernate/files/
But I think there is some problem.

Strong Liu
June 24, 2010, 9:13 AM
Niraj Gadgilwar
June 24, 2010, 10:22 AM

Hi strong,

Thanks for your help. I downloaded 3.5.3 jar and {h-schema} is perfectly working for me.

Thanks.

Philippe
September 24, 2015, 2:04 PM

Hi,

I am under the 4.3.7 version, and the h-schema tag isn't working anymore.

I'm trying to use it in the @SQLInsert. Actually I can't find no way to define a defaut schema for this query neither for native query.

Help !

Thanks

Assignee

Strong Liu

Reporter

Niraj Gadgilwar

Fix versions

None

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Major
Configure