Hate to state the obvious, but is it possible that your sql window is accessing the same database instance as your jpa application (production vs test vs sandbox, etc)? Your persistence.xml doesn't have the url for the database, so is it possible that your application configuration is going to a different instance?
Sorry, but that's about the only reason that I can come up with. You have sql trace turned on, so you should be able to see if any results are being returned by jdbc. And, any results should be massaged into objects for the application. Kevin On Fri, Jul 10, 2009 at 2:29 PM, jewettdiane <[email protected]> wrote: > > I have a named query that produces the following sql: > SELECT t0.ORG_ID, t0.LST_UPDT_CD, t0.LST_UPDT_TMP, t0.LST_UPDT_USER_ID, > t0.ADP_ACCOUNT_TYPE_CD, t0.BILLING_CYCLE_CD, > t0.BILLING_FIRST_DT, t0.CONTRACT_SIGNED_DT, t0.CUST_ORG_ID, > t0.DUNS_NBR, t0.fein, t0.INTEGRATION_HOST_SYS_ID, > t0.INTEGRATION_TYPE_CD, t0.NAICS_CD, t0.NETSECURE_CLIENT_ID, > t0.NETSECURE_STATUS, t0.ooid, t0.ORG_DBA_NAME, t0.ORG_NAME, > t0.ORG_TYPE_ID, t0.ORG_URL, t0.EMPLOYER_ORG_ID, > t0.PARENT_ORG_ID, t0.PAYROLL_VENDOR_CD, t0.SERVICES_BEGIN_DT, > t0.SERVICES_END_DT, t0.SIC_CD, t0.sor > FROM ORGANIZATION t0 > WHERE (t0.CUST_ORG_ID = ? AND t0.ooid = ? AND t0.sor = ?) > [params=(String) AR, (String) ABC123123, (String) Enterprise] > > When I paste this sql in my database sql window. I get a result but when I > run it on my server it returns a NoResultException. > > My persistence.xml: > <persistence-unit name="EI9DS" transaction-type="RESOURCE_LOCAL"> > <provider> > org.apache.openjpa.persistence.PersistenceProviderImpl > </provider> > > <class>com.adp.ei9.common.entity.EntityBase</class> > <class>com.adp.ei9.common.entity.Employee</class> > <class>com.adp.ei9.common.entity.Employment</class> > <class>com.adp.ei9.common.entity.I9User</class> > <class>com.adp.ei9.common.entity.Organization</class> > <class>com.adp.ei9.common.entity.OrgType</class> > <properties> > <property name="openjpa.TransactionMode" > value="managed" /> > <property name="openjpa.ConnectionFactoryMode" > value="managed" /> > <property name="openjpa.Log" > value="File=stdout, DefaultLevel=TRACE, > SQL=TRACE" /> > <property name="openjpa.jdbc.DBDictionary" > > value="org.apache.openjpa.jdbc.sql.OracleDictionary" /> > <property name="openjpa.ConnectionFactoryProperties" > value="PrettyPrint=true, PrettyPrintLineLength=72" /> > </properties> > </persistence-unit> > > What else should I try? It creates good sql that works. Is there a reason > objects won't return when the sql works? > > Thanks > -- > View this message in context: > http://n2.nabble.com/Named-Query-fails-but-SQL-works-tp3237379p3237379.html > Sent from the OpenJPA Users mailing list archive at Nabble.com. >
