Yes, mapped statement. I want to build a giant subquery that depends on how many groups I have. So if I have one group I get the list of rules for it (could be 27 of them) each of these are in an object which I then thought I'd put them in a vector to pass to the mapped statement.But then I was unsure of how to get them out since each object has the same fields in it but different data (meaning different set of rules). So I need to build the subquery's where clause with these and going back to the beginning here if there is more then one group I could have multiple groups with multiple rules and each group if it exists needs to be either a UNION or INTERSECT. Does that help any?
Andrew Brandon Goodin wrote: > > You are making some statements that i don't quite understand. You keep > saying "xml properties". Are you talking about your mapped statement > configurations? Also, you are not clearly describing your issue. I'm left > wondering what you expect your SQL to look like in the end and how you > want > the vector rule objects to affect that outcome. > > Brandon > > On 3/22/07, macdoug1 <[EMAIL PROTECTED]> wrote: >> >> >> I've looked at it and I don't see anything in there that shows or speaks >> of >> handing in more then one object to use in building the dynamic sql. I >> actually included the wrong sql statement I was in a hurry and put the >> wrong >> one in. Anyway the actual statement needs to be an insert with a bunch of >> subqueries inside of it and the subqueries are select statements in which >> the where clause is built dynamically and depending on how many objects I >> have from each group mentioned below will determine how many subqueries >> will >> be made.Those fields mentioned are the fields that contain the data that >> is >> critical in building each where clause in each subquery. >> >> >> Larry Meadors-2 wrote: >> > >> > Take a look in the developers guide at dynamic SQL: >> > >> > http://ibatis.apache.org/javadownloads.cgi >> > >> > Larry >> > >> > >> > On 3/22/07, Andrew McDougall <[EMAIL PROTECTED]> wrote: >> >> >> >> My question is below that I sent yesterday but didn't register first. >> Is >> >> there any chance that I can get some ideas on this issue I have below? >> >> >> >> Thanks. >> >> Andrew >> >> >> >> >> >> ----- Forwarded Message ---- >> >> From: Andrew McDougall <[EMAIL PROTECTED]> >> >> To: [email protected] >> >> Sent: Wednesday, March 21, 2007 11:23:54 PM >> >> Subject: Having an architectural issue need some ideas >> >> >> >> >> >> >> >> To whom it may concern, >> >> >> >> I'm writting an application using iBatis and it has been really >> >> excellent so far but now I'm stuck on how to get this last part to >> work! >> >> Anyway here's my situation; I have a Vector of objects contained in it >> >> and I >> >> pass that into my DAOImpl and this is where I'd normally just pass the >> >> object into the queryForList, update,insert methods along with the >> name >> >> of >> >> the sql to call in the xml properties file. But in this case I have >> >> multiple >> >> objects that have the same fields being populated in each object and I >> >> need >> >> to be able to take these fields and pass them into the xml properties >> >> file >> >> where they are used in the sql statements as the values passed in. At >> >> this >> >> point I also need to be able to build dynamic statement in the sql >> based >> >> on >> >> if there are values in these fields. So potentially I could have a >> huge >> >> select statement or just a very short one depending on the data passed >> in >> >> those objects. >> >> >> >> For example: >> >> Vector vector = new Vector(); >> >> Rule rule; >> >> >> >> Iterator itr = rgplist.iterator(); >> >> >> >> //Have the group(s). Now need to get the set of rules for each group. >> >> >> >> while(itr.hasNext()){ >> >> >> >> grp = (Groups)itr.next(); >> >> >> >> //Get the rules for each group and put it in a list >> >> >> >> ruleslst = getRules(grp); >> >> >> >> for(int i = 0; i < ruleslst.size(); i++){ >> >> >> >> rule = (Rule) vector.get(i); >> >> >> >> vector.add(rule); >> >> >> >> } >> >> >> >> } >> >> >> >> >> >> >> >> buildWhereClause(vector); >> >> >> >> >> >> >> >> public buildWhereClause(Vector vector){ >> >> >> >> mtf.insertWhereCluase(vector); >> >> >> >> } >> >> >> >> >> >> >> >> DAOImpl >> >> >> >> Rule rule; >> >> >> >> public void insertWhereClause(Vector vector){ >> >> >> >> for(int i=0;i<vector.size();i++){ >> >> >> >> rule = (Rule)vector.get(i); >> >> >> >> >> >> >> >> //These are the fields that I need to pass in from the object >> >> depending on how many are in the vector. >> >> >> >> //these same fields can be just one or many but I don't want >> to >> >> overwrite the fields on each iteration. >> >> >> >> rule.getCellId(); >> >> >> >> rule.getCellRuleID(); >> >> >> >> rule.getCellTypeID(); >> >> >> >> rule.getCellTypeRuleGrp(); >> >> >> >> rule.getNam(); >> >> >> >> rule.getCd(); >> >> >> >> >> >> >> >> } >> >> >> >> getSqlMapClientTemplate().insert("insertWhereClause", >> >> ????); >> >> >> >> } >> >> >> >> >> >> >> >> >> >> >> >> Cell.xml >> >> >> >> resultMap (didn't include) >> >> >> >> >> >> >> >> <insert "insertWhereClause"> >> >> >> >> insert into tableA (a , b, c., d, e, f) values (#a#, #b#, #c#, >> #d#, >> >> #e#, #f#) >> >> >> >> </insert> >> >> >> >> >> >> >> >> >> >> >> >> So how can I do this? >> >> >> >> >> > >> > >> >> -- >> View this message in context: >> http://www.nabble.com/Fw%3A-Having-an-architectural-issue-need-some-ideas-tf3447797.html#a9617313 >> Sent from the iBATIS - User - Java mailing list archive at Nabble.com. >> >> > > -- View this message in context: http://www.nabble.com/Fw%3A-Having-an-architectural-issue-need-some-ideas-tf3447797.html#a9618317 Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
