jenom takova mala technicka, iBatis me celkem dobre vyresene dynamicke skladani dotazu, tak proc je vytvaret primo v kodu...

viz elementy
include
isNotPropertyAvailable
isPropertyAvailable

atd.

Tomas Beranek napsal(a):
takze pro Ty co by meli stejny problem reseni je jednoduche

<select id="findCouplesByParameters" resultMap="coupleResultMap"
parameterClass="string">
 $sqlQuery$
</select>

parametry oznacene $$ se nebudou brat jako parametry, jako prosty text


----- Original Message ----- From: "Tomas Beranek" <[EMAIL PROTECTED]>
To: "Konference Java" <[email protected]>
Sent: Thursday, February 09, 2006 11:38 AM
Subject: ibatis - vlozeni generovaneho sql


Zdravim,
mam takovyto maly problemek

v jave vygeneruji celkem slozite nejaky dotaz a pote chci zavolat dotaz pres iBatis, ktery mam nadefinovany jako

<select id="findCouplesByParameters" resultMap="coupleResultMap" parameterClass="string">
   #sqlQuery#
</select>

vysledek je takovy(dotaz jako takovy normalne projde, tady pro priklad je zcela trivialni) zrejme je problem pri vytvareni statementu primo v driveru, potreboval bych mu nejak rict, aby zrovna tento parametr
bral jako obyc. text.

java.sql.PreparedStatement     - {pstm-100001} PreparedStatement: ?
java.sql.PreparedStatement - {pstm-100001} Parameters: [SELECT * FROM couples WHERE couples.id=1 AND couples.problemstatus='NO_PROBLEM']
java.sql.PreparedStatement     - {pstm-100001} Types: [java.lang.String]

com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred while applying a parameter map.
--- Check the findCouplesByParameters-InlineParameterMap.
--- Check the statement (query failed).
--- Cause: java.sql.SQLException: ERROR: syntax error at or near "$1"
Caused by: java.sql.SQLException: ERROR: syntax error at or near "$1"

diky za rady
Tomas




--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.375 / Virus Database: 267.15.3/254 - Release Date: 8.2.2006



--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.375 / Virus Database: 267.15.3/254 - Release Date: 8.2.2006







--
S pozdravem Roman "Dagi" Pichlik

/* http://www.sweb.cz/pichlik/ Blog pro kodery */

Odpovedet emailem