1

我只看到这个:

     /**
     * Find all entities of this type
     */
    public static <T extends JPABase> List<T> findAll() {
        throw new UnsupportedOperationException("Please annotate your JPA model with @javax.persistence.Entity annotation.");
    }

它的实现在哪里?我的意思是,这些 SQL 序列放在哪里?

4

1 回答 1

0

此代码在适用于所有 JPA 实体的 JPAEnhancer 类中定义:

public class JPAEnhancer extends Enhancer {

    public void enhanceThisClass(ApplicationClass applicationClass) throws Exception {
        CtClass ctClass = makeClass(applicationClass);
     ...
        // findAll
        CtMethod findAll = CtMethod.make("public static java.util.List findAll() { return play.db.jpa.JPQL.instance.findAll(\"" + entityName + "\"); }", ctClass);
        ctClass.addMethod(findAll);
    ... 
}
于 2013-01-12T08:54:52.857 回答