Dump Hibernate activity to sql script file

Posted by zeven on Stack Overflow See other posts from Stack Overflow or by zeven
Published on 2010-05-05T15:56:53Z Indexed on 2010/05/05 15:58 UTC
Read the original article Hit count: 141

Filed under:
|
|

Hi,

I'm trying to log hibernate activity (only dml operations) to an sql script file. My goal is to have a way to reconstruct the database from a given starting point to the current state by executing the generated script.

I can get the sql queries from log4j logs but they have more information than the raw sql queries and i would need to parse them and extract only the helpful statements.

So i'm looking for a programatic way, maybe by listening the persist/merge/delete operations and accessing the hibernate-generated sql statements.

I don't like to reinvent the wheel so, if anybody know a way for doing this i would appreciate it very much.

Thanks in advance

© Stack Overflow or respective owner

Related posts about hibernate

Related posts about sql