Hibernate show real SQL

0 votes

if I set

<property name="show_sql">true</property>

in my hibernate.cfg.xml configuration file in the console I can see the SQL.

But it's not real SQL... Can I see the SQL code that will be passed directly to database?

Jul 5, 2018 in Java by Daisy
• 8,040 points
63 views

1 answer to this question.

0 votes

If you want to see the SQL sent directly to the database , you'll have to use some kind of jdbc driver proxy like P6Spy (or log4jdbc).

Alternatively you can enable logging of the following categories:

log4j.logger.org.hibernate.SQL=DEBUG
log4j.logger.org.hibernate.type=TRACE

The first is equivalent to hibernate.show_sql=true, the second prints the bound parameters among other things.

answered Jul 5, 2018 by Sushmita
• 6,840 points

Related Questions In Java

0 votes
1 answer

How do I get the size of a java.sql.ResultSet?

Give column a name.. String querys = "SELECT ...READ MORE

answered Jul 2, 2018 in Java by samarth295
• 2,190 points
862 views
0 votes
1 answer

How to retrieve column names from java.sql.ResultSet?

You may refer the below code: ResultSet ...READ MORE

answered Jul 4, 2018 in Java by sophia
• 1,400 points
63 views
0 votes
1 answer

Retrieving query from java.sql.PreparedStatement

By using prepared statements, you can't retrieve the query ...READ MORE

answered Oct 12, 2018 in Java by code.reaper12
• 3,450 points
182 views
+1 vote
10 answers

Hibernate hbm2ddl.auto possible values and their uses

hibernate.hbm2ddl.auto (e.g. none (default value), create-only, drop, create, create-drop, validate, and update) Setting to perform SchemaManagementTool actions automatically as ...READ MORE

answered Dec 7, 2018 in Java by Shuvodip
4,287 views
0 votes
1 answer

object references an unsaved transient instance - save the transient instance before flushing

You should add cascade="all" (if using xml) ...READ MORE

answered Sep 26, 2018 in Java by parth295
• 4,600 points
2,706 views
0 votes
1 answer

What's the difference between @JoinColumn and mappedBy when using a JPA @OneToMany association?

The annotation @JoinColumn indicates that this entity is the owner of ...READ MORE

answered Oct 18, 2018 in Java by Sushmita
• 6,840 points
1,722 views
0 votes
1 answer

Difference between FetchType LAZY and EAGER in Java Persistence API?

Sometimes you have two entities and there's ...READ MORE

answered Dec 5, 2018 in Java by Daisy
• 8,040 points
321 views
0 votes
1 answer

How can we convert java.util.Date to java.sql.date in Java?

Use java.time classes instead of java.util.Date & java.sql.Date with JDBC 4.2 or ...READ MORE

answered Jun 29, 2018 in Java by Sushmita
• 6,840 points
63 views
0 votes
1 answer

Can anyone show how to implement SortByValue in Tree Map for Java ?

You can't have the TreeMap itself sort on the ...READ MORE

answered Dec 10, 2018 in Java by Sushmita
• 6,840 points

edited Dec 10, 2018 by Sushmita 55 views
0 votes
1 answer

Do real-time data processing is possible with Spark SQL?

Hey, Real-time data processing is not possible directly ...READ MORE

answered Jul 5 in Apache Spark by Gitika
• 19,720 points
13 views