Nested Results for Association ------------------------------ Key: IBATIS-622 URL: https://issues.apache.org/jira/browse/IBATIS-622 Project: iBatis for Java Issue Type: Bug Components: SQL Maps Affects Versions: 3.0.0 Environment: JDK jdk1.6.0_12 ibatis-3-core-3.0.0.190 JavaDB 10.5.1.1 Reporter: Bukarev Alexandr Priority: Critical
My DDLs: CREATE TABLE APP.plugins ( id INTEGER generated always as identity, name VARCHAR(256) NOT NULL, PRIMARY KEY (id), CONSTRAINT plugin_name UNIQUE (name) ); CREATE TABLE APP.JSPS ( ID INTEGER generated always as identity, NAME VARCHAR(256) NOT NULL, PLUGIN_ID INTEGER NOT NULL, PRIMARY KEY (ID), CONSTRAINT PLUGIN_FK FOREIGN KEY (PLUGIN_ID) REFERENCES PLUGINS (ID), CONSTRAINT PLUGIN_JSP_UNIQUE UNIQUE (NAME, PLUGIN_ID) ); I try create theese SQLMaps: <mapper namespace="translateanalizer.db.JSPMapper"> <resultMap id="JSPMap" type="JSP"> <id property="id" column="id"/> <result property="name" column="name"/> <association property="plugin" column="jsp_plugin_id" resultMap="PluginMap"/> </resultMap> <resultMap id="PluginMap" type="Plugin"> <id property="id" column="plugin_id"/> <result property="name" column="plugin_name"/> </resultMap> <select id="selectJSPs" resultMap="JSPMap"> select p.name as plugin_name, p.id as plugin_id, j.name, j.id, j.plugin_id as jsp_plugin_id from app.plugins p inner join app.jsps j on p.id = j.plugin_id </select> </mapper> Then selectJSPs generates one Plugin class instanse for every row in ResultSet, thougth JSP relation to Plugin is "Many-To-One" -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@ibatis.apache.org For additional commands, e-mail: dev-h...@ibatis.apache.org