use of org.webpieces.plugins.hibernate.app.dbo.UserTestDbo in project webpieces by deanhiller.
the class HibernateAsyncController method runSave.
public Redirect runSave(EntityManager mgr) {
UserTestDbo user = new UserTestDbo();
user.setEmail("dean@async.xsoftware.biz");
user.setName("SomeName");
mgr.persist(user);
mgr.flush();
return Actions.redirect(HibernateRouteId.ASYNC_DISPLAY_ENTITY, "id", user.getId());
}
use of org.webpieces.plugins.hibernate.app.dbo.UserTestDbo in project webpieces by deanhiller.
the class HibernateController method saveThenFail.
/**
* BIG NOTE: This is NOT the way you should use hibernate but is a base case for us to
* just test out hibernate without filters and added complexity
* @return
*/
public Redirect saveThenFail() {
EntityManager mgr = Em.get();
UserTestDbo user = new UserTestDbo();
user.setEmail("dean2222@sync.xsoftware.biz");
user.setName("SomeName");
mgr.persist(user);
mgr.flush();
svc.fail(user.getId());
return Actions.redirect(HibernateRouteId.DISPLAY_ENTITY, "id", user.getId());
}
use of org.webpieces.plugins.hibernate.app.dbo.UserTestDbo in project webpieces by deanhiller.
the class HibernateController method entityLoad.
public Render entityLoad(Integer id) {
EntityManager mgr = Em.get();
UserTestDbo user = mgr.find(UserTestDbo.class, id);
log.info("loaded user");
return Actions.renderThis("user", user);
}
use of org.webpieces.plugins.hibernate.app.dbo.UserTestDbo in project webpieces by deanhiller.
the class AjaxCrudTestController method postDeleteUser.
public Redirect postDeleteUser(int id) {
UserTestDbo ref = Em.get().getReference(UserTestDbo.class, id);
Em.get().remove(ref);
Em.get().flush();
Current.flash().setMessage("User deleted");
Current.flash().keep();
return Actions.redirect(AjaxCrudTestRouteId.AJAX_LIST_USERS);
}
use of org.webpieces.plugins.hibernate.app.dbo.UserTestDbo in project webpieces by deanhiller.
the class AjaxCrudTestController method userList.
public Action userList() {
EntityManager mgr = Em.get();
Query query = mgr.createNamedQuery("findAllUsers");
@SuppressWarnings("unchecked") List<UserTestDbo> users = query.getResultList();
boolean showEditPopup = Current.flash().isShowEditPopup();
return Actions.renderThis("users", users, "showPopup", showEditPopup);
}
Aggregations