Hibernate roundtrip toolsThe Roundtrip tools mostly provide support for transforming to and from sourcecode (java), mappingfiles (hbm) and a database definition (ddl). The goal of these tools is to help support the usage of Hibernate in almost any kind of development or "learning" circle. Note, that not all tools provide complete support for all features in Hibernate. Mainly because some of the transformations is by design "lossy". E.g. going form .class files to a .hbm mapping file is not possible to do completely as the .class file does not include all the information needed for the .hbm file - much of it can only be "best guesses". Three roundtrip tools for Hibernate are provided as a part of the Hibernate Extensions download. Each taking care of one kind of transformation (one step in the cricle). Their usage is documented in the "Toolset Guide" chapter of the Hibernate reference documentation. The three tools are: class2hbm: Transforms from .class to .hbm files. The usage and output is mainly for "quick starters" that already have some source code/class files they want to persist. Expect to hand-modify the generated .hbm files for proper usage. hbm2java: The "codegenerator" which uses the .hbm file to generate java source code. The output is very complete and per default should be usable without any hand coding. If there are special needs, hbm2java is very customizable regarding the generated code. Especially with extra annotations in form of <meta> tag's in hbm.xml. ddl2hbm: Uses JDBC to generate .hbm mapping files. Is considered deprecated as the Middlegen support for Hibernate provides a newer and more up-to-date solution. No documentation is provided for this tool.
|