288 APPENDIX B n HIBERNATE TOOLS APPENDIX B n HIBERNATE TOOLS Table B-2. Continued Element Description Generates HTML documentation for the database schema from the metamodel Generates standard DAOs from the metamodel Generates arbitrary user-defined output from the metamodel Runs arbitrary HQL queries against the database using the mapping information in the metamodel You may notice that the exporters available as Ant tasks correspond fairly closely to the exporters available in the Hibernate Code Generation tool largely because they rely upon the same underlying implementations. The two most commonly used tasks are , which can generate a database schema directly from the *.hbm.xml mapping files, and , which, conversely, can generate mapping files directly from the database. The element generates DDL scripts from the metamodel. These can be written to a file or, if the configuration object is provided with database connection details, they can be run directly against the database. Table B-3 shows the attributes that can be supplied. Table B-3. The Attributes Available to the Element Property Default Description create true If set to true, causes the generated DDL to include commands to create database objects. This allows to distinct tasks to be created: one to drop all relevant database objects (using the drop attribute) and the other to create them. console true If set to true, causes the generated DDL to be displayed on the console. delimiter ; Specifies the delimiter to be used to separate DDL statements. destdir If set, overrides, for this exporter only, the destination directory specified on the tools task. drop false If set to true, causes the generated DDL to include commands to drop preexisting database objects before it tries to create them. This may cause warning messages, depending upon the preexisting state of the database; and it of course has the potential to destroy existing data. export true If set to true, causes the DDL to be run directly against the database (this has the potential to delete data do not use carelessly). format false If set to true, causes the generated DDL to be formatted using whitespace in a more readable fashion. We recommend using this option if you will be writing the DDL to a file. haltonerror false If set to true, causes the script to halt if an error is encountered while generating the DDL (typically, this is used while exporting directly to the database to increase the visibility of any problems encountered while setting up the schema). outputfilename Specifies the name of the file name that the generated DDL should be stored in. If left unset, the generated DDL will not be stored. update false Indicates that the tool should attempt to generate the appropriate statements to bring the existing schema inline with the model. We don t recommend using this option.
Looking for affordable and reliable webhost to host and run your business application? Then look no more and go to servlet web hosting services.
This entry was posted
on Saturday, September 29th, 2007 at 9:00 am and is filed under tomcat.
You can follow any responses to this entry through the RSS 2.0 feed.
You can leave a response, or trackback from your own site.