Note this blog is obsolete, see for the current blog If you are having a problem with your JPA queries and you are trying to understand what SQL queries it actually sends below the covers you can configure the JPA runtime to show the actual SQL statements it sends over. How? Well for EclipseLink you would add the following to your persistence.xml file. 
  <property name="eclipselink.logging.level" value="FINEST"/>
If you want to know more on how to configure EclipseLink, please visit this wikipage. Enjoy!