280 APPENDIX (Web server on xp) B n HIBERNATE TOOLS APPENDIX B

280 APPENDIX B n HIBERNATE TOOLS APPENDIX B n HIBERNATE TOOLS Generating a Mapping File Hibernate Tools provides a wizard to make the creation of the boilerplate XML mapping file contents simpler. You can access the wizard via the File New Hibernate XML Mapping File menu option from within the Hibernate Console perspective. This brings up a standard Eclipse view in which you select the name and location of the generated mapping file. Clicking Next then brings you to a dialog that requires you to enter the fully qualified name of the class that the mapping file will represent. If you cannot recall the specific package and class name details, you can use the Browse button to select the class from the class hierarchy. The boilerplate mapping file will be created in the appropriate location. The wizard does not currently populate this with any of the property or association mapping details. The generated file is therefore incomplete and can only be used as a skeleton to be filled in manually. The sample output for our example Bookshelf class (which is not annotated) follows. The Hibernate Tools plug-in for Eclipse includes an editor for its various mapping files that provides context-sensitive completion this is based upon the Web Tools Platform s (WTP) support for XML files, but adds awareness of mapping file details beyond the support for the basic DTD description that WTP provides. Generating a Configuration File Hibernate Tools provides another wizard to aid in the creation of a Hibernate configuration XML file. This wizard is accessed from the File New Hibernate Configuration File menu option from within the Hibernate Console perspective. This wizard prompts you (as with the mapping file wizard) to specify a path and file name for the generated configuration file. You don t want to overwrite the configuration file used by our sample application, so for this exercise, specify a file name of example.hbm.xmlin the root of the project directory. Clicking the Next button will then take you to the dialog shown in Figure B-22, in which all the basic configuration properties can be specified. When possible, a set of default options are provided as combo box lists. The Database dialect field presents the dialects in a more human-readable format, and also filters the Driver class and Connection URL fields to the likely options.
If you are in need for chaep and reliable webhost to host your website, our recommendation is http web server services.

Leave a Reply