[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-2576) Allow native-sql to have placeholders for default schema and catalog

Paul Benedict (JIRA) noreply at atlassian.com
Thu Oct 15 12:01:41 EDT 2009


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-2576?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=34209#action_34209 ] 

Paul Benedict commented on HHH-2576:
------------------------------------

I wrote a patch and will upload it soon. This is how I have approached the issue, and am sharing my philosophy early to receive any feedback. All Hibernate properties will become available to SQL parsing. They are under the alias "hibernate" such as: 

SELECT * FROM {hibernate.default_schema}.table 
SELECT * FROM table FETCH FIRST {hibernate.default_batch_fetch_size} ROWS ONLY

I gave two special considerations "hibernate.default_schema" and "hibernate.default_catalog". If these property names actually end in a dot, I include the dot at the end, which will facilitate allowing fully-qualified objects being optional if these properties are not specified.

This requires a default schema otherwise the SQL is invalid:
SELECT * FROM {hibernate.default_schema}.table 

This allows the schema to be totally optional:
SELECT * FROM {hibernate.default_schema.}table 

> Allow native-sql to have placeholders for default schema and catalog
> --------------------------------------------------------------------
>
>                 Key: HHH-2576
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2576
>             Project: Hibernate Core
>          Issue Type: Improvement
>          Components: query-sql
>    Affects Versions: 3.2.3
>            Reporter: Max Rydahl Andersen
>
> we shold consider allowing something like:
> <sql-query name="queryName" callable="true">
> { call ${default_schema}.storedProcName() }
> </sql-query>
> similar for normal SQL queries too.
> <sql-query name="queryName">
> select * from ${default_schema}.CUSTOMER x where ...
> </sql-query>
> Maybe ${catalogschema} should be allowed to which would be the full prefix needed dependent on the dialect and would free one from having both catalog and schema + poper seperators in there.

-- 
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