form.setCh(card);
//insert new picture
if (req.getParameter("newPictureSubmit")!=null){
AOGGamePicturesHiber newOne=new AOGGamePicturesHiber();
if (form.getPicture().getFileName()!=null)
if (!form.getPicture().getFileName().equals("")) {
try {
newOne.setData(Hibernate.createBlob(form.getPicture().getInputStream()));
newOne.setDataType(form.getPicture().getContentType());
newOne.setPictureName(req.getParameter("pictureName"));
} catch (Exception e) {
}
}
session.persist(newOne);
ag.getPictures().add(newOne);
AOGGameDao.updateGame(ag, session);
}
//delete picture?
if (req.getParameter("deletePicture")!=null){
String deletePicture=req.getParameter("deletePicture");
long pictureId=Long.parseLong(deletePicture);
Set<AOGGamePicturesHiber> pctrs=ag.getPictures();
for (Iterator iterator = pctrs.iterator(); iterator.hasNext();) {
AOGGamePicturesHiber l = (AOGGamePicturesHiber) iterator.next();
if (l.getId()==pictureId) {
iterator.remove();
session.delete(l);
ag.setRepublishNeeded(true);
AOGGameDao.updateGame(ag, session);