I was wondering if it's possible to associate a dialect scope for named native sql queries in the mappings xml file. I'm looking for the dialect-scope functionality that the <database-object> element provides, but inside the <sql-query> element.
For example:
Code:
<sql-query name="nextSequenceVal">
<return-scalar column="value" type="integer"/>
<dialect-scope name="org.hibernate.dialect.PostgreSQLDialect"/>
select nextval('mysequence') as value
</sql-query>
<sql-query name="nextSequenceVal">
<return-scalar column="value" type="integer"/>
<dialect-scope name="org.hibernate.dialect.OracleDialect"/>
select mysequence.nextval as value from dual
</sql-query>
I could work around it I suppose by giving each named query the naming convention "queryname.dialect", but then my application code would have to somehow determine the dialect for given a hibernate Session or JPA EntityManager (which there is no way that I've been able to determine).
Any suggestions or ideas? Should I file a feature request in jira?
Thanks in advance,
--Mike
[/code]