-->
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.  [ 3 posts ] 
Author Message
 Post subject: Capture or redirect the session SQL output
PostPosted: Wed Feb 15, 2006 1:35 pm 
Newbie

Joined: Fri Jan 06, 2006 8:31 pm
Posts: 2
Location: San Francisco, CA
This is a general "is it possible question". My problem at hand is to create a SQL insert, update, delete script based on a set of captured (or known) modifications to one or more tables.

Given a valid hibernate mapping over the relational model, I'm trying to determine if it possible to do something like:

- Open a hibernate session.
- Perform several activities with the mapped objects. create new, find and update, find and delete etc.
- "flush" and/or commit the session and capture the resulting SQL. Ideally some how preventing the SQL from actually being issued to the underlying database.

The core ability of Hibernate to do the SQL statement creation (correctly) is just too tempting to pass up. If anyone knows if this is remotely possible I would appreciate any thoughts or direction.

Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 15, 2006 1:58 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
Interceptor.onPrepareStatement() allows you to trace all the SQL.

But since hibernate validates what it does with the return values it might be hard to get all of the sql without actually executing it ..and the possibly just call rollback afterwards.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 15, 2006 2:17 pm 
Newbie

Joined: Fri Jan 06, 2006 8:31 pm
Posts: 2
Location: San Francisco, CA
Interceptors, of course. That will take care of the capture. I can mess around with ideas around (possibly) returning valid but no-impact SQL.

Thx.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.