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

Steve Ebersole (JIRA) noreply at atlassian.com
Tue Oct 20 15:02:28 EDT 2009


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

Steve Ebersole commented on HHH-2576:
-------------------------------------

Hey Paul, well like I said this originally grew from a desire to add this to metadata fragments.  For example, currently a user might say something like:
<formula>crypt(my_password_column)</formula>

Or even better imagine this with HHH-4440:
<column name="my_password_column" read="decrypt(my_password_column)" write="crypt(?)/>

Now here the user is restricted to running this mapping on databases which support functions named crypt and decrypt.  If instead these function names could be resolved against the SQLFunctionRegistry, ThatWouldBeGoodness.  So that is one basic impetus here.

These are pretty straight forward examples.  Not much potential ambiguity in terms of parsing and interpreting what the user intended (the parentheses are a great disambiguate-er).  Stupid example, but consider:
<formula>current_timestamp</formula>
Do we need to qualify this (pre-pend the alias)?  The problem is that here we have syntactic ambiguity.  The only way to alleviate this ambiguity is semantically: what does "current_timestamp" *mean*?  However, this form is syntactically non-ambiguous:
<formula>{fn: current_timestamp}</formula>

This syntactic ambiguity issue is another impetus.

That is where all this got started.  And we have not even discussed more complicated formula mappings yet where both of these come into play...

Anyway, I just saw potential synergy there with this discussion.


> 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
>         Attachments: HHH-2576-01.patch
>
>
> 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