You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ibatis.apache.org by "Sven Boden (JIRA)" <ib...@incubator.apache.org> on 2005/12/09 19:45:09 UTC
[jira] Commented: (IBATIS-231) Grougby for 1:1 relationship
[ http://issues.apache.org/jira/browse/IBATIS-231?page=comments#action_12359924 ]
Sven Boden commented on IBATIS-231:
-----------------------------------
I'm pretty sure this is a non-issue... Why would you use "group by" for a guaranteed 1:1 relationship. You can look at the attachment in JIRA-227 to see an example of 1:1 containment relationship without using "group by".
The reason for the List in "group by" is that it's not sure your relationship is 1:1. If more than 1 row would satisfy the "group by" for 1 parent object you need a List to store the children.
Unless countered this JIRA can be closed as "invalid".
Regards,
Sven
> Grougby for 1:1 relationship
> ----------------------------
>
> Key: IBATIS-231
> URL: http://issues.apache.org/jira/browse/IBATIS-231
> Project: iBatis for Java
> Type: Wish
> Components: SQL Maps
> Environment: Windows
> Reporter: Leo Tu
>
> I have two classes, one is Parent(master) another is Child(Detail), but they are 1:1 relationship,
> The question is that in child class contains just one parent object, but i must use List for getter/setter elsewise
> has problem, why ?
> ===================================================
> // parent
> public class CustGroup {
> ...
> }
> // child
> public class Cust {
> ...
> private CustGroup custGroup; // 1:1
> ...
> public void setCustGroupjava.util.List custGroupList) { ... } // why it must be List data type ?
> public java.util.List getCustGroup() { ... } // why it must be List data type ?
> ...
> }
> <resultMap id="CustGroup-result" class="CustGroup">
> ...
> </resultMap>
> <resultMap id="CUST-result" class="Cust">
> ...
> <result property="custGroup" resultMap="CUST_GROUP"/> <!-- 1:1 -->
> </resultMap>
> ===================================================
> 1:1, but groupby must use List for getter/setter,
> Can't use
> public void setCustGroup(CustGroup custGroup) { ... } // I hope can use this methd
> public CustGroup getCustGroup() { ... } // I hope can use this methd
> Best Regards,
> Leo
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira