0

I'm new to iBatis and I'm trying to implement a pretty simple subquery, but it doesn't seem to be working. Here is my query:

<select id="GetData" parameterType="java.util.Map"
            resultMap="DataMap">
        SELECT * FROM schema.table1 WHERE id = (SELECT someid FROM schema.table2 WHERE id=#{parameterid});
 </select>

my iBatis DAO method looks like this:

public Data get(Long parameterid)
{
    Map<String, Object> params = new HashMap<String, Object>();
    params.put("parameterid", parameterid);
    return getSqlSession().selectOne("GetData", params);
}

Thanks for any advice!

Gurwinder Singh
  • 38,557
  • 6
  • 51
  • 76
user2827707
  • 437
  • 2
  • 7
  • 16
  • What error you are getting? – Amit Bhati Feb 02 '17 at 19:49
  • "but it doesn't seem to be working" is meaningless. Is there an error message? Show us the whole error message including stack trace. What kind of database is it? Did you try the same query directly in the database? – vanje Feb 02 '17 at 19:51
  • Using a postgres 9.5 database, and I'm not seeing any errors...I'm using a debugger and seeing that it fails at the point of my query. – user2827707 Feb 02 '17 at 19:59
  • (Using Oracle) Occasionally one of our developers will paste from Oracle SQL developer into eclipse (for example) and bring a trailing semicolon along for the ride. When run through JDBC, you'll get a SQL syntax error. Try removing the semicolon from your SQL. Also, see this: http://stackoverflow.com/questions/11855799/understanding-mysterious-oracle-jdbc-errors-ora-00911-invalid-character – Michael Peacock Feb 02 '17 at 22:12

1 Answers1

0

The problem ended up not being with my query...it was my mapping definition in my xml. Issue with a lowercase that should have been uppercase.

user2827707
  • 437
  • 2
  • 7
  • 16