@Override public void edit(JbAssets jbAssets) { TjbAssets t = jbAssetsDao.get(TjbAssets.class, jbAssets.getId()); if (t != null) { MyBeanUtils.copyProperties(jbAssets, t, new String[] {"id", "createdatetime"}, true); } }
@Override public void add(JbAssets jbAssets) { TjbAssets t = new TjbAssets(); BeanUtils.copyProperties(jbAssets, t); t.setId(UUID.randomUUID().toString()); // t.setCreatedatetime(new Date()); jbAssetsDao.save(t); }
@Override public JbAssets get(String id) { Map<String, Object> params = new HashMap<String, Object>(); params.put("id", id); TjbAssets t = jbAssetsDao.get("from TjbAssets t where t.id = :id", params); JbAssets o = new JbAssets(); BeanUtils.copyProperties(t, o); return o; }
@Override public void delete(String id) { jbAssetsDao.delete(jbAssetsDao.get(TjbAssets.class, id)); }