Gilead 允许你轻松的在Java虚拟机环境外的环境(例如GWT、Flex、XML)使用 Hibernate 的 POJO,没有延迟初始化或系列化例外。只是POJO和域驱动的设计
基本配置代码:
HibernateUtil persistenceUtil = new HibernateUtil(); persistenceUtil.setSessionFactory(sessionFactory); PersistentBeanManager beanManager = new PersistentBeanManager(); beanManager.setPersistenceUtil(persistenceUtil); beanManager.setProxyStore(new StatelessProxyStore()); MyBean cloneBean = (MyBean) beanManager.clone(myEntity); // Send cloneBean, change it, do what you want… myEntity = (MyBean) beanManager.merge(cloneBean); entityDAO.save(myEntity);