log4j.properties
log4j.logger.org.hibernate=INFO, hb log4j.logger.org.hibernate.SQL=DEBUG log4j.logger.org.hibernate.type=TRACE log4j.logger.org.hibernate.hql.ast.AST=info log4j.logger.org.hibernate.tool.hbm2ddl=warn log4j.logger.org.hibernate.hql=debug log4j.logger.org.hibernate.cache=info log4j.logger.org.hibernate.jdbc=debug log4j.appender.hb=org.apache.log4j.ConsoleAppender log4j.appender.hb.layout=org.apache.log4j.PatternLayout log4j.appender.hb.layout.ConversionPattern=HibernateLog --> %d{HH:mm:ss} %-5p %c - %m%n log4j.appender.hb.Threshold=TRACE
hibernate.cfg.xml
<property name="show_sql">true</property> <property name="format_sql">true</property> <property name="use_sql_comments">true</property>
persistence.xml
Some frameworks use persistence.xml
:
<property name="hibernate.show_sql" value="true"/> <property name="hibernate.format_sql" value="true"/> <property name="hibernate.use_sql_comments" value="true"/>
Related Posts:
- Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
- How to fix org.hibernate.LazyInitializationException – could not initialize proxy – no Session
- How to fix the Hibernate “object references an unsaved transient instance – save the transient instance before flushing” error
- How to fix the Hibernate “object references an unsaved transient instance – save the transient instance before flushing” error
- What’s the difference between JPA and Hibernate?
- How to map a composite key with JPA and Hibernate?
- HTTP Status 405 – Request method ‘POST’ not supported (Spring MVC)
- org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘MyController’:
- Error creating bean with name ‘entityManagerFactory’ defined in class path resource : Invocation of init method failed
- What does the following Oracle error mean: invalid column index
- org.hibernate.HibernateException: Access to DialectResolutionInfo cannot be null when ‘hibernate.dialect’ not set
- What does the following Oracle error mean: invalid column index
- Error creating bean with name ‘entityManagerFactory’ defined in class path resource : Invocation of init method failed
- Unable to create requested service [org.hibernate .engine.jdbc.env.spi.JdbcEnvironment]-MySQL
- org.hibernate.HibernateException: Access to DialectResolutionInfo cannot be null when ‘hibernate.dialect’ not set
- org.hibernate.HibernateException: Access to DialectResolutionInfo cannot be null when ‘hibernate.dialect’ not set
- What’s the difference between session.persist() and session.save() in Hibernate?
- What’s the advantage of load() vs get() in Hibernate?
- HTTP Status 405 – Request method ‘POST’ not supported (Spring MVC)
- What Java ORM do you prefer, and why?
- What are the possible values of the Hibernate hbm2ddl.auto configuration and what do they do
- PersistentObjectException: detached entity passed to persist thrown by JPA and Hibernate
- Hibernate Error: a different object with the same identifier value was already associated with the session
- How to solve the “failed to lazily initialize a collection of role” Hibernate exception
- hibernate properties not found
- How do I get the size of a java.sql.ResultSet?
- Efficient way to do batch INSERTS with JDBC
- What kind of Java type is “[B”?
- Hibernate – Batch update returned unexpected row count from update: 0 actual row count: 0 expected: 1
- How to convert java.util.Date to java.sql.Date?
- In a simple to understand explanation, what is Runnable in Java?
- Java – How to use \t in my example [duplicate]
- Android Studio Could not initialize class org.codehaus.groovy.runtime.InvokerHelper
- String concatenation: concat() vs “+” operator
- How to remove the last character from a string?
- Java : Comparable vs Comparator [duplicate]
- Convert int to char in java
- How to request.getParameterNames into List of strings?
- How can I prevent java.lang.NumberFormatException: For input string: “N/A”?
- stale element reference: element is not attached to the page document
- Error: can only iterate over an array or an instance of java.lang.Iterable
- Why can array constants only be used in initializers?
- Where is Java’s Array indexOf?
- How to check if an int is a null
- How do I apply the for-each loop to every character in a String?
- Session TimeOut in web.xml
- Java – removing first character of a string
- How to send a Map in JSON
- What is the significance of log4j.rootLogger property in log4j.properties file? What happens if I don’t use this property?
- “Instantiating” a List in Java? [duplicate]
- Missing `server’ JVM (Java\jre7\bin\server\jvm.dll.)
- Convert String array to ArrayList
- java uses or overrides a deprecated API error
- What is setBounds and how do I use it?
- Exception in thread “main” java.lang.NumberFormatException: For input string: “S”
- Java Console Prompt for ENTER input before moving on [duplicate]
- Remove last character of a StringBuilder?
- Why SpringMVC Request method ‘GET’ not supported?
- Error: JAVA_HOME is not defined correctly executing maven
- Eclipse No tests found using JUnit 5 caused by NoClassDefFoundError for LauncherFactory
- Android – SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
- How to sort an array of objects in Java?
- Filling a 2D array in Java
- How to compress a String in Java?
- Java end of file
- A KeyValuePair in Java
- Unclosed Character Literal error
- Java error: void cannot be converted to String
- CreateProcess error=2, The system cannot find the file specified
- Add String Array to ArrayList
- Java Array Sort descending?
- The import javafx cannot be resolved
- Java Copy Constructor ArrayLists
- Implementing an actionlistener to a JTextField
- StringIndexOutOfBoundsException String index out of range: 0
- Cannot resolve method in java
- Using regex to match any character except =
- Why is a ConcurrentModificationException thrown and how to debug it
- How to sort a HashSet?
- Variable used in lambda expression should be final or effectively final
- Populate int array with for loop in Java
- calling boolean method, heads or tails
- Android Color Picker
- How to fix an UnsatisfiedLinkError (Can’t find dependent libraries) in a JNI project
- How to Delete a topic in apache kafka [duplicate]
- Java Main Game Loop
- “Integer number too large” error message for 600851475143
- How to fix java.lang.UnsupportedClassVersionError: Unsupported major.minor version
- JPA or JDBC, how are they different?
- Why is Netbeans suggesting I “Flip operands of the binary operators” in my Java code
- How to resolve “Syntax error on token “else”” in Java?
- What’s the difference between Jetty and Netty?
- Is there a way to simulate the C++ ‘friend’ concept in Java?
- Good way to encapsulate Integer.parseInt()
- What is the difference between “Double” and “double” in Java?
- What is the purpose of the default keyword in Java?
- What exactly is Ajax request? Is it different from Servlet Request?
- java ‘jar’ is not recognized as an internal or external command
- A JRE or JDK must be available in order to run Eclipse. No JVM was found after searching the following locations
- Why cannot cast Integer to String in java?