mysql « Glassfish « JPA Q&A

1. GF + EJB + HIbernate JPA + MySQL works, but only for a while -- why?

I've been struggling with this for months (on and off). I have a couple of web services (stateless session beans) with EJBs for the business logic. I am using the Hibernate implementation of the JPA (C3PO etc). I have successfully deployed the web services under glassfish and connected MySQL. It all works but only for a small number of transactions.

2. Configuring Glassfish for Hibernate/non-JPA-mode and MYSQL connection Pools

Does anybody have an example of setting up Glassfish to use Hibernate in non-JPA mode and to use MySQL connection pools? It looks like Hibernate will register a JNDI reference to a SessionFactory automatically once it is configured correctly. (Right now we are using the old native Hibernate mode using XML files rather than the EJB 3.0 JPA approach.)

4. JPA and mysql encrypt private data

We are developing an application with the latest version of JPA, with a requirement that user data (last name, social, etc) be encrypted. I am not sure what the best way to do this is (encrypt/decrypt) directly within mysql using mysql's AES functions. I would prefer to do something in JAVA whereby you could annotate a field in an entity class ...