I have an insert statement in MyBatis using Oracle 11g R2 on the backend with the Oracle ojdbc6 driver.
I am repeatedly getting
java.sql.SQLSyntaxErrorException: ORA-01745: invalid host/bind variable name
However I don't see what is causing the issue, I'm not using any Oracle reserved Keywords.
<insert id="createRecord" parameterType="org.appliication.core.domain.TRRecord"
statementType="PREPARED" useGeneratedKeys="true" keyColumn="ID" keyProperty="id">
INSERT INTO T_TR_PUBLICATION p (
p.TR_UID,
p.TITLE,
p.ITEM_TITLE,
p.COVER_DATE,
p.HAS_ABSTRACT,
p.ISSUE,
p.SORT_DATE,
p.VOLUME,
p.BEGIN_PAGE,
p.END_PAGE,
p.ACCESSION_NO,
p.ISSN,
p.DOI,
p.FUNDING_TEXT
)
VALUES (
#{trUid, jdbcType=NULL},
#{title, jdbcType=NULL},
#{titleItem, jdbcType=NULL},
#{coverDate, jdbcType=NULL},
#{hasAbstract, jdbcType=NULL},
#{issue, jdbcType=NULL},
#{sortDate, jdbcType=NULL}
#{journalVolume, jdbcType=NULL},
#{pageBegin, jdbcType=NULL},
#{pageEnd, jdbcType=NULL},
#{accessionNo, jdbcType=NULL},
#{issn, jdbcType=NULL},
#{doi, jdbcType=NULL},
#{fundingText, jdbcType=NULL}
)
</insert>
jdbcType=NULL
, sinceNULL
is not a valid JDBC type for the purpose. You cannot bind a value to theNULL
type. – Lucaorg.appliication.core.domain.TRRecord
package/class path correct? – ParasiticVARCHAR
. This way, both a value ("abc") and a null will map to a type the JDBC driver can understand. However, I would have thought that MyBatis would have examined the types of the fields inTRRecord
to automatically choose the correct type. – Luca