首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

Unity3DHouse中顺利删除信息

2012-11-10 
Unity3DHouse中成功删除信息//在jsp页面传入的参数在Action类中调用deleteHouse方法,此方法由HouseDao类中

Unity3DHouse中成功删除信息

//在jsp页面传入的参数在Action类中调用deleteHouse方法,此方法由HouseDao类中声明。

public boolean deleteHouse(Integer id){
?? ?/* Long i = new Long(id);
?? ??? Long id1=(Long)id;
?????? Integer i=new Integer(id);
?? ???? Housinginfo house;
?? ??? ? tx=session.beginTransaction();
?? ??? ?? TbLiuyan?? liuyan=(TbLiuyan)session.get(TbLiuyan.class,id);
?? ??? ?? session.delete(liuyan);
?? ??? ?? */
?? ??? ? Query q = getSession().createQuery("delete Housinginfo WHERE houseId=?");
?? ??? ? q.setInteger(0, id);
?? ??? ? q.executeUpdate();
?? ??? ? return true;
?? ??? ?
?? ??? ?
?? ??? ?/*Session session = sessionFactory.openSession();?? ?
?? ?    Transaction tx = session.beginTransaction();?? ?
?? ?    String hqlDelete = "delete Customer where name = :ldName";?? ?
?? ?    int deletedEntities = s.createQuery( hqlDelete )?? ?
?? ?    .setString( "oldName", oldName )?? ?
?? ?    .executeUpdate();?? ?
?? ?    tx.commit();?? ?
?? ?    session.close();
?? ??? ?
?? ??? ?try{
?? ??? ??? ?house = (Housinginfo)this.getHibernateTemplate().load(Housinginfo.class,i);
?? ??? ??? ?this.getHibernateTemplate().delete(house);
?? ??? ?}catch(Exception e){
?? ??? ??? ?System.out.println("dao内删除房子信息异常!");
?? ??? ??? ?return false;
?? ??? ?}
?? ??? ?return true;
?? ??? ?*/
?? ?? }

热点排行