Ejemplo n.º 1
0
 /**
  * read user
  *
  * @param user user reference
  * @return user
  */
 @Override
 @SuppressWarnings("unchecked")
 public User read(User user) {
   Long id = user.getUserId();
   String username = user.getUsername();
   String email = user.getEmail();
   String password = user.getPassword();
   List<User> users = new ArrayList<>();
   users.addAll((List<User>) hibernateTemplate.findByNamedQuery("findUserById", id, password));
   users.addAll(
       (List<User>) hibernateTemplate.findByNamedQuery("findUserByUsername", username, password));
   users.addAll(
       (List<User>) hibernateTemplate.findByNamedQuery("findUserByEmail", email, password));
   return users.size() > 0 ? users.get(0) : null;
 }
Ejemplo n.º 2
0
  public List<State> getStateList() {
    List<State> states = new ArrayList<State>();

    states = (List<State>) hibernateTemplate.findByNamedQuery("State.findAllStates");

    return states;
  }
Ejemplo n.º 3
0
  public List<City> getCityList() {
    List<City> cities = new ArrayList<City>();

    cities = (List<City>) hibernateTemplate.findByNamedQuery("City.fetchAllCities");

    return cities;
  }
Ejemplo n.º 4
0
 /** Creates new form ListTransaction */
 public ListTransaction() {
   UIUtils.setCustomUI();
   initComponents();
   LOGGER.info("Hello-2");
   hibernateTemplate = (HibernateTemplate) context.getBean(HibernateTemplate.class);
   // LOGGER.info(hibernateTemplate.toString());
   List<User> users = hibernateTemplate.findByNamedQuery("User.findAll");
   Vector<User> userVector = new Vector<User>(users);
   userField.setModel(new DefaultComboBoxModel(userVector));
   LOGGER.info("Hello");
   //        list.addAll((List<Transaction>)
   // hibernateTemplate.findByNamedQuery("Transaction.findAll"));
   pack();
 }