That s not a typical requirement (99.99% of applications using iBatis or whatever ORM knows the DB schema). iBatis is a SQL mapper, you must write the SQL query yourself. And there is no standard SQL query (AFAIK) that gives you the number of columns in a table.
I can only suggest two approaches:
Make a SQL query selecting from the catalog tables. That s the normal way of knowing about your DB metadata. But that depends on your particular database engine. And it s not related to iBatis.
QUick and dirty: make an ad-hoc query SELECT * FROM MYTABLE LIMIT 1
(replace LIMIT for your DB analog), map that in iBatis through a HashMap, and in your DAO just count the number of keys.