Package de.peacei.gae.foodsupplier.data.dao

Source Code of de.peacei.gae.foodsupplier.data.dao.TaskNameDAO

/**
*
*/
package de.peacei.gae.foodsupplier.data.dao;

import javax.jdo.PersistenceManager;

import com.google.inject.Singleton;

import de.peacei.gae.foodsupplier.data.TaskName;
import de.peacei.gae.foodsupplier.util.PMF;

/**
* @author peacei
*
*/

@Singleton
public class TaskNameDAO {
 
  public TaskNameDAO() { }
 
  public TaskName getTaskName(String id) {
    TaskName taskName = null;
   
    PersistenceManager pm = PMF.get().getPersistenceManager();
    try {
      taskName = pm.getObjectById(TaskName.class, id);
    } catch(Exception e) { }
   
    return taskName;
  }
 
  public void saveTaskName(TaskName taskName) {
    PersistenceManager pm = PMF.get().getPersistenceManager();
    try {
      pm.makePersistent(taskName);
      pm.flush();
    } catch(Exception e) { }
    finally {
      pm.close();
    }
  }
 
  public void deleteTaskName(String id) {
    PersistenceManager pm = PMF.get().getPersistenceManager();
    try {
      TaskName taskName = pm.getObjectById(TaskName.class, id);
      pm.deletePersistent(taskName);
      pm.flush();
    } catch(Exception e) { }
    finally
      pm.close();
    }
  }
}
TOP

Related Classes of de.peacei.gae.foodsupplier.data.dao.TaskNameDAO

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.