SQL查询类在SELECT中没有持久字段

时间:2016-02-25 12:56:37

标签: postgresql jdo

 static void go() {
    PersistenceManager pm = null;
    Transaction tx = null;
    try {
        pm = new JDOFactory().getFactory().getPersistenceManager();
        tx = pm.currentTransaction();
        Query q = pm.newQuery("javax.jdo.query.SQL", "select * from \"OAUTHTEMP\" where \"O_AUTH_TOKEN\"=:oAuthToken and \"O_AUTH_VERIFIED\"=:oAuthVerified");
        Map params = new HashMap();
        params.put("oAuthToken", "08f727ab-7132-426c-8fc2-9ce2b30ebf9d");
        params.put("oAuthVerifier", "C3ExGzv+cAQkOqwL4oY94fZhDyVLyo/0H31w8F3q+YYLSBDxl2YARcglqPuKcsfT");
        List<OAuthTemp> result = (List<OAuthTemp>) q.executeWithMap(params);
    } catch (Exception e) {
        e.printStackTrace();
    }
}

这是我根据令牌和验证程序获取所有数据的函数,但我得到以下异常:

  

SQL查询类在SELECT中没有持久字段:select * from&#34; OAUTHTEMP&#34;其中&#34; O_AUTH_TOKEN&#34; =:oAuthToken和&#34; O_AUTH_VERIFIED&#34; =:oAuthVerified   org.datanucleus.exceptions.NucleusUserException:SQL查询类在SELECT中没有持久字段:select * from&#34; OAUTHTEMP&#34;其中&#34; O_AUTH_TOKEN&#34; =:oAuthToken和&#34; O_AUTH_VERIFIED&#34; =:oAuthVerified       在org.datanucleus.store.rdbms.query.SQLQuery.prepareForExecution(SQLQuery.java:994)       在org.datanucleus.store.rdbms.query.SQLQuery.executeWithMap(SQLQuery.java:818)       在org.datanucleus.api.jdo.JDOQuery.executeInternal(JDOQuery.java:369)       在org.datanucleus.api.jdo.JDOQuery.executeWithMap(JDOQuery.java:276)       在com.xenonstack.demo.test.Test.go(Test.java:61)       在com.xenonstack.demo.test.Test.main(Test.java:40)

我的OAuthTemp类就是这个 OauthTemp class

1 个答案:

答案 0 :(得分:0)

您似乎有一个名为onActivityCreated()的参数的查询,但为oAuthVerified提供了值。也许如果你解决它会起作用吗?