
org.datafx.crud.jpa.JpaGetAllCall Maven / Gradle / Ivy
The newest version!
package org.datafx.crud.jpa;
import org.datafx.util.EntityWithId;
import javax.persistence.EntityManager;
import java.util.List;
import java.util.function.Supplier;
public class JpaGetAllCall, T> extends JpaCall> {
private Class entityClass;
public JpaGetAllCall(Supplier managerSupplier, Class entityClass) {
super(managerSupplier);
this.entityClass = entityClass;
}
public JpaGetAllCall(EntityManager manager, Class entityClass) {
this(() -> manager, entityClass);
}
@Override
public List call(Void dummy) throws Exception {
System.out.println("Select a from " + entityClass.getSimpleName() + " a");
return getManager()
.createQuery("Select a from " + entityClass.getSimpleName() + " a", entityClass)
.getResultList();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy