use of org.javaee7.jpa.aggregate_function_in_select.entity.TestEntity in project javaee7-samples by javaee-samples.
the class TestService method saveEntities.
public void saveEntities() {
TestEntity testEntity1 = new TestEntity();
testEntity1.setValue("1");
TestEntity testEntity2 = new TestEntity();
testEntity2.setValue("2");
entityManager.persist(testEntity1);
entityManager.persist(testEntity2);
}
use of org.javaee7.jpa.aggregate_function_in_select.entity.TestEntity in project javaee7-samples by javaee-samples.
the class TestService method saveNewEntity.
public void saveNewEntity() {
TestEntity testEntity = new TestEntity();
testEntity.setValue("mytest");
entityManager.persist(testEntity);
}
use of org.javaee7.jpa.aggregate_function_in_select.entity.TestEntity in project javaee7-samples by javaee-samples.
the class TestService method saveNewEntity.
public void saveNewEntity() {
TestEntity testEntity = new TestEntity();
testEntity.setValue("mytest");
entityManager.persist(testEntity);
}
use of org.javaee7.jpa.aggregate_function_in_select.entity.TestEntity in project javaee7-samples by javaee-samples.
the class TestService method saveNewEntity.
public void saveNewEntity() {
TestEntity testEntity = new TestEntity();
testEntity.setValue("mytest");
entityManager.persist(testEntity);
}
use of org.javaee7.jpa.aggregate_function_in_select.entity.TestEntity in project javaee7-samples by javaee-samples.
the class QueryRepository method buildGetByValue.
/**
* Builds a criteria query equal to the JPQL
*
* <code>SELECT _testEntity FROM TestEntity _testEntity WHERE _testEntity.value :value</code>
*
*
*/
private TypedQuery<TestEntity> buildGetByValue() {
CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();
CriteriaQuery<TestEntity> criteriaQuery = criteriaBuilder.createQuery(TestEntity.class);
Root<TestEntity> root = criteriaQuery.from(TestEntity.class);
ParameterExpression<String> valueParameter = criteriaBuilder.parameter(String.class, TestEntity_.value.getName());
criteriaQuery.select(root).where(criteriaBuilder.equal(root.get(TestEntity_.value), valueParameter));
return entityManager.createQuery(criteriaQuery);
}
Aggregations