I'm looking for a way to programmatically execute arbitrary SQL commands against my DB. Query.createNativeQuery() doesn't work for things like CREATE TABLE.
Doing LOTS of searching, it looks like I can use Session.doWork(). The only problem is that I haven't been able to figure out how to get a Session object. My code currently just does: mEMF = Persistence.createEntityManagerFactory("WorkingDB", props); to get things working, and uses mEMF.createEntityManager() as needed.
So, how do I get a Session to my database?
|