Re: Dynamic condition/fields

2005-09-21 Thread Mathew Samuel
Since you're using dynamic elements anyway, I would say it is nice to have a predicate builder along the lines that you have. Cheers. --- TNO <[EMAIL PROTECTED]> wrote: > Hello, > I have an object WhereOrderBy which create a string > for my dynamic > condition to a query, then I give the strin

Re: Dynamic condition/fields

2005-09-21 Thread TNO
Hello, I have an object WhereOrderBy which create a string for my dynamic condition to a query, then I give the string to the Ibatis Query. Is that a good way to do like that ? ex. : WhereOrderBy wob = new WhereOrderBy(); wob.getWhere().addAnd(new Equality("TOTO", new Integer(10))); wob.ge

Re: Dynamic condition/fields

2005-09-20 Thread Mathew Samuel
Looks like I might have to do it with inline parameters for now. To add to Larry's comments, it WOULD be convenient to even have a simple iterator that feeds off a map, to generate the required pairs. For example, Assume FIELD1, FIELD2 & FIELD3 exists in the database for TABLE1, and some code

Re: Dynamic condition/fields

2005-09-20 Thread Ron Grabowski
I think my idea is strange...I'd vote -1 for it :-/ Do you think a generic callBackTag would be helpful? You would pass in a class that could do processing once ibatis has done its job: FIELD1 $likeClause$ #attribute1# In your case you would wrap the entire generated sql into a call

Re: Dynamic condition/fields

2005-09-20 Thread Larry Meadors
Honestly, I can say in the 3 years (?!) i have been using iBATIS, I have never needed to do that..but at the same time, I can see where it might be useful. I can see a MUCH larger use in this way - I spent last weekend writing a DAO implementation for an LDAP directory...LDAP queries are every bit

Re: Dynamic condition/fields

2005-09-20 Thread Mathew Samuel
Problem 3 (Q3) is not for logging/debugging purposes. It's to actually modify (mostly append) the generated SQL text, say, to add additional SQL constructs before it is sent to the execution engine. Thanks --- Ron Grabowski <[EMAIL PROTECTED]> wrote: > Q1. > You could pass your parameters i

Re: Dynamic condition/fields

2005-09-20 Thread Larry Meadors
On 9/20/05, Ron Grabowski <[EMAIL PROTECTED]> wrote: > Q3. > All sql statements to/from the database are logged. You can capture > those and do whatever you want with them. I think what he's looking for here is a way to get the SQL before it is executed to tweak it. No, there is not currently a w

Re: Dynamic condition/fields

2005-09-20 Thread Ron Grabowski
Q1. You could pass your parameters in as a Map and use a literal: FIELD1 $likeClause$ #attribute1# Q2. You could use a literal for this as well. Remember that ibatis isn't a sql parser, it doesn't know anything about your column names. It sees everything as text so there's nothing like thi

Dynamic condition/fields

2005-09-20 Thread Mathew Samuel
Q1. What's the best way to dynamically alter ('=' or 'like') to ('!=' or 'not like') in a pre-constructed option ? e.g. FIELD1 like #attribute1# can become FIELD1 not like #attribute1# or vice-versa. Q2. Is there a way to dynamically add fields to an SQL statement (selec