Standard SQL doesn't allow you to refer to a column alias in a WHERE clause. TARGET_PARTY_ID is an alias of PN.PARTY_ID
kenji BJ Freeman (JIRA) wrote: > [ > https://issues.apache.org/jira/browse/OFBIZ-1321?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12533563 > ] > > BJ Freeman commented on OFBIZ-1321: > ----------------------------------- > > David did comment on this above. > it does not matter which way I have it, I still get ERROR: column > "target_party_id" does not exist) > you will notice that only one is not found > > PostgreSQL version 7.4.13 (With schemas) > > <datasource name="localpostgres" > helper-class="org.ofbiz.entity.datasource.GenericHelperDAO" > schema-name="public" > field-type-name="postgres" > check-on-start="true" > alias-view-columns="flase" > add-missing-on-start="true" > use-fk-initially-deferred="false" > join-style="ansi" > use-binary-type-for-blob="true"> > <!-- use this attribute to make the EntityListIterator more > effective for pgjdbc 7.5devel and later: > result-fetch-size="50" > --> > <read-data reader-name="seed"/> > <read-data reader-name="demo"/> > <read-data reader-name="ext"/> > <inline-jdbc > jdbc-driver="org.postgresql.Driver" > jdbc-uri="jdbc:postgresql://127.0.0.1:5432/dbname" > jdbc-username="dbuser" > jdbc-password="dbpassword" > isolation-level="ReadCommitted" > pool-minsize="2" > pool-maxsize="20"/> > <!-- <jndi-jdbc jndi-server-name="default" > jndi-name="java:comp/env/jdbc/localpostgres" > isolation-level="ReadCommitted"/>--> > <!-- <jndi-jdbc jndi-server-name="default" > jndi-name="comp/env/jdbc/xa/localpostgres" isolation-level="ReadCommitted"/> > --> <!-- Orion Style JNDI name --> > <!-- <jndi-jdbc jndi-server-name="localweblogic" > jndi-name="PostgresDataSource"/> --> <!-- Weblogic Style JNDI name --> > <!-- <jndi-jdbc jndi-server-name="default" > jndi-name="jdbc/localpostgres" isolation-level="ReadCommitted"/> --> <!-- > JRun4 Style JNDI name --> > <!-- <tyrex-dataSource dataSource-name="localpostgres" > isolation-level="ReadCommitted"/> --> > </datasource> > > > > Target exception: org.ofbiz.entity.GenericDataSourceException: SQL Exception > while executing the following:SELECT PN.PARTY_ID AS TARGET_PARTY_ID, > ND.NOTE_ID AS NOTE_ID, ND.NOTE_NAME AS NOTE_NAME, ND.NOTE_INFO AS NOTE_INFO, > ND.NOTE_DATE_TIME AS NOTE_DATE_TIME, ND.NOTE_PARTY AS NOTE_PARTY FROM > public.PARTY_NOTE PN INNER JOIN public.NOTE_DATA ND ON PN.NOTE_ID = > ND.NOTE_ID WHERE (TARGET_PARTY_ID = ?) ORDER BY NOTE_DATE_TIME DESC (ERROR: > column "target_party_id" does not exist) > > >> SQL creation has changed format in ver 4.0 >> ------------------------------------------ >> >> Key: OFBIZ-1321 >> URL: https://issues.apache.org/jira/browse/OFBIZ-1321 >> Project: OFBiz >> Issue Type: Bug >> Components: framework >> Affects Versions: Release Branch 4.0 >> Reporter: BJ Freeman >> Assignee: David E. Jones >> Fix For: Release Branch 4.0 >> >> >> I update from the latest 4.0 release >> all of a suddent the SQL has under scores where it did not before. >> example >> viewprofile.bsh >> Method Invocation delegator.findByAnd : at Line: 86 : in file: >> component://party/webapp/partymgr/WEB-INF/actions/party/viewprofile.bsh : >> delegator .findByAnd ( "PartyNoteView" , UtilMisc .toMap ( "targetPartyId" , >> partyId ) , UtilMisc .toList ( "-noteDateTime" ) ) >> now produces >> Target exception: org.ofbiz.entity.GenericDataSourceException: SQL Exception >> while executing the following:SELECT PN.PARTY_ID AS TARGET_PARTY_ID, >> ND.NOTE_ID AS NOTE_ID, ND.NOTE_NAME AS NOTE_NAME, ND.NOTE_INFO AS NOTE_INFO, >> ND.NOTE_DATE_TIME AS NOTE_DATE_TIME, ND.NOTE_PARTY AS NOTE_PARTY FROM >> public.PARTY_NOTE PN INNER JOIN public.NOTE_DATA ND ON PN.NOTE_ID = >> ND.NOTE_ID WHERE (TARGET_PARTY_ID = ?) ORDER BY NOTE_DATE_TIME DESC (ERROR: >> column "target_party_id" does not exist) >