Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Get dialect from session (for character escaping)

843859Nov 30 2009 — edited Dec 1 2009
Hi all,

First of all, I'm aware this is not the right place for hibernate questions, but hibernate forums are broken and this this forum is all I have for the time being.

I'm using hibernate and I need to get the dialect being used in order to make some special characters escape, I need to use different escape technique depending upon the dialect.

For example, for mysql I need to escape underscore like this:

query.replaceAll("_", "\\\\_")

for Oracle and HSQL I need to do like this:

query.replaceAll("_", "\\_")

That's why I need to infer the dialect from the org.hibernate.Session, but I just can't see how to do it with the available JavaDocs.

Thanks a lot!
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 29 2009
Added on Nov 30 2009
13 comments
1,426 views