Well, if I serialize the Example class, then changing the db vendor isn't an issue, but it's a very good point if I decided to save the actual built SQL statement.
-Ryan On Mon, Feb 25, 2008 at 11:13 AM, Nathan Maves <[EMAIL PROTECTED]> wrote: > not to rain on the parade but I think the idea of storing sql would be a > bad thing. Just imagine the amount of work in the event of a DB vendor > switch.... ouch > > I would say think outside the box and find a different solution to storing > the save criteria. Even the idea of serializing the Java class gives me > chills. > > > On Mon, Feb 25, 2008 at 11:27 AM, Ryan Shelley <[EMAIL PROTECTED]> > wrote: > > > You're correct about the Abator example class. The idea is that there > > will be records in the database that my users want to extract based upon > > their own criteria. I can allow them to filter dynamically based upon the > > Example classes, however, if they want to save that filter for later (since > > they can be complex), I'd like to store it in the database. Since the > > values of the filter don't change, I don't see a problem with saving the > > Example class. I did figure out that I could serialize the Example class > > and store that in the database, and unserialize it when I want to use it, so > > that is probably the best option for now. > > > > > > On Mon, Feb 25, 2008 at 8:49 AM, Jeff Butler <[EMAIL PROTECTED]> > > wrote: > > > > > I assume you are talking about the Abator example classes. But this > > > isn't exactly an Abator issue. > > > > > > iBATIS dynamic SQL is resolved at run time based on the values in the > > > parameter object - so you'd need to capture the SQL after the resolution > > > step and save it somewhere. You could probably do this by tinkering with > > > iBATIS internals, but the easiest way to do it would be to create a custom > > > logger and grab the SQL from the log. > > > > > > Another alternative would be to serialize the example class as you've > > > suggested - but this doesn't save the SQL, it only saves the values in the > > > example class - which would generate the same SQL on reuse. > > > > > > Is this some kind of a user preference or user history thing? > > > > > > Jeff Butler > > > > > > > > > > > > > > > > > > > > > On Sun, Feb 24, 2008 at 4:02 PM, Ryan Shelley <[EMAIL PROTECTED]> > > > wrote: > > > > > > > I'd like to be able to save the WHERE clause generated by the > > > > Example classes in a database. The purpose is so that I can allow > > > > users to > > > > create custom filters which distill down to SQL criteria, and then save > > > > them > > > > for re-use later. I'm curious if anyone else has had a similar > > > > requirement, > > > > and whether they attempted to serialize the Example object to XML, or if > > > > they attempted to capture the generated SQL in another SQL statement. > > > > Any > > > > thoughts? Thanks! > > > > > > > > -Ryan > > > > > > > > > > > > >
