Package org.albertsanso.web20.core.model

Examples of org.albertsanso.web20.core.model.NumericalAttribute


    User user = entityManager.find(User.class, id);
    return user;
  }

  public User findByNameAndSurname(String name, String surname) {
    User user = (User) entityManager
      .createQuery("select u from User u where u.firstName = ? and u.secondName = ?")
      .setParameter(1, name).setParameter(2, surname).getSingleResult();
    return user;
  }
View Full Code Here


  }
 
  private void setRelations() {
   
    JPAUserDao userDao = new JPAUserDao();
    JPAWineDao wineDao = new JPAWineDao();
    userDao.setEntityManager(em);
    wineDao.setEntityManager(em);
   
    User user1 = userDao.findByNameAndSurname("Albert", "Sans�");
    User user2 = userDao.findByNameAndSurname("Sergi", "Alegre");
   
    Wine wine1 = wineDao.findByName("El meu vi");
    Wine wine2 = wineDao.findByName("El meu vi 2");
    Wine wine3 = wineDao.findByName("El meu vi 3");
   
    RecommendedItemList rel = null;
   
    em.getTransaction().begin();
   
View Full Code Here

    em.getTransaction().commit();
  }
 
  private void createItems() {
 
    JPAWineDao wineDao = new JPAWineDao();
    wineDao.setEntityManager(em);
   
    Wine wine = null;
   
    wine = new Wine();
    wine.setCellarName("cellar 1");
    wine.setName("El meu vi");
    wineDao.save(wine);
   
    wine = new Wine();
    wine.setCellarName("cellar 2");
    wine.setName("El meu vi 2");
    wineDao.save(wine);
   
    wine = new Wine();
    wine.setCellarName("cellar 3");
    wine.setName("El meu vi 3");
    wineDao.save(wine);
  }
View Full Code Here

   
    Wine wine1 = wineDao.findByName("El meu vi");
    Wine wine2 = wineDao.findByName("El meu vi 2");
    Wine wine3 = wineDao.findByName("El meu vi 3");
   
    RecommendedItemList rel = null;
   
    em.getTransaction().begin();
   
    rel = new RecommendedItemList();
    rel.setUser(user1);
    rel.setTargetUser(user2);
    rel.setItem(wine1);
    user1.getRelatedItems().add(rel);
   
    rel = new RecommendedItemList();
    rel.setUser(user1);
    rel.setTargetUser(user2);
    rel.setItem(wine2);
    user1.getRelatedItems().add(rel);
   
    rel = new RecommendedItemList();
    rel.setUser(user1);
    rel.setTargetUser(user2);
    rel.setItem(wine3);
    user1.getRelatedItems().add(rel);
   
    em.getTransaction().commit();
  }
View Full Code Here

import org.albertsanso.web20.wines.model.Wine;

public class JPAWineDao extends JPABaseDaoImpl implements WineDao {

  public Wine findById(long id) {
    Wine wine = entityManager.find(Wine.class, id);
    return wine;
  }
View Full Code Here

    Wine wine = entityManager.find(Wine.class, id);
    return wine;
  }

  public Wine findByName(String name) {
    Wine wine = (Wine) entityManager
      .createQuery("select w from Wine w where w.name = ?")
      .setParameter(1, name).getSingleResult();
    return wine;
  }
View Full Code Here

    wineDao.setEntityManager(em);
   
    User user1 = userDao.findByNameAndSurname("Albert", "Sans�");
    User user2 = userDao.findByNameAndSurname("Sergi", "Alegre");
   
    Wine wine1 = wineDao.findByName("El meu vi");
    Wine wine2 = wineDao.findByName("El meu vi 2");
    Wine wine3 = wineDao.findByName("El meu vi 3");
   
    RecommendedItemList rel = null;
   
    em.getTransaction().begin();
   
View Full Code Here

  private void createItems() {
 
    JPAWineDao wineDao = new JPAWineDao();
    wineDao.setEntityManager(em);
   
    Wine wine = null;
   
    wine = new Wine();
    wine.setCellarName("cellar 1");
    wine.setName("El meu vi");
    wineDao.save(wine);
   
    wine = new Wine();
    wine.setCellarName("cellar 2");
    wine.setName("El meu vi 2");
    wineDao.save(wine);
   
    wine = new Wine();
    wine.setCellarName("cellar 3");
    wine.setName("El meu vi 3");
    wineDao.save(wine);
  }
View Full Code Here

TOP

Related Classes of org.albertsanso.web20.core.model.NumericalAttribute

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.