public class Jsry implements java.io.Serializable {
// Constructors
private JsryId id;
/** default constructor */
public Jsry() {
}
/** full constructor */
public Jsry(JsryId id) {
this.id = id;
}
public JsryId getId() {
return id;
}
public void setId(JsryId id) {
this.id = id;
}
}
public void save(Jsry jsry) {
log.debug("saving Jsry instance");
try {
getHibernateTemplate().saveOrUpdate(jsry);
log.debug("save successful");
} catch (RuntimeException re) {
log.error("save failed", re);
throw re;
}
}
public void delete(Jsry jsry) {
log.debug("deleting Jsry instance");
try {
getHibernateTemplate().delete(jsry);
log.debug("delete successful");
} catch (RuntimeException re) {
log.error("delete failed", re);
throw re;
}
}
public Jsry findById(com.insigma.hr.eduj.jsry.model.JsryId id) {
log.debug("getting Jsry instance with id: " + id);
try {
Jsry instance = (Jsry) getHibernateTemplate().get(
"com.insigma.hr.eduj.jsry.model.Jsry", id);
return instance;
} catch (RuntimeException re) {
log.error("get failed", re);
throw re;
}
}
public List getJsgllist(String sql) {
String sqls = "select t.* from Jsgl t where 1=1 " + sql;
SQLQuery query = getHibernateTemplate().getSessionFactory()
.getCurrentSession().createSQLQuery(sqls);
query.addEntity("t", Jsry.class);
List topList = query.list();
return topList;
}
public static void main(String[] args) {
// TODO Auto-generated method stub
ApplicationContext appContext = new FileSystemXmlApplicationContext("/src/applicationContext.xml");
JsryService jsryService=(JsryService) appContext.getBean("jsryService");
Jsry jsry = new Jsry();
JsryId id = new JsryId();
Jsgl jsgl = new Jsgl();
jsgl.setJsbh(1);
Ygxx ygxx = new Ygxx();
ygxx.setYgbh("1");
id.setYgxx(ygxx);
id.setJsgl(jsgl);
jsry.setId(id);
jsryService.save(jsry);
}