In our project we have used EJB3.0 and JPA and while working on this we need to see the sql queries formed by JPA
which can help us what joins are getting establish and locks so that we can improve our query, so I need to know
how to see the sql query formed by JPA at run time .
These are the queries
@NamedQuery(name = DetectionEvent.RETRIEVE_DE_LIST_FOR_REPROCESSING, query = "SELECT DISTINCT de "
+ " FROM DetectionEvent de " + "WHERE de.reprocessDE = '" + LrucConstants.DB_YES
+ "' ORDER BY de.chargePointId, de.captureDatetime ASC"),
and this is a method
public List<SummaryRecord> getSRsRequiringRejection(Timestamp pStartTime, Timestamp pEndTime)
// UC-CORE-ASS002 Reject Detection event
// This retrieves a list of SummaryRecord entities from the
// table in the EventAndVURDAO where the ‘requiresRejection’ flag is
Query query = mEntityManager.createNamedQuery(SummaryRecord.RETRIEVE_SUMMARY_RECORD_LISTS);
List<SummaryRecord> summaryRecord = query.getResultList();
Need to see complete query which is getting generated at runtime so that I can see locks and joins on the table so that w ecan make improvements ..
Please tell us how to acheive this in JPA.