Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » SQL statement that createNamedQuery(...) method sent to the database?
SQL statement that createNamedQuery(...) method sent to the database? [message #385460] Wed, 11 February 2009 17:25 Go to next message
Mohamud is currently offline MohamudFriend
Messages: 1
Registered: July 2009
Junior Member
Hi there,


How do I get the SQL statement that createNamedQuery(...) method sent to
the database?


For debugging purpose, I want to write a log file the SQL statement that
createNamedQuery method sent to the database in order to trace-out what
SQL statement has been sent to the database.

Example:

Query query = em.createNamedQuery("getUserByName");

log.debug(???) What was the SQL statement?


Thanks
Mohamed
Re: SQL statement that createNamedQuery(...) method sent to the database? [message #385461 is a reply to message #385460] Thu, 12 February 2009 12:37 Go to previous message
James Sutherland is currently offline James SutherlandFriend
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

If you set logging to FINE or lower all SQL will be logged. The log is
set using the persistence.xml property,

"eclipselink.logging.level"="FINE"

You can also access the EclipseLink DatabaseQuery from your JPA Query and
get its SQL,

((JpaQuery)query).getDatabaseQuery().prepareCall(session, null);
((JpaQuery)query).getDatabaseQuery().getSQLString();

---
James
http://www.nabble.com/EclipseLink---Users-f26658.html


James : Wiki : Book : Blog : Twitter
Previous Topic:NPE on concurrent entity manager access
Next Topic:Persisting thousands of files
Goto Forum:
  


Current Time: Fri Apr 26 10:50:15 GMT 2024

Powered by FUDForum. Page generated in 0.02559 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top