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?
- What does Java option -Xmx stand for? [duplicate]
- How do I convert a String to an int in Java?
- What does Java option -Xmx stand for? [duplicate]
- Is there an invisible character that is not regarded as whitespace?
- Problem with gif with transparent background
- Finding white rectangle in an image
- 1000 * 60 * 60 * 24 * 30 results in a negative number [duplicate]
- How to convert nanoseconds to seconds using the TimeUnit enum?
- Search for words with telephone numbers from 2-3-4 tree
- Using or ‘|’ in regex [duplicate]
- How to format strings in Java
- What is the difference between x86 and x64
- && (AND) and || (OR) in IF statements
- How to use the toString method in Java?
- What is a NullPointerException, and how do I fix it?
- What exactly is Apache Camel?
- Unable to find valid certification path to requested target – error even after cert imported
- Unable to find valid certification path to requested target – error even after cert imported
- What is the equivalent of the C++ Pair
in Java? - Java – Convert integer to string [duplicate]
- Getting random numbers in Java [duplicate]
- What is an instance variable in Java?
- javac is not recognized as an internal or external command, operable program or batch file [closed]
- javac is not recognized as an internal or external command, operable program or batch file [closed]
- Java: “error: cannot find symbol”
- How does the Java ‘for each’ loop work?
- What is a StackOverflowError?
- How to uninstall Eclipse?
- Is GNU’s Java Compiler (GCJ) dead? [closed]
- How does System.out.print() work?
- How do I “decompile” Java class files? [closed]
- How do I determine whether an array contains a particular value in Java?
- How to initialize an array in Java?
- How does the Java ‘for each’ loop work?
- Java 8 Iterable.forEach() vs foreach loop
- Initialize part of an array in java
- How can I solve Exception in thread “main” java.lang.NullPointerException error [duplicate]
- How to split a string in Java
- What does “Could not find or load main class” mean?
- What does “Could not find or load main class” mean?
- Why am I getting a NoClassDefFoundError in Java?
- How to avoid “ConcurrentModificationException” while removing elements from `ArrayList` while iterating it? [duplicate]
- Eclipse/Maven error: “No compiler is provided in this environment”
- How do I compare strings in Java?
- What is reflection and why is it useful?
- Implementing UML diagram to Java [closed]
- How to round a number to n decimal places in Java
- Using Pairs or 2-tuples in Java [duplicate]
- How do I create a file and write to it?
- Could not reserve enough space for object heap
- When to use LinkedList over ArrayList in Java?
- How to convert a char to a String?
- Difference between Arrays.asList(array) and new ArrayList
(Arrays.asList(array)) - What is the proper way to handle a NumberFormatException when it is expected?
- What causes “Unable to access jarfile” error?
- What does “Could not find or load main class” mean?
- How do you create a dictionary in Java? [closed]
- Reading a plain text file in Java
- Error unable to access jarfile C:\Jar
- Where is JRE 11? [duplicate]
- In laymans terms, what does ‘static’ mean in Java? [duplicate]
- How to convert/parse from String to char in java?
- Reverse a string in Java
- Static Classes In Java
- Is there any doubly linked list implementation in Java?
- How to set a Timer in Java?
- How do I declare and initialize an array in Java?
- How to parse JSON in Java
- Is there a way to convert all comments into javadoc comments? [Eclipse/Java]
- Convert list to array in Java [duplicate]