If you intend to receive more than one record you should use queryForList. If you intend to only receive one record as a class then you would use queryForObject. If you are using queryForObject and only want one object back then your SQL query is returning more than one result and will fail. You need to check your query against the database and you will see that it is returning more than one result.
Brandon On 5/7/05, Brian Beaulieu <[EMAIL PROTECTED]> wrote: > I can not seem to get around this error: > > java.sql.SQLException: Error: executeQueryForObject returned too many > results. > at > com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryForO > bject(GeneralStatement.java:104) > at > com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(SqlMapEx > ecutorDelegate.java:561) > ... > > I'm just getting started with iBATIS and therefore not doing anything > complex. > > Here's some info: > > Using PostgreSQL 8 with JDBC v3 driver > > Selecting 2 columns, 'customer_id' and 'company', customer_id is a serial > and company is text. > > <select id="getCustomer" parameterClass="int" > resultClass="net.ci.biz.Customer"> > SELECT * from customer where customer_id = #value# > </select> > > That query works fine.. > > <select id="getCustomers" resultClass="java.util.HashMap"> > SELECT customer_id,company FROM CUSTOMER > </select> > > This one returns the error.. I've tried using explicity resultMaps .. Same > problem > > Any ideas? Could it be this newer JDBC driver? > > I've searched online, mailing lists, wiki, faq, docs, etc.. > > Thanks! > > Brian > > -- > ---------------------[ Ciphire Signature ]---------------------- > From: [EMAIL PROTECTED] signed email body (936 characters) > Date: on 07 May 2005 at 20:57:03 UTC > To: ibatis-user-java@incubator.apache.org > ---------------------------------------------------------------- > : Ciphire has secured this email against identity theft. > : Free download at www.ciphire.com. The garbled lines > : below are the sender's verifiable digital signature. > ---------------------------------------------------------------- > 00fAAAAAEAAACfK31CqAMAALECAAIAAgACACBzM1QacHMWU6J0YX+gvNWvLaffTU > jA90H3gKPnRnGGegEAhGATdFF1YNTXlLvKaOvXtndKrxt6WnleaxwaDvLUthCAkO > vIuyq2oYqaEA5c7HZpfLGs2u/4hAT1BuxbNpRvFg== > ------------------[ End Ciphire Signed Message ]---------------- > >