public List findByExample(TCriterion instance) { log.debug("finding TCriterion instance by example"); try { List results = getSession() .createCriteria("com.zte.database.data.TCriterion") .add(Example.create(instance)) .list(); log.debug("find by example successful, result size: " + results.size()); return results; } catch (RuntimeException re) { log.error("find by example failed", re); throw re; } }
public void save(TCriterion transientInstance) {
log.debug("saving TCriterion instance");
try {
getSession().save(transientInstance);
log.debug("save successful");
} catch (RuntimeException re) {
log.error("save failed", re);
throw re;
}
}
public void delete(TCriterion persistentInstance) {
log.debug("deleting TCriterion instance");
try {
getSession().delete(persistentInstance);
log.debug("delete successful");
} catch (RuntimeException re) {
log.error("delete failed", re);
throw re;
}
}
public TCriterion findById( java.lang.String id) {
log.debug("getting TCriterion instance with id: " + id);
try {
TCriterion instance = (TCriterion) getSession()
.get("com.zte.database.data.TCriterion", id);
return instance;
} catch (RuntimeException re) {
log.error("get failed", re);
throw re;
}
}
public List findByExample(TCriterion instance) {
log.debug("finding TCriterion instance by example");
try {
List results = getSession()
.createCriteria("com.zte.database.data.TCriterion")
.add(Example.create(instance))
.list();
log.debug("find by example successful, result size: " + results.size());
return results;
} catch (RuntimeException re) {
log.error("find by example failed", re);
throw re;
}
}
public List findByProperty(String propertyName, Object value) {
log.debug("finding TCriterion instance with property: " + propertyName
+ ", value: " + value);
try {
String queryString = "from TCriterion as model where model."
+ propertyName + " = " + value ;
Query queryObject = getSession().createQuery(queryString);
//queryObject.setParameter(0, value);
return queryObject.list();
} catch (RuntimeException re) {
log.error("find by property name failed", re);
throw re;
}
} public TCriterion merge(TCriterion detachedInstance) {
log.debug("merging TCriterion instance");
try {
TCriterion result = (TCriterion) getSession()
.merge(detachedInstance);
log.debug("merge successful");
return result;
} catch (RuntimeException re) {
log.error("merge failed", re);
throw re;
}
} public void attachDirty(TCriterion instance) {
log.debug("attaching dirty TCriterion instance");
try {
getSession().saveOrUpdate(instance);
log.debug("attach successful");
} catch (RuntimeException re) {
log.error("attach failed", re);
throw re;
}
}
public void attachClean(TCriterion instance) {
log.debug("attaching clean TCriterion instance");
try {
getSession().lock(instance, LockMode.NONE);
log.debug("attach successful");
} catch (RuntimeException re) {
log.error("attach failed", re);
throw re;
}
}
能结合myeclipse 讲的具体些 马 ?
谢谢 ! 线上等 !