List of usage examples for javax.persistence Query getResultList
List getResultList();
From source file:fr.univrouen.poste.domain.LogPosteFile.java
public static List<Object[]> countUploadLogPosteFilesBydate() { String sql = "SELECT date_part('year', action_date) as year, date_part('month', action_date) as month, date_part('day', action_date) as day, count(*) as count FROM log_poste_file WHERE action='UPLOAD' GROUP BY year, month, day ORDER BY year, month, day"; Query q = entityManager().createNativeQuery(sql); return q.getResultList(); }
From source file:fr.univrouen.poste.domain.LogPosteFile.java
public static List<String> findAllUserIds() { String sql = "SELECT distinct(user_id) FROM log_poste_file ORDER BY user_id"; Query q = entityManager().createNativeQuery(sql); return q.getResultList(); }
From source file:fr.univrouen.poste.domain.LogFile.java
public static List<Object[]> countUploadLogFilesBydate() { String sql = "SELECT date_part('year', action_date) as year, date_part('month', action_date) as month, date_part('day', action_date) as day, count(*) as count FROM log_file WHERE action='UPLOAD' GROUP BY year, month, day ORDER BY year, month, day"; Query q = entityManager().createNativeQuery(sql); return q.getResultList(); }
From source file:fr.univrouen.poste.domain.PosteCandidatureFile.java
public static List<Object[]> sumPosteCandidatureFileSizeByDate() { String sql = "SELECT date_part('year', send_time) as year, date_part('month', send_time) as month, date_part('day', send_time) as day, " + "sum(sum(file_size)) over(order by date_part('year', send_time), date_part('month', send_time), date_part('day', send_time)) as file_size_sum " + "from poste_candidature_file GROUP BY year, month, day"; Query q = entityManager().createNativeQuery(sql); return q.getResultList(); }
From source file:be.fedict.eid.idp.entity.AttributeEntity.java
@SuppressWarnings("unchecked") public static List<AttributeEntity> listAttributes(EntityManager entityManager) { Query query = entityManager.createNamedQuery(LIST_ALL); return query.getResultList(); }
From source file:be.fedict.eid.idp.entity.AttributeProtocolUriEntity.java
@SuppressWarnings("unchecked") public static List<AttributeProtocolUriEntity> listAll(EntityManager entityManager) { Query query = entityManager.createNamedQuery(LIST_ALL); return query.getResultList(); }
From source file:com.impetus.kvapps.runner.ExecutorService.java
private static List<User> findByEmail(final EntityManager em, String query, String parameter) { Query q = em.createNamedQuery(query); q.setParameter(1, parameter);/* w w w .ja va2 s. co m*/ List<User> users = q.getResultList(); return users; }
From source file:com.impetus.kvapps.runner.ExecutorService.java
/** * on find by wild search query.// w w w. j a v a 2 s. c om * * @param em entity manager instance. * @param query query. */ @SuppressWarnings("unchecked") static void findByQuery(final EntityManager em, final String query) { Query q = em.createNamedQuery(query); logger.info("[On Find All by Query]"); List<User> users = q.getResultList(); if (users == null || users.isEmpty()) { logger.info("0 Users Returned"); return; } System.out.println("#######################START##########################################"); logger.info("\t\t Total number of users:" + users.size()); logger.info("\t\t User's total tweets:" + users.get(0).getTweets().size()); printTweets(users); logger.info("\n"); // logger.info("First tweet:" users.get(0).getTweets().); System.out.println("#######################END############################################"); logger.info("\n"); }
From source file:com.ecarride.App.java
public static void getDrivers() { Query query = entityManager.createQuery("SELECT d FROM Driver d"); Collection<Driver> allDrivers = query.getResultList(); for (Driver driver : allDrivers) { TaxiVehicle taxiVehicle = entityManager.getReference(TaxiVehicle.class, driver.getVehicleId()); TaxiBase taxiBase = entityManager.getReference(TaxiBase.class, driver.getBaseId()); if (driver.getLastName().contains("test") || driver.getLastName().contains("Test") || driver.getFirstName().contains("TEST") || driver.getFirstName().contains("test") || driver.getFirstName().contains("Test") || driver.getFirstName().contains("TEST") || driver.getBaseApproved() == 0) { continue; }//www. ja va 2 s . c om TlcDriver tlcDriver = new TlcDriver(driver, taxiBase, taxiVehicle); tlcDrivers.add(tlcDriver); tlcDriverMap.put(tlcDriver.getDriver().getDriverTlcFhvLicenseNum(), tlcDriver); tlcVehicleMap.put(tlcDriver.getTaxiVehicle().getVehicleTlcFhvLicenseNum(), tlcDriver); // System.out.println(tlcDriver.getDriver().getFirstName() + " " + tlcDriver.getDriver().getDriverTlcFhvLicenseNum() + " " + tlcDriver.getTaxiVehicle().getVehicleTlcFhvLicenseNum()); } }
From source file:ar.edu.unlp.sedici.sedici2003.model.Personas.java
public static int findPersonasesByApellidoYNombreCount(String apellido, String nombre) { if (apellido == null || apellido.length() == 0) apellido = ""; if (nombre == null) nombre = ""; apellido = Personas.convertirParaQuery(apellido); nombre = Personas.convertirParaQuery(nombre); String where = Personas.generateCondition(apellido, nombre); /*if (apellido == null || apellido.length() == 0) apellido=""; if (nombre == null) nombre = "";//from w w w .ja va 2s. c o m String where=Personas.generateCondition(apellido, nombre);*/ EntityManager em = Personas.entityManager(); Query q = em.createQuery("SELECT count(o) FROM Personas AS o " + where); if (apellido.length() != 0) q.setParameter("apellido", apellido); if (nombre.length() != 0) q.setParameter("nombre", nombre); return Integer.valueOf(q.getResultList().get(0).toString()); }