IBATIS - inserting literals (removing quotes from your sql)

SQL, Development, Work — Chris on April 26, 2008 at 11:49 pm

When using IBATIS, use $parameter$ to inject literals in your sql maps. For instance, if you have a sql query that injects a comma separated list of ids, using #parameter# will put quotes in the sql, causing an error if you were using the “in” operator. Using $parameter$ removes the quotes and your sql is content.

Example with #:

select filter.id from filter where filtertypeid = #filterTypeId#
and typeid in (#typeIds#);

could yield

select filter.id from filter where filtertypeid = '2' and typeid in ('0,1,4');

Example with $:

select filter.id from filter where filtertypeid = #filterTypeId#
and typeid in ($typeIds$);

could yield

select filter.id from filter where filtertypeid = '2' and typeid in (0,1,4);

Conclusion:

Remember to use your dollar signs.

Thoughts on Wicket - 6 months later

Work, Web Apps, Tools, Java — Chris on January 26, 2008 at 12:45 pm

It’s been about 6 months now since our development team picked up the Wicket framework. So far, so good! It’s been enjoyable to code using this framework, and it has certainly been a productivity booster.  It’s really helped to streamline our processes for our applications and helps to keep our look and feel consistent.

Some of the things I love about wicket are as follows:

  • Component Based
  • Separation of code and markup
  • Minimal XML, Java handles the configuration
  • The community is active and helpful
  • The core framework focuses on needs, and extensions fulfill specific cases

Some of the things I dislike:

  • There are many extensions, too many it seems.  It would be great if wicket could filter this down, possibly to a more focused extensions package.
  • The separation of code and markup takes some getting used to in terms of using dynamic javascript (I am used to managing these within a page, or with includes [ie: php and ruby])

Overall, if you are a Java shop looking to build web applications at a faster pace, keeping things organized and having fun writing Java, this is an excellent framework to adopt.

More to come on this framework.

XSL Transformation Error with Java and Xalan Parser

Work, Java — Chris on September 17, 2007 at 10:22 am

We provide custom XSL outputs for some of our clients at work. One of the custom outputs started failing when we patched our version of Java. The culprit, make sure your <fo:table-header> tags have content in them. If they are empty, remove the tag altogether.

Get Organized, Use Backpack

Work, Web Apps, Tools, Life — Chris on September 16, 2007 at 5:58 pm

I have been using backpack for about 6 months now, and I love it. I typically write quick notes throughout my day, whether at work or at home, and track daily, weekly and monthly to-do lists. Since I am a web app developer, I often have a browser open, and one of those tabs is usually set aside for backpack. It helps me stay organized with what I have to do between home and work, and keeps me on track with my day-to-day work tasks. It also helps that the interface is intuitive and to the point. I recommend you take it for a test drive today.

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License. | Chris Fierer