users@glassfish.java.net

Re: GlassFish v2.1 and Hibernate Persistence

From: <glassfish_at_javadesktop.org>
Date: Mon, 10 Aug 2009 09:11:54 PDT

You should turn on more logging for hibernate and find out the root cause why it is giving "Errors in named queries". Here's how I configured it:
copy log4j jar from hibernate libs in glassfish/domains/domain1/lib
put log4j.properties in glassfish/domains/domain1/config

The log file (with my configuration) will appear in the config directory, which is not the best, but this is just a lazy way to configure it and find it for debugging purposes.

This way you can see the query that hibernate is actually sending to the database.



the log4j.properties contents are:
[code]
log4j.rootCategory=DEBUG, R, O

# Stdout
log4j.appender.O=org.apache.log4j.ConsoleAppender

# File
log4j.appender.R=org.apache.log4j.RollingFileAppender
log4j.appender.R.File=log4j.log

# Control the maximum log file size
log4j.appender.R.MaxFileSize=100KB

# Archive log files (one backup file here)
log4j.appender.R.MaxBackupIndex=1

log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.O.layout=org.apache.log4j.PatternLayout

log4j.appender.R.layout.ConversionPattern=[%d{ISO8601}]%5p%6.6r[%t]%x - %C.%M(%F:%L) - %m%n
log4j.appender.O.layout.ConversionPattern=[%d{ISO8601}]%5p%6.6r[%t]%x - %C.%M(%F:%L) - %m%n
[/code]
[Message sent by forum member 'culli' (culli)]

http://forums.java.net/jive/thread.jspa?messageID=359751