Friday, February 29, 2008

Metawidget and Hibernate

Metawidget's new HibernateInspector knows how to inspect hibernate.cfg.xml files such as:

    <mapping resource="mapping1.hbm.xml"/>
    <mapping resource="mapping2.hbm.xml"/>
    <mapping resource="mapping3.hbm.xml"/>

From there, it traverses into the multiple mapping files such as...

<hibernate-mapping package="">
  <class name="Foo">
    <id name="baz"/>
    <property name="abc" type="clob"/>
</hibernate-mapping> extract useful UI hints. Hints like:
  • not-null fields are required fields
  • clob fields are large text boxes (like HTML textareas)
  • length attributes constrain input length
  • ids are hidden (though this is configurable)

These are the same features JpaInspector looks for in JPA annotations.