concept bean in category iBatis

appears as: bes, bean, be, be, bes
iBatis in Action

This is an excerpt from Manning's book iBatis in Action.

As mentioned before, iBATIS is not an object/relational mapping (O/RM) tool; it is a query mapping tool. Because of that, the API that we will be looking at is not the only API you have available. You can still use any other API you want to create the beans that your application will use or to access your database. So, if you find that you are unable to accomplish something with iBATIS, you can still use the straight JDBC API without too much concern about the repercussions. Keep that freedom in mind as we look at what iBATIS does make available—while it does not solve every problem, it does attempt to simplify most of your data access chores.

For two properties, it is not all that useful, but if you have a bean in which you have more, it can save you some typing.

If you have a bean and want to see the names of the properties of that bean, the following sample method will use the built-in Java Introspector class to output them:

public void listPropertyNames(Class c)
    throws IntrospectionException {
  PropertyDescriptor[] pd;
  pd = Introspector.getBeanInfo(c).getPropertyDescriptors();
  for(int i=0; i< pd.length; i++) {
    System.out.println(pd[i].getName()
        + " (" + pd[i].getPropertyType().getName() + ")");
  }
}

This example uses the Introspector class to get an array of PropertyDescriptor objects for a bean, and then walks through that array to display the name and type of the properties that the bean exposes, which can be a useful troubleshooting aid.