Hi Greg,
There are a couple options that come to mind depending on what you can do with your query.
A. If you can form it into a JPQL statement, you can use the JPADao helper class that is generated with scaffolding to run the executeQuery method. The JPADao helper class is represented in any DAO created. So, you’ll see that DAO is already wired in the Service class, for example. It’s usually in the form <domain object>DAO. This helper class simply taps into the EntityManager, http://download.oracle.com/javaee/6/api/javax/persistence/EntityManager.html, which you can obviously use as well and is wired into the Scaffolded DAO, which leads me to the second option….
B. If the query has to be in native SQL, I would recommend creating a method in the DAO itself to accept the SQL text and call the EntityManager. I believe the method you want to take a look at is createNativeQuery.
HTH,
Dave