use of javax.persistence.StoredProcedureQuery in project hibernate-orm by hibernate.
the class DateTimeParameterTest method testBindingCalendarAsTime.
@Test
public void testBindingCalendarAsTime() {
EntityManager em = entityManagerFactory.createEntityManager();
em.getTransaction().begin();
try {
StoredProcedureQuery query = em.createStoredProcedureQuery("findMessagesByTime");
query.registerStoredProcedureParameter(1, Calendar.class, ParameterMode.IN);
query.setParameter(1, nowCal, TemporalType.TIME);
List list = query.getResultList();
assertEquals(1, list.size());
} finally {
em.getTransaction().rollback();
em.close();
}
}
use of javax.persistence.StoredProcedureQuery in project hibernate-orm by hibernate.
the class H2StoreProcedureTest method testStoreProcedureGetParameters.
@Test
public void testStoreProcedureGetParameters() {
final EntityManager entityManager = getOrCreateEntityManager();
try {
StoredProcedureQuery query = entityManager.createStoredProcedureQuery("get_all_entities", MyEntity.class);
final Set<Parameter<?>> parameters = query.getParameters();
assertThat(parameters.size(), is(0));
final List resultList = query.getResultList();
assertThat(resultList.size(), is(1));
} finally {
entityManager.close();
}
}
use of javax.persistence.StoredProcedureQuery in project hibernate-orm by hibernate.
the class StoreProcedureRefCursorOutParameterByPositionTest method testNamedStoredProcedureExecution.
@Test
public void testNamedStoredProcedureExecution() {
EntityManager em = entityManagerFactory.createEntityManager();
try {
StoredProcedureQuery query = em.createNamedStoredProcedureQuery("User.findByName");
query.setParameter(1, "my_name");
query.getResultList();
} finally {
em.close();
}
}
use of javax.persistence.StoredProcedureQuery in project hibernate-orm by hibernate.
the class StoredProcedureResultSetMappingTest method testPartialResults.
@Test
public void testPartialResults() {
EntityManager em = getOrCreateEntityManager();
em.getTransaction().begin();
StoredProcedureQuery query = em.createStoredProcedureQuery("allEmployeeNames", "id-fname-lname");
List results = query.getResultList();
assertEquals(3, results.size());
em.getTransaction().commit();
em.close();
}
use of javax.persistence.StoredProcedureQuery in project kylo by Teradata.
the class NifiFeedProcessorStatisticsRepositoryImpl method compactFeedProcessorStats.
@Override
public String compactFeedProcessorStats() {
StoredProcedureQuery query = em.createStoredProcedureQuery("compact_feed_processor_stats");
query.registerStoredProcedureParameter("res", String.class, ParameterMode.OUT);
query.execute();
String result = (String) query.getOutputParameterValue("res");
return result;
}
Aggregations