-->
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.  [ 1 post ] 
Author Message
 Post subject: Generate native SQL String with Hibernate
PostPosted: Mon Jun 25, 2007 7:01 am 
Newbie

Joined: Mon Jun 25, 2007 6:24 am
Posts: 1
I am building a JDBC adapter. This adapter would have to take the SQL to be executed in the form of, say, fields to be retrieved, join condition, table name etc. I was not sure if all the constraints specified by the user can be adequately represented in ANSI SQL so as to make it DB independent.

Can I leverage Hibernate to delegate this dirty work to it and keep our code clean? Would it be possible for me to pass the query in some standard form (XML or anything else) and get back the native SQL string for that DB from hibernate. I can then use this native SQL string and execute it using JDBC.

I cannot use Hibernate for the entire task as the SQL query to be executed will not be available until runtime. Therefore I would have to generate the classes to map the query dynamically. Also I need to manually work on the ResultSet to iterate over it in some specific fashion.

The questions I have are:

1. Can I pass the query in some standard form (XML or anything else) and get back the native SQL string for that DB from Hibernate? This would be my ideal scenario because I can then use this as a Query Builder engine for other database adapters.

2. Can I pass the query in some standard form (XML or anything else) and get back the ResultSet after executing the query on the database? This is a not so ideal scenario but I can still make this work.

I am also open to suggestions about any other way of achieving this task.

Any help that you guys can provide will be extremely appreciated.


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

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.