Created
April 2, 2011 02:32
-
-
Save danlynn/899186 to your computer and use it in GitHub Desktop.
This is the DAO code gen'd by hibernate
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.itcadre.adapt.hibernate; | |
// Generated Apr 1, 2011 10:29:11 PM by Hibernate Tools 3.4.0.CR1 | |
import javax.ejb.Stateless; | |
import javax.persistence.EntityManager; | |
import javax.persistence.PersistenceContext; | |
import org.apache.commons.logging.Log; | |
import org.apache.commons.logging.LogFactory; | |
/** | |
* Home object for domain model class Template. | |
* @see com.itcadre.adapt.hibernate.Template | |
* @author Hibernate Tools | |
*/ | |
@Stateless | |
public class TemplateHome { | |
private static final Log log = LogFactory.getLog(TemplateHome.class); | |
@PersistenceContext | |
private EntityManager entityManager; | |
public void persist(Template transientInstance) { | |
log.debug("persisting Template instance"); | |
try { | |
entityManager.persist(transientInstance); | |
log.debug("persist successful"); | |
} catch (RuntimeException re) { | |
log.error("persist failed", re); | |
throw re; | |
} | |
} | |
public void remove(Template persistentInstance) { | |
log.debug("removing Template instance"); | |
try { | |
entityManager.remove(persistentInstance); | |
log.debug("remove successful"); | |
} catch (RuntimeException re) { | |
log.error("remove failed", re); | |
throw re; | |
} | |
} | |
public Template merge(Template detachedInstance) { | |
log.debug("merging Template instance"); | |
try { | |
Template result = entityManager.merge(detachedInstance); | |
log.debug("merge successful"); | |
return result; | |
} catch (RuntimeException re) { | |
log.error("merge failed", re); | |
throw re; | |
} | |
} | |
public Template findById(long id) { | |
log.debug("getting Template instance with id: " + id); | |
try { | |
Template instance = entityManager.find(Template.class, id); | |
log.debug("get successful"); | |
return instance; | |
} catch (RuntimeException re) { | |
log.error("get failed", re); | |
throw re; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment