List of usage examples for org.hibernate Session load
void load(Object object, Serializable id);
From source file:com.it355.filip.dao.impl.DisplayDaoImpl.java
@Override public boolean removeDisplay(int id) { Session session = this.sessionFactory.getCurrentSession(); Display b = (Display) session.load(Display.class, new Integer(id)); if (null != b) { session.delete(b);/*from w ww. ja v a 2s . c o m*/ return true; } else { return false; } /*String sql = "DELETE FROM display WHERE name= " + name; jdbcTemplate.update(sql); return true;*/ }
From source file:com.it355.filip.dao.impl.PicturesDaoImpl.java
@Override public Pictures getPicturesByID(int id) { Session session = this.sessionFactory.getCurrentSession(); Pictures picture = (Pictures) session.load(Pictures.class, new Integer(id)); //logger.info("Person loaded successfully, Person details=" + p); return picture; /*String sql= "SELECT * FROM brand WHERE picture_ID =" + id; List<Pictures> picture= jdbcTemplate.query(sql, new PicturesMapper()); return picture;*//*from w ww . java2s . c o m*/ }
From source file:com.it355.filip.dao.impl.PicturesDaoImpl.java
@Override public boolean removePicture(int id) { Session session = this.sessionFactory.getCurrentSession(); Pictures picture = (Pictures) session.load(Pictures.class, new Integer(id)); if (null != picture) { session.delete(picture);//from ww w .j a v a 2s . com return true; } else { return false; } /*String sql = "DELETE FROM pictures WHERE picture_ID= " + pictureID; jdbcTemplate.update(sql); return true;*/ }
From source file:com.it355.filip.dao.impl.StrapDaoImpl.java
@Override public Strap getStrapByID(int id) { Session session = this.sessionFactory.getCurrentSession(); Strap strap = (Strap) session.load(Strap.class, new Integer(id)); //logger.info("Person loaded successfully, Person details=" + p); return strap; /*String sql= "SELECT * FROM strap WHERE strap_ID =" + id; List<Strap> straps= jdbcTemplate.query(sql, new StrapMapper()); return straps;*///from www . ja v a2s . c om }
From source file:com.it355.filip.dao.impl.StrapDaoImpl.java
@Override public boolean removeStrap(int id) { Session session = this.sessionFactory.getCurrentSession(); Strap b = (Strap) session.load(Strap.class, new Integer(id)); if (null != b) { session.delete(b);//from ww w . j av a 2s . c o m return true; } else { return false; } /* String sql = "DELETE FROM strap WHERE name= " + name; jdbcTemplate.update(sql); return true;*/ }
From source file:com.it355.filip.dao.impl.UsersDaoImpl.java
@Override public boolean removeUsers(String username) { Session session = this.sessionFactory.getCurrentSession(); Users b = (Users) session.load(Users.class, new String(username)); if (null != b) { session.delete(b);/*from ww w. j av a 2 s . c om*/ return true; } else { return false; } /*String sql = "DELETE FROM account WHERE username= " + username; jdbcTemplate.update(sql); return true;*/ }
From source file:com.it355.filip.dao.impl.WatchDaoImpl.java
@Override public Watch getWatchByID(int id) { Session session = this.sessionFactory.getCurrentSession(); Watch watch = (Watch) session.load(Watch.class, new Integer(id)); //logger.info("Person loaded successfully, Person details=" + p); return watch; /*/*from ww w .j a v a 2 s .c o m*/ String sql= "SELECT * FROM watch WHERE watch_ID =" + id; List<Watch> watches= jdbcTemplate.query(sql, new WatchMapper()); return watches;*/ }
From source file:com.it355.filip.dao.impl.WatchDaoImpl.java
@Override public boolean removeWatch(int id) { Session session = this.sessionFactory.getCurrentSession(); Watch b = (Watch) session.load(Watch.class, new Integer(id)); if (null != b) { session.delete(b);/*www.ja va2 s .c om*/ return true; } else { return false; } /*String sql = "DELETE FROM watch WHERE model= " + model; jdbcTemplate.update(sql); return true;*/ }
From source file:com.itseekers.sistemaplandeproduccion.dao.impl.UsuarioDaoImpl.java
public int deleteUsuarioDtoById(int id) { Session session = sessionFactory.openSession(); Transaction tx = session.beginTransaction(); UsuarioDto usuarioDto = (UsuarioDto) session.load(UsuarioDto.class, id); session.delete(usuarioDto);//from w ww. java2 s .c o m tx.commit(); Serializable ids = session.getIdentifier(usuarioDto); session.close(); return (Integer) ids; }
From source file:com.izv.modelo.ModeloFoto.java
public static void delete(String id) { Session session = HibernateUtil.getSessionFactory().openSession(); session.beginTransaction();//from ww w . j a va2s .c om Fotos fot = (Fotos) session.load(Fotos.class, Integer.parseInt(id)); session.delete(fot); session.getTransaction().commit(); session.flush(); session.close(); }