@Override
  public void setProperty(String propertyName, Object value) {
    EntityManager em = getCurrent();

    if (em != null) {
      em.setProperty(propertyName, value);
      return;
    }

    em = createEntityManager();

    try {
      em.setProperty(propertyName, value);
    } finally {
      freeEntityManager(em);
    }
  }
示例#2
0
 /**
  * initialize the JPA context and starts a JPA transaction
  *
  * @param readonly true for a readonly transaction
  */
 public static void startTx(boolean readonly) {
   if (!JPA.isEnabled()) {
     return;
   }
   EntityManager manager = JPA.entityManagerFactory.createEntityManager();
   // if(Play.configuration.getProperty("future.bindJPAObjects", "false").equals("true")) {
   manager.setFlushMode(FlushModeType.COMMIT);
   manager.setProperty("org.hibernate.readOnly", readonly);
   // }
   if (autoTxs) {
     manager.getTransaction().begin();
   }
   JPA.createContext(manager, readonly);
 }
 public void setProperty(String propertyName, Object value) {
   delegate.setProperty(propertyName, value);
 }
 @Override
 public void setProperty(String arg0, Object arg1) {
   // TODO Auto-generated method stub
   myEntityManager.setProperty(arg0, arg1);
 }