2013-01-12 59 views
1

我只看到這一點:Play!框架中GenericModel.findAll的實現在哪裏?

 /** 
    * 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序列?

回答

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); 
    ... 
} 
+0

提前感謝! – MrROY

+0

PS:如果您需要查看sql生成的屬性,請在yoru application.conf中將以下屬性設置爲true: jpa.debugSQL = true – emt14