-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: dialect-scope with named native SQL queries?
PostPosted: Tue Apr 15, 2008 12:52 pm 
Newbie

Joined: Tue Apr 15, 2008 12:36 pm
Posts: 1
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]


Top
 Profile  
 
 Post subject: Re: dialect-scope with named native SQL queries?
PostPosted: Fri Oct 02, 2009 2:50 pm 
Newbie

Joined: Fri Oct 02, 2009 2:46 pm
Posts: 2
I agree there should be a way to do this. Hibernate was obviously created with database agnosticism in mind but then seems to shoot itself in the foot by allowing native SQL.

How do others work around this problem?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.