java - how to get column metadata in mybatis -


i need list of columns in table using mybatis/ibatis in java 1.5.

that's not typical requirement (99.99% of applications using ibatis or whatever orm knows db schema). ibatis sql mapper, must write sql query yourself. , there no standard sql query (afaik) gives number of columns in table.

i can suggest 2 approaches:

  1. make sql query selecting catalog tables. that's normal way of knowing db metadata. depends on particular database engine. , it's not related ibatis.

  2. quick , dirty: make ad-hoc query select * mytable limit 1 (replace limit db analog), map in ibatis through hashmap, , in dao count number of keys.


Comments

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -