You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ibatis.apache.org by "Bukarev Alexandr (JIRA)" <ib...@incubator.apache.org> on 2009/08/10 15:38:14 UTC
[jira] Created: (IBATIS-622) Nested Results for Association
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-unsubscribe@ibatis.apache.org
For additional commands, e-mail: dev-help@ibatis.apache.org
[jira] Closed: (IBATIS-622) Nested Results for Association
Posted by "Clinton Begin (JIRA)" <ib...@incubator.apache.org>.
[ https://issues.apache.org/jira/browse/IBATIS-622?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Clinton Begin closed IBATIS-622.
--------------------------------
Resolution: Won't Fix
iBATIS reserves the decision whether to create a new instance or reuse the instance. Thus, iBATIS does not guarantee A1 == A2, but does guarantee that A1.equals(A2), where A defines equals as A1.id.equals(A2.id) or all mapped properties are equal otherwise. Join mapping will result in multiple instances, because iBATIS does not support object identity.
> 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 Beta 1
> 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-unsubscribe@ibatis.apache.org
For additional commands, e-mail: dev-help@ibatis.apache.org