get Select All Query Sql for AbstractEntity - Java javax.persistence

Java examples for javax.persistence:EntityManager

Description

get Select All Query Sql for AbstractEntity

Demo Code


import java.io.Serializable;
import javax.persistence.EntityExistsException;
import javax.persistence.EntityManager;

public class Main{
    public static void main(String[] argv) throws Exception{
        Class entityType = String.class;
        System.out.println(getSelectAllQuerySql(entityType));
    }/*from w ww.j  a v a2 s .  c  o m*/
    public static String getSelectAllQuerySql(
            Class<? extends AbstractEntity> entityType) {
        if (entityType == null)
            return "";
        return "select e from " + entityType.getSimpleName() + " as e";
    }
}

Related Tutorials