[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-5692) Invalid {h-schema} replacement in native sql queries
Greg Maczuga (JIRA)
noreply at atlassian.com
Tue Oct 26 08:32:48 EDT 2010
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-5692?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=38871#action_38871 ]
Greg Maczuga commented on HHH-5692:
-----------------------------------
Workaround for Spring is to use LocalSessionFactoryBean and override postProcessConfiguration method
@SuppressWarnings("unchecked")
@Override
protected void postProcessConfiguration(Configuration config) throws HibernateException {
String defaultSchema = config.getProperty(DEFAULT_SCHEMA_PROPERTY_NAME);
Set<String> queriesNames = config.getNamedSQLQueries().keySet();
for (String name : queriesNames) {
NamedSQLQueryDefinition namedSQLQuery = (NamedSQLQueryDefinition) config.getNamedSQLQueries().get(name);
if (namedSQLQuery.getQuery().contains(SCHEMA_PLACEHOLDER)) {
String query = namedSQLQuery.getQuery().replace(SCHEMA_PLACEHOLDER, defaultSchema + ".");
NamedSQLQueryDefinition newQuery = new NamedSQLQueryDefinition(query, namedSQLQuery.getQueryReturns(),
namedSQLQuery.getQuerySpaces(), namedSQLQuery.isCacheable(), namedSQLQuery.getCacheRegion(),
namedSQLQuery.getTimeout(), namedSQLQuery.getFetchSize(), namedSQLQuery.getFlushMode(),
namedSQLQuery.getCacheMode(), namedSQLQuery.isReadOnly(), namedSQLQuery.getComment(),
namedSQLQuery.getParameterTypes(), namedSQLQuery.isCallable());
// replace named query definition
config.getNamedSQLQueries().put(name, newQuery);
}
}
}
> Invalid {h-schema} replacement in native sql queries
> ----------------------------------------------------
>
> Key: HHH-5692
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5692
> Project: Hibernate Core
> Issue Type: Bug
> Affects Versions: 3.5.3
> Reporter: Greg Maczuga
> Original Estimate: 1h
> Remaining Estimate: 1h
>
> Native-sql placeholders for default schema and catalog i.e. {h-schema} replacement implemented in HHH-2576 have bug.
> It doesn't replace {h-schema} in stored procedures calls due to embed brackets i.e. "{ ? = call {h-schema}manager.check(:userId)}" do NOT get replaced correctly.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the hibernate-issues
mailing list