oracle - Exception weblogic.deployment.QueryProxyImpl cannot be cast to javax.persistence.TypedQuery when I build a Criteria-Based TypedQuery -


good day!

i'm using criteria query build query table, predicates, this:

        criteriabuilder cb = em.getcriteriabuilder();         criteriaquery q = cb.createquery();         root<foo> root = q.from(foo.class);          list<predicate> predicates = new arraylist<predicate>();          [added predicates]          q.select(root).where(predicates.toarray(new predicate[]{})); 

as can see, there nothing strange in code snippet...but when build typed query result list of query:

typedquery<foo> finalquery = em.createquery(q); list<foo> result =  finalquery.getresultlist(); 

i exception when run in weblogic 10.3.5, in typed query creation line:

weblogic.deployment.queryproxyimpl cannot cast javax.persistence.typedquery 

i build entire code snippet based on oracle example, can find in url: http://docs.oracle.com/javaee/6/tutorial/doc/gjrij.html

what think error?

thanks everyone!

edit: exception showed when haven't put jpa 2 library in weblogic classpath. have add next line in commenv.sh/commenv.cmd file:

linux:

pre_classpath=${bea_home}/modules/javax.persistence_1.0.0.0_2-0-0.jar:${bea_home}/

modules/com.oracle.jpa2support_1.0.0.0_2-0.jar

export pre_classpath

windows:

set pre_classpath=%bea_home%\modules\javax.persistence_1.0.0.0_2-0-

0.jar;%bea_home%\modules\com.oracle.jpa2support_1.0.0.0_2-0.jar

try writing:

criteriaquery<foo> q = cb.createquery(); 

before had:

criteriaquery q = cb.createquery(); 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -