Issue Type: Improvement Improvement
Affects Versions: 4.1.9, 3.6.10
Assignee: Unassigned
Components: core, metamodel
Created: 09/Jan/13 1:08 AM
Description:

Currently, it's not possible to use the configured Session Factory default schema in the query contained in the <subselect> element.

In the SQL native queries this is done using the {h-schema} placeholder, and the same technique could be used here.
I have tested an implementation, it only requires to replace org.hibernate.mapping.Table.getQualifiedName() with the following code:

public String getQualifiedName(Dialect dialect, String defaultCatalog, String defaultSchema) {
String usedSchema = schema == null ?
defaultSchema :
getQuotedSchema( dialect );
String usedCatalog = catalog == null ?
defaultCatalog :
getQuotedCatalog( dialect );
if ( subselect != null ) {
final String qualifyPrefix = qualify( usedCatalog, usedSchema, "" );
return "( " + subselect.replaceAll( "
{h-schema\\}", qualifyPrefix ) + " )";
}
String quotedName = getQuotedName( dialect );
return qualify( usedCatalog, usedSchema, quotedName );
}

Project: Hibernate ORM
Priority: Major Major
Reporter: Miguel Diaz
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira