openjpa « Connection « JPA Q&A





1. OpenJPA Configuration for container-managed connection to MySQL Database    stackoverflow.com

I have the following config for persistence.xml file:

<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
   version="2.0">
   <persistence-unit name="pu" transaction-type="RESOURCE_LOCAL">
      ...

2. Why there are "too many connections" in JPA?    stackoverflow.com

This is my code (it's JAX-RS + JPA):

@Path("/")
public class Foo {
  private static final EntityManagerFactory FACTORY = 
    Persistence.createEntityManagerFactory("foo");
  @POST
  public void save(String name) {
 ...