Package javax.jdo

Examples of javax.jdo.PersistenceManager.makePersistent()


  }
 
  public void saveTaskName(TaskName taskName) {
    PersistenceManager pm = PMF.get().getPersistenceManager();
    try {
      pm.makePersistent(taskName);
      pm.flush();
    } catch(Exception e) { }
    finally {
      pm.close();
    }
View Full Code Here


    public void saveConfig(Configuration c) {
  PersistenceManager pm = PMF.get().getPersistenceManager();
  try {

      pm.makePersistent(c);
  } catch (Exception e) {
      e.printStackTrace();
      log.log(Level.SEVERE, e.getMessage());

  } finally {
View Full Code Here

  public void add(T entity) {
    PersistenceManager pm = PMF.get().getPersistenceManager();
    try {
      // 連同encodeKey一起存起來
      pm.makePersistent(entity);
      entity.setEncodedKey();
      pm.makePersistent(entity);
      log.info("add entity" + entity.getClass().getName());
    } catch (Exception e) {
      log.severe("添加實體 " + entity.getClass().getName() + " 時候出錯!");
View Full Code Here

    PersistenceManager pm = PMF.get().getPersistenceManager();
    try {
      // 連同encodeKey一起存起來
      pm.makePersistent(entity);
      entity.setEncodedKey();
      pm.makePersistent(entity);
      log.info("add entity" + entity.getClass().getName());
    } catch (Exception e) {
      log.severe("添加實體 " + entity.getClass().getName() + " 時候出錯!");
      log.severe(e.getMessage());
    } finally {
View Full Code Here

  public void modify(T entity) {
    PersistenceManager pm = PMF.get().getPersistenceManager();
    try {
      // 更新數據,直接調用makePersistent()方法的,要求實體類註解了如下
      // @PersistenceCapable(detachable="true")
      pm.makePersistent(entity);
      log.info("modify entity" + entityClass.getName());
    } catch (Exception e) {
      log.severe("更新實體 " + entity.getClass().getName() + "時候出錯!");
      log.severe(e.getMessage());
    } finally {
View Full Code Here

    Greeting greeting = new Greeting(user, content, date);
   
    PersistenceManager pm  = PMF.get().getPersistenceManager();
   
    try {
      pm.makePersistent(greeting);

      if (content == null) {
        content = "(No greeting)";
      }
     
View Full Code Here

    Transaction tx = null;
    PersistenceManager pm = PMF.get().getPersistenceManager();
    try {
      tx = pm.currentTransaction();
      tx.begin();
      pm.makePersistent(usuario);
      pm.makePersistent(evento);
      long id = evento.getKey().getId();
      long idUsuarioPapa = usuario.getId();

      tx.commit();
View Full Code Here

    PersistenceManager pm = PMF.get().getPersistenceManager();
    try {
      tx = pm.currentTransaction();
      tx.begin();
      pm.makePersistent(usuario);
      pm.makePersistent(evento);
      long id = evento.getKey().getId();
      long idUsuarioPapa = usuario.getId();

      tx.commit();
View Full Code Here

      ListaEventoLN evento2 = new ListaEventoLN(fecha_ingreso, id,
          idUsuarioPapa, "P", responsable.getId());
      List<ListaEventoLN> eventos = new ArrayList<ListaEventoLN>();
      eventos.add(evento2);
      responsable.setEventos(eventos);
      pm.makePersistent(responsable);
      pm.makePersistent(evento2);
      tx.commit();
    } catch (Exception e) {
      log.error("insertar " + e.getMessage());
    } finally {
View Full Code Here

          idUsuarioPapa, "P", responsable.getId());
      List<ListaEventoLN> eventos = new ArrayList<ListaEventoLN>();
      eventos.add(evento2);
      responsable.setEventos(eventos);
      pm.makePersistent(responsable);
      pm.makePersistent(evento2);
      tx.commit();
    } catch (Exception e) {
      log.error("insertar " + e.getMessage());
    } finally {
      if (tx.isActive()) {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.