ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From soussou97 <dbousse...@yahoo.fr>
Subject Re: Simple questions
Date Thu, 16 Nov 2006 11:00:14 GMT

Hi Jeff;

I have the following example :

Beans :

Public class Match {
private int matchId;  //get & set
private List matchScores; //get & set
}
Public class MatchScore {
private int matchScoreId;  //get & set
private int matchId; //get & set
private int score; //get & set
private int position; //get & set
}

SQLMap xml file:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<sqlMap namespace="Matchs">
<resultMap id="matchResult" class="match" groupBy="matchid" >
<result property="matchId" column="match_id"/>
<result property="matchScores" resultMap="Matchs.matchScoreResult" />
</resultMap>
<resultMap id=" matchScoreResult " class=" matchScore"> 
<result property=" matchScoreId " column=" match_score_id" />
<result property="matchId" column="match_id" />
<result property="position" column="score_pos" />
<result property="score" column="score" />

</resultMap>
<select id="getMatchList" parameterClass=”int” resultMap="matchResult">
SELECT * FROM matchs, matchs_scores WHERE matchs.match_id = #value# AND
matchs.match_id = matchs_scores.match_id
ORDER BY matchs_scores.match_id
</select>
</sqlMap>

Q : how invoke this query to get a MatchScore object equal "10" ?

Regards;


Jeff Butler-2 wrote:
> 
> I suppose there is a language issue here - I do not understand your
> question.  Maybe if you posted some Java code and XML we could help.
> 
> Jeff Butler
> 
> 
> On 11/14/06, soussou97 <dboussebha@yahoo.fr> wrote:
>>
>>
>> Hi Jeff;
>>
>> In the developer's guide or in the question "How do I get around the N
>> Plus
>> 1 selects problem" I'am sorry but the call : getProductListByCategory
>> with
>> the input parameter cat_id must returns a object of type
>> "com.ibatis.example.Category" but no a list ? I search only one category
>> object matching a cat_id so my query must retrieve a category object
>> containing a sub-list of products.
>> So the call must be realize with queryObject but not with a queryForList
>> ?
>>
>> Q2 : I have the solution.
>>
>> regards;
>>
>>
>> Jeff Butler-2 wrote:
>> >
>> > Please stop asking the same question over and over again.
>> >
>> > 1. Please read the developer's guide regarding N+1 queries and complex
>> > properties
>> >
>> > 2. Do you have a question about multiple databases, or is this just a
>> > statement of fact?
>> >
>> > Jeff Butler
>> >
>> >
>> > On 11/14/06, soussou97 <dboussebha@yahoo.fr> wrote:
>> >>
>> >>
>> >> Hi;
>> >>
>> >> 1-/ How implement the call to get only one object matching a catID in
>> >> using
>> >> example :
>> >>
>> >> CategorisedProductList with properties
>> >> Category cat;
>> >> List<Product> prodList;
>> >>
>> >> is like this : return (CategorisedProductList )
>> >> queryForObject("getCategorisedProduct", catID) ?
>> >>
>> >> 2-/ My DAO use 3 databases with JDBC connection: 2 with Mysql and a
>> >> Oracle
>> >> and I search a configuration example for multiple databases. I know
>> that
>> >> it
>> >> is necessary to use 3 contexts in the the dao.xml file and 3
>> >> sql-map-config.xml files.
>> >>
>> >> regards;
>> >>
>> >>
>> >>
>> >>
>> >> --
>> >> View this message in context:
>> >> http://www.nabble.com/Simple-questions-tf2628323.html#a7334384
>> >> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>> >>
>> >>
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Simple-questions-tf2628323.html#a7341635
>> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/Simple-questions-tf2628323.html#a7375546
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


Mime
View raw message