Rob,
 
Is it possible to see the values passed to sql queries ?During debugging ,it 
would be really great to know what values are being passed to sql queries 
 
Thanks & Regards
_______________________________
Khaliq  
________________________________

From: Rob Hills [mailto:[EMAIL PROTECTED]
Sent: Mon 1/14/2008 10:04 AM
To: [email protected]
Subject: Re: [appfuse-user] SOLVED - AppFuse 2.0 + Hibernate - logging SQL 
Parameters



Hi All,

I've actually found a way of manipulating Hibernate logging from the pom.xml 
and/or profiles.xml

The key is to define the logging properties in your hibernate.cfg.xml file 
using placeholders and Appfuse will automagically
substitute in values you have defined in your pom/profile.

To be specific:

Define the following default values in your pom (ie switch off SQL logging by 
default):

<properties>
    <..>
    <hibernate.show.sql>false</hibernate.show.sql>
    <hibernate.format.sql>false</hibernate.format.sql>
    <..>
</properties>

Then in the appropriate profile (eg dev and/or test profiles), turn them on:
<properties>
    <..>
    <hibernate.show.sql>true</hibernate.show.sql>
    <hibernate.format.sql>true</hibernate.format.sql>
    <..>
</properties>

And to make them actually work, simply put the following into your 
hibernate.cfg.xml file:

<session-factory>
    <property name="hibernate.show_sql">${hibernate.show.sql}</property>
    <property name="format_sql">${hibernate.format.sql}</property>
    <mapping package="....etc..." />
</session-factory>

Oh, and finally, don't be seduced by the attractive sounding "use_sql_comments" 
property in your hibernate.cfg.xml, I
have found that it does something weird to the login process so you can't 
actually log in to an appfuse app with it switched
on.  If you're curious, try putting this in your hibernate.cfg.xml:

<session-factory>
    <-- etc -->
    <property name="use_sql_comments">true</property>
    <-- etc -->
</session-factory>

Cheers,
Rob Hills
Waikiki, Western Australia
Mobile +61 (412) 904-357
Fax: +61 (8) 9529-2137

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 
Confidentiality Statement:
 
This message is intended only for the individual or entity to which it is 
addressed. It may contain privileged, confidential information which is exempt 
from disclosure under applicable laws. If you are not the intended recipient, 
please note that you are strictly prohibited from disseminating or distributing 
this information (other than to the intended recipient) or copying this 
information. If you have received this communication in error, please notify us 
immediately by return email.
-----------------------------

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to