-->
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.  [ 2 posts ] 
Author Message
 Post subject: Show Query
PostPosted: Thu Oct 15, 2015 11:23 am 
Newbie

Joined: Fri Oct 02, 2015 6:11 am
Posts: 6
Hi. I want view the query.
I know that in xml configuration you must put in xml
<properties>
<property name="hibernate.show_sql" value="true" />
</properties>

But there is a problem. My programm has a java configuration.
So? do you know any solution?
thanks you!!!!


Top
 Profile  
 
 Post subject: Re: Show Query
PostPosted: Thu Oct 15, 2015 12:43 pm 
Hibernate Team
Hibernate Team

Joined: Fri Sep 09, 2011 3:18 am
Posts: 295
Hi,
How do you create the session factory the session factory?

You can set the same property programmatically using the Configuration class:
Code:
import org.hibernate.cfg.Environment
...
new Configuration()
            .setProperty( AvailableSettings.SHOW_SQL, "true" ).
            .buildSessionFactory()


alternatively, you can set the following log category in your log configuration:
Code:
org.hibernate.SQL


As explained in the documentation: http://docs.jboss.org/hibernate/orm/4.3/manual/en-US/html/ch03.html#configuration-logging

Cheers,
Davide


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