<commit_before>package com.darwinsys.entityframe;

import java.util.List;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

/**
 * Patterned loosely after the Seam2 Entity Framework: methods for getting a list of Entities.
 * Typical usage:
 * <pre>
 * @ManagedBean(name="frameworkList")
@RequestScoped
public class FrameworkList extends EntityList<Framework> {

	@PersistenceContext(unitName = "jwf")
	protected EntityManager entityManager;
	
	@Override
	EntityManager getEntityManager() {
		return entityManager;
	}

}
 * </pre>
 * @author <NAME>
 *
 * @param <T> The type of the JPA entity that you want to list.
 */
public abstract class EntityList<T extends Object> {

	abstract EntityManager getEntityManager();
	
	protected Class<T> entityClass;
	
	@SuppressWarnings("unchecked")
	protected EntityList() {
		entityClass = (Class<T>) EntityQuery.getEntityClass(this);
		System.out.println("Entity class = " + entityClass.getName());
	}
	
	public List<T> getResultList() {
		System.out.printf("EntityList<%s>.getResultList()", entityClass.getName());
		return getEntityManager().createQuery("from " + entityClass.getName()).getResultList();
	}
	
	public long getResultCount() {
		return (Long) getEntityManager().createQuery("select count(*) from " + entityClass.getName()).getSingleResult();
	}
}<commit_msg>getEntityManager must be public abstract, not just abstract.<commit_after>package com.darwinsys.entityframe;

import java.util.List;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

/**
 * Patterned loosely after the Seam2 Entity Framework: methods for getting a list of Entities.
 * Typical usage:
 * <pre>
 * @ManagedBean(name="frameworkList")
@RequestScoped
public class FrameworkList extends EntityList<Framework> {

	@PersistenceContext(unitName = "jwf")
	protected EntityManager entityManager;
	
	@Override
	EntityManager getEntityManager() {
		return entityManager;
	}

}
 * </pre>
 * @author <NAME>
 *
 * @param <T> The type of the JPA entity that you want to list.
 */
public abstract class EntityList<T extends Object> {

	public abstract EntityManager getEntityManager();
	
	protected Class<T> entityClass;
	
	@SuppressWarnings("unchecked")
	protected EntityList() {
		entityClass = (Class<T>) EntityQuery.getEntityClass(this);
		System.out.println("Entity class = " + entityClass.getName());
	}
	
	public List<T> getResultList() {
		System.out.printf("EntityList<%s>.getResultList()", entityClass.getName());
		return getEntityManager().createQuery("from " + entityClass.getName()).getResultList();
	}
	
	public long getResultCount() {
		return (Long) getEntityManager().createQuery("select count(*) from " + entityClass.getName()).getSingleResult();
	}
}
{'fraction_non_alphanumeric': 0.12336719883889695, 'fraction_numerical': 0.000725689404934688, 'mean_word_length': 5.595693779904306, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3223540', 'n_tokens_mistral': 830, 'n_tokens_neox': 786, 'n_words': 200}