From jbosstools-commits at lists.jboss.org Thu Nov 29 08:48:55 2007 Content-Type: multipart/mixed; boundary="===============3047155201791890748==" MIME-Version: 1.0 From: jbosstools-commits at lists.jboss.org To: jbosstools-commits at lists.jboss.org Subject: [jbosstools-commits] JBoss Tools SVN: r5148 - trunk/hibernatetools/docs/reference/en/modules. Date: Thu, 29 Nov 2007 08:48:54 -0500 Message-ID: --===============3047155201791890748== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ochikvina Date: 2007-11-29 08:48:54 -0500 (Thu, 29 Nov 2007) New Revision: 5148 Modified: trunk/hibernatetools/docs/reference/en/modules/ant.xml trunk/hibernatetools/docs/reference/en/modules/codegen.xml trunk/hibernatetools/docs/reference/en/modules/codegenarchitecture.xml trunk/hibernatetools/docs/reference/en/modules/plugins.xml trunk/hibernatetools/docs/reference/en/modules/reverseengineering.xml trunk/hibernatetools/docs/reference/en/modules/setup.xml Log: http://jira.jboss.com/jira/browse/RHDS-300 - Highlighting miningful wards a= nd framing the notes Modified: trunk/hibernatetools/docs/reference/en/modules/ant.xml =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/hibernatetools/docs/reference/en/modules/ant.xml 2007-11-29 12:41= :06 UTC (rev 5147) +++ trunk/hibernatetools/docs/reference/en/modules/ant.xml 2007-11-29 13:48= :54 UTC (rev 5148) @@ -5,30 +5,35 @@
Introduction = - The hibernate-tools.jar contains the core for the Hibernate Tool= s. - It is used as the basis for both the Ant tasks described in this docum= ent - and the eclipse plugins both available from tools.hibernate.org The - hibernate-tools.jar is located in your eclipse plugins directory at - /plugins/org.hibernate.eclipse.x.x.x/lib/tools/hibernat= e-tools.jar. - This jar is 100% independent from the eclipse platform and can thus be - used independently of eclipse. + The + hibernate-tools.jar + contains the core for the Hibernate Tools. It is used as the + basis for both the Ant tasks described in this document and the ecli= pse plugins both available + from tools.hibernate.org The + hibernate-tools.jar + is located in your eclipse plugins directory at + /plugins/org.hibernate.eclipse.x.x.x/lib/tools/hibernate= -tools.jar. + + + This jar is 100% independent from the eclipse platform and can= thus be used + independently of eclipse. = - - Note: There might be incompabilities with respect to the Hibernate3.ja= r bundled with the tools and your own jar. - Thus to avoid any confusion it is recommended to use the - hibernate3.jar & hibernate-annotations.jar bundled with the - tools when you want to use the Ant tasks. Do not worry about using - e.g. Hibernate 3.2 jar's with e.g. an Hibernate 3.1 project since - the output generated will work with previous Hibernate 3 versions. - = + + There might be incompabilities with respect to the Hibernate3.= jar bundled with the tools + and your own jar. Thus to avoid any confusion it is recommended to= use the hibernate3.jar + & hibernate-annotations.jar bundled with the tools when you wa= nt to use the Ant + tasks. Do not worry about using e.g. Hibernate 3.2 jar's with e.g.= an Hibernate 3.1 project + since the output generated will work with previous Hibernate 3 ver= sions. +
- = -
- The <literal><hibernatetool></literal> ant Task = - To use the ant tasks you need to have the hibernatetool task - defined. That is done in your build.xml by inserting the following x= ml - (assuming the jars are in the lib directory): +
+ The <literal><hibernatetool></literal> ant Task + + To use the ant tasks you need to have the hibernatetool task def= ined. That is done in your + build.xml + by inserting the following xml (assuming the jars are in= the + lib directory): = @@ -41,35 +46,47 @@ classpathref=3D"toolslib" /> ]]> = - this <taskdef> defines a Ant task cal= led - <hibernatetool> which now can be used anywh= ere - in your ant build.xml files. It is important to include all the - hibernate tools dependencies as well as the jdbc driver. + this + + <taskdef> + + defines a Ant task called + + <hibernatetool> + + which now can be used anywhere in your ant + build.xml + files. It is important to include all the Hibe= rnate Tools + dependencies as well as the jdbc driver. = - Notice that to use the annotation based Configuration you must= get - a release from http://annotations.hibernate.org. + Notice that to use the annotation based Configuration you must <= ulink + url=3D"http://annotations.hibernate.org">get a release. = - + = - When using the <hibernatetool> task y= ou - have to specify one or more of the following: + When using the + + <hibernatetool> + + task you have to specify one or more of the following: = - - - + + + + = - + = - + = - + = - + = - - + + = - @@ -81,65 +98,76 @@ (,,,...*) = ]]> = - - - destdir (required): destination - directory for files generated with exporters. - + + + destdir (required): destination direc= tory for files generated + with exporters. + = - - templatepath (optional): A path to = be - used to look up user-edited templates. - + + templatepath (optional): A path to be= used to look up + user-edited templates. + = - - classpath (optional): A classpath t= o be - used to resolve resources, such as mappings and usertypes. - Optional, but very often required. - + + classpath (optional): A classpath to = be used to resolve + resources, such as mappings and usertypes. Optional, but ver= y often required. + = - - property and - propertyset (optional): Used to set - properties to control the exporters. Mostly relevant for - providing custom properties to user defined templates. - + + property and propertyset (optional): = Used to set properties to + control the exporters. Mostly relevant for providing custom = properties to user defined + templates. + = - - One of 4 different ways of configuring the Hibernate M= eta - Model must be specified. - + + One of 4 different ways of configuring the Hibernate Met= a Model must be + specified. + = - - One or more of the exporters must be specified - - - + + One or more of the exporters must be specified + + + + = -
- Basic examples +
+ Basic examples = - The following example shows the most basic setup for generat= ing - pojo's via hbm2java from a normal - hibernate.cfg.xml. The output will be put in the - ${build.dir}/generated directory. + The following example shows the most basic setup for generatin= g pojo's via + hbm2java from a normal + + hibernate.cfg.xml. + + The output will be put in the + ${build.dir}/generated + directory. = - + + -]]> +]]> + = - The following example is similar, but now we are performing - multiple exports from the same configuration. We are exporting the - schema via hbm2dll, generates some DAO code via <hbm2dao> and - finally runs a custom code generation via <hbmtemplate>. Thi= s is - again from a normal hibernate.cfg.xml and the - output is still put in the ${build.dir}/generated - directory. Furthermore the example also shows where a classpath is - specified when you e.g. have custom usertypes or some mappings tha= t is - needed to be looked up as a classpath resource. + The following example is similar, but now we are performing mu= ltiple exports from the + same configuration. We are exporting the schema via hbm2dll, gener= ates some DAO code via + <hbm2dao> + and finally runs a custom code generation via + <hbmtemplate> + . This is again from a normal + hibernate.cfg.xml and the output + is still put in the + + ${build.dir}/generated + + directory. Furthermore the example also shows where a = classpath is specified + when you e.g. have custom usertypes or some mappings that is neede= d to be looked up as a + classpath resource. = - + + @@ -152,53 +180,58 @@ templatepath=3D"${etc.dir}/customtemplates" template=3D"myconstants.vm" = /> -]]> -
+]]> +
+
= -
- Hibernate Configurations +
+ Hibernate Configurations = - hibernatetool supports four different Hiber= nate - configurations: A standard Hibernate configuration - (<configuration>), Annotation based - configuration (<annotationconfiguration>), = JPA - persistence based configuration - (<jpaconfiguration>) and a JDBC based - configuration (<jdbcconfiguration>) for use - when reverse engineering. + hibernatetool supports four different Hiberna= te configurations: A + standard Hibernate configuration ( + <configuration> + ), Annotation based configuration ( + <annotationconfiguration> + ), JPA persistence based configuration ( + <jpaconfiguration> + ) and a JDBC based configuration ( + <jdbcconfiguration> + ) for use when reverse engineering. = - Each have in common that they are able to build up a Hibernate - Configuration object from which a set of exporters - can be run to generate various output. Note: output can be anything, - e.g. specific files, statments execution against a database, error - reporting or anything else that can be done in java code. + Each have in common that they are able to build up a Hibernate + Configuration object from which a set of exporter= s can be run to generate + various output. Note: output can be anything, e.g. specific files, s= tatments execution against + a database, error reporting or anything else that can be done in jav= a code. = - The following section decribes what the the various configurat= ion - can do, plus list the individual settings they have. + The following section decribes what the the various configuratio= n can do, plus list the + individual settings they have. = -
- Standard Hibernate Configuration - (<configuration>) +
+ Standard Hibernate Configuration (<configuration>)</tit= le> = - <para>A <configuration> is used to define a standard Hiberna= te - configuration. A standard Hibernate configuration reads the mappin= gs - from a cfg.xml and/or a fileset.</para> + <para>A <emphasis> + <property><configuration></property> + </emphasis> is used to define a standard Hibernate configuration. = A standard Hibernate + configuration reads the mappings from a <emphasis> + <property>cfg.xml</property> + </emphasis> and/or a fileset.</para> = - <para><programlistingco> - <areaspec> - <area coords=3D"2 55" id=3D"cfg1" /> + <para> + <programlistingco> + <areaspec> + <area coords=3D"2 55" id=3D"cfg1"/> = - <area coords=3D"3 55" id=3D"cfg2" /> + <area coords=3D"3 55" id=3D"cfg2"/> = - <area coords=3D"4 55" id=3D"cfg3" /> + <area coords=3D"4 55" id=3D"cfg3"/> = - <area coords=3D"5 55" id=3D"cfg4" /> + <area coords=3D"5 55" id=3D"cfg4"/> = - <area coords=3D"7 55" id=3D"cfg5" /> - </areaspec> + <area coords=3D"7 55" id=3D"cfg5"/> + </areaspec> = - <programlisting><![CDATA[<configuration + <programlisting><![CDATA[<configuration configurationfile=3D"hibernate.cfg.xml" propertyfile=3D"hibernate.properties" entityresolver=3D"EntityResolver classname" @@ -208,53 +241,55 @@ = </configuration>]]></programlisting> = - <calloutlist> - <callout arearefs=3D"cfg1"> - <para><literal>configurationfile</literal> (optional): The - name of a Hibernate configuration file, e.g. - "hibernate.cfg.xml"</para> - </callout> + <calloutlist> + <callout arearefs=3D"cfg1"> + <para><literal>configurationfile</literal> (optional): The n= ame of a Hibernate + configuration file, e.g. "hibernate.cfg.xml"</para> + </callout> = - <callout arearefs=3D"cfg2"> - <para><literal>propertyfile</literal> (optional): The name= of - a property file, e.g. "hibernate.properties"</para> - </callout> + <callout arearefs=3D"cfg2"> + <para><literal>propertyfile</literal> (optional): The name o= f a property file, e.g. + "hibernate.properties"</para> + </callout> = - <callout arearefs=3D"cfg3"> - <para><literal>entity-resolver</literal> (optional): name = of a - class that implements org.xml.sax.EntityResolver. Used if = the - mapping files require custom entity resolver.</para> - </callout> + <callout arearefs=3D"cfg3"> + <para><literal>entity-resolver</literal> (optional): name of= a class that implements + org.xml.sax.EntityResolver. Used if the mapping files requ= ire custom entity + resolver.</para> + </callout> = - <callout arearefs=3D"cfg4"> - <para><literal>namingstrategy</literal> (optional): name o= f a - class that implements org.hibernate.cfg.NamingStrategy. Us= ed - for setting up the naming strategy in Hibernate which cont= rols - the automatic naming of tables and columns.</para> - </callout> + <callout arearefs=3D"cfg4"> + <para><literal>namingstrategy</literal> (optional): name of = a class that implements + org.hibernate.cfg.NamingStrategy. Used for setting up the = naming strategy in + Hibernate which controls the automatic naming of tables an= d columns.</para> + </callout> = - <callout arearefs=3D"cfg5"> - <para>A standard Ant fileset. Used to include hibernate - mapping files.Remember that if mappings are already specif= ied - in the hibernate.cfg.xml then it should not be included via - the fileset as it will result in duplicate import - exceptions.</para> - </callout> - </calloutlist> - </programlistingco></para> + <callout arearefs=3D"cfg5"> + <para>A standard Ant fileset. Used to include hibernate mapp= ing files.Remember that if + mappings are already specified in the hibernate.cfg.xml th= en it should not be + included via the fileset as it will result in duplicate im= port exceptions.</para> + </callout> + </calloutlist> + </programlistingco> + </para> = - <section> - <title>Example +
+ Example = - This example shows an example where no - hibernate.cfg.xml exists, and a - hibernate.properties + fileset is used instea= d. - Note, that Hibernate will still read any global - /hibernate.properties available in the classp= ath, - but the specified properties file here will override those values - for any non-global property. + This example shows an example where no + hibernate.cfg.xml exists, + and a + hibernate.properties + fileset is used instead. = + + + + Hibernate will still read any global /hibernate.propert= ies available in + the classpath, but the specified properties file here will overr= ide those values for any + non-global property. + = - + + @@ -264,63 +299,71 @@ = = -]]> -
+]]> +
+
= -
- Annotation based Configuration - (<annotationconfiguration>) +
+ Annotation based Configuration (<annotationconfiguration&g= t;) = - An <annotationconfiguration> is used - when you want to read the metamodel from EJB3/Hibernate Annotations - based POJO's. To use it remember to put the jars file needed for u= sing - hibernate annotations in the classpath of the - <taskdef>. + An + <annotationconfiguration> is= used when you want to + read the metamodel from EJB3/Hibernate Annotations based POJO's. T= o use it remember to put + the jars file needed for using hibernate annotations in the classp= ath of the + + <taskdef>. = - The <annotationconfiguration> supports the same attrib= utes - as an <configuration> except that the configurationfile - attribute is now required as that is from where an - AnnotationConfiguration gets the list of + The + <annotationconfiguration> su= pports the same attributes as an + + <configuration> except tha= t the configurationfile attribute is now required as + that is from where an AnnotationConfiguration g= ets the list of classes/packages it should load. = - Thus the minimal usage is: + Thus the minimal usage is: = - + + = = -]]> -
+]]> + +
= -
- JPA based configuration (<jpaconfiguration>) +
+ JPA based configuration (<jpaconfiguration>) = - An <jpaconfiguration> is used when you want to read the - metamodel from JPA/Hibernate Annotation where you want to use the - auto-scan configuration as defined in the JPA spec (part of EJB3). = - In other words, when you do not have a hibernate.cfg.xml<= /literal>, but - instead have a setup where you use a - persistence.xml packaged in an JPA compliant - manner. + An + <jpaconfiguration> is used w= hen you want to read the metamodel from + JPA/Hibernate Annotation where you want to use the auto-scan confi= guration as defined in the + JPA spec (part of EJB3). In other words, when you do not have a + + hibernate.cfg.xml, but instead h= ave a setup where you use a + + persistence.xml packaged in an J= PA compliant manner. = - <jpaconfiguration> will - simply just try and auto-configure it self based on the available - classpath, e.g. look for META-INF/persistence.xml. - = - The persistenceunit attribute can be used= to select a specific - persistence unit. If no persistenceunit is specified it will autom= atically search for one and - if a unique one is found use it, but if multiple persistence units= are available it will error. + <jpaconfiguration> will simply just t= ry and + auto-configure it self based on the available classpath, e.g. look= for + + META-INF/persistence.xml. = - To use an <jpaconfiguration> you will need to specify - some additional jars from Hibernate EntityManager in the - <taskdef> of the hibernatetool. The following shows a full - setup: + The persistenceunit attribute can be used t= o select a specific + persistence unit. If no persistenceunit is specified it will autom= atically search for one + and if a unique one is found use it, but if multiple persistence u= nits are available it will + error. = - + To use an + <jpaconfiguration> you will = need to specify some additional jars + from Hibernate EntityManager in the + <taskdef> of the hibernate= tool. The + following shows a full setup: + + @@ -346,38 +389,41 @@ ]]> = -Note: ejb3configuration were the name used in pre= vious versions. It still = -works but will emit a warning telling you to use jpaconfiguration= instead. + = + ejb3configuration were the name used = in previous versions. It + still works but will emit a warning telling you to use jp= aconfiguration + instead. + = -
+
= -
- JDBC Configuration for reverse engineering - (<jdbcconfiguration>) +
+ JDBC Configuration for reverse engineering (<jdbcconfigura= tion>) = - A <jdbcconfiguration> is used to - perform reverse engineering of the database from a JDBC - connection. + A + <jdbcconfiguration><= /emphasis> is used to perform reverse + engineering of the database from a JDBC connection. = - This configuration works by reading the connection properties - from + This configuration works by reading the connection properties = from = - The <jdbcconfiguration> has the same - attributes as a <configuration> plus the - following additional attributes: + The + <jdbcconfiguration><= /emphasis> has the same attributes as a + + <configuration> plus the following additional attributes: = - - - + + + + = - + = - - - - + + + + = - ]]> = - - - packagename (optional): The defau= lt package name to use - when mappings for classes is created - + + + packagename (optional): The default= package name to use when + mappings for classes is created + = - - revengfile (optional): name of - reveng.xml that allows you to control various aspects of t= he + + revengfile (optional): name of reve= ng.xml that allows you to + control various aspects of the reverse engineering. + + + + reversestrategy (optional): name of= a class that implements + org.hibernate.cfg.reveng.ReverseEngineeringStra= tegy. Used for + setting up the strategy the tools will use to control the = reverse engineering, e.g. + naming of properties, which tables to include/exclude etc.= Using a class instead of + (or as addition to) a reveng.xml file gives you full progr= ammatic control of the reverse engineering. - + = - - reversestrategy (optional): name = of a - class that implements - org.hibernate.cfg.reveng.ReverseEngineeringStrate= gy. - Used for setting up the strategy the tools will use to con= trol - the reverse engineering, e.g. naming of properties, which - tables to include/exclude etc. Using a class instead of (o= r as - addition to) a reveng.xml file gives you full programmatic - control of the reverse engineering. - + + detectManytoMany (default:true): If true (the default)= tables which are pure + many-to-many link tables will be mapped as such. A pure ma= ny-to-many table is one + which primary-key contains has exactly two foreign-keys po= inting to other entity + tables and has no other columns. + + + detectOptimisticLock (efault:true): If true columns na= med VERSION or TIMESTAMP + with appropriate types will be mapped with the apropriate = optimistic locking + corresponding to <version> or + <timestamp> + + + + = - - detectManytoMany (default:true): If true (the defaul= t) tables which are pure many-to-many link tables will be mapped as such. A= pure many-to-many table is one which primary-key contains has exactly two = foreign-keys pointing to other entity tables and has no other columns. - - - detectOptimisticLock (efault:true): If true columns = named VERSION or TIMESTAMP with appropriate types will be mapped with the a= propriate optimistic locking corresponding to <version> or <timestamp> - - - +
+ Example = -
- Example + Here is an example of using + <jdbcconfiguration> to + generate Hibernate xml mappings via <hbm2hbmxml><= /literal>. The + connection settings is here read from a + hibernate.properties file but + could just as well have been read from a + hibernate.cfg.xml. = - Here is an example of using - <jdbcconfiguration> to generate Hiberna= te - xml mappings via <hbm2hbmxml>. The - connection settings is here read from a - hibernate.properties file but could just as w= ell - have been read from a hibernate.cfg.xml. - - + = ]]> -
+
= -
- Exporters +
+ Exporters = - Exporters is the parts that does the actual job of converting = the - hibernate metamodel into various artifacts, mainly code. The followi= ng - section describes the current supported set of exporters in the - Hibernate Tool distribution. It is also possible for userdefined - exporters, that is done through the - <hbmtemplate> exporter. + Exporters is the parts that does the actual job of converting th= e hibernate metamodel into + various artifacts, mainly code. The following section describes the = current supported set of + exporters in the Hibernate Tool distribution. I= t is also possible for userdefined exporters, + that is done through the + <hbmtemplate> exporter. = -
- Database schema exporter - (<literal><hbm2ddl></literal>) +
+ Database schema exporter (<hbm2ddl>) = - <hbm2ddl> lets you run schemaexport and schemaupdate w= hich - generates the appropriate SQL DDL and allow you to store the resul= t in - a file or export it directly to the database. Remember that if a - custom naming strategy is needed it is placed on the configuration - element. + + <hbm2ddl> lets you run schem= aexport and schemaupdate which generates the + appropriate SQL DDL and allow you to store the result in a file or= export it directly to the + database. Remember that if a custom naming strategy is needed it i= s placed on the + configuration element. = - - - + + + + = - + = - + = - + = - + = - + = - - - + + + = - ]]> = - - - export (default: true): Execute the generated statem= ents - against the database - + + + export (default: true): Execute the generated statemen= ts against the + database + = - - update(default: false): Try and create an update scr= ipt - representing the "delta" between what is in the database a= nd - what the mappings specify. Ignores create/update attribute= s. - (Do *not* use against production databases, no - guarantees at all that the proper delta can be generated n= or - that the underlying database can actually execute the need= ed - operations) - + + update(default: false): Try and create an update scrip= t representing the "delta" + between what is in the database and what the mappings spec= ify. Ignores create/update + attributes. (Do *not* use against production dat= abases, no guarantees at + all that the proper delta can be generated nor that the = underlying database can + actually execute the needed operations) + = - - drop (default: false): Output will contain drop - statements for the tables, indices & constraints - + + drop (default: false): Output will contain drop statem= ents for the tables, + indices & constraints + = - - create (default: true): Output will contain create - statements for the tables, indices & constraints - + + create (default: true): Output will contain create sta= tements for the tables, + indices & constraints + = - - outputfilename (Optional): If specified the statemen= ts - will be dumped to this file. - + + outputfilename (Optional): If specified the statements= will be dumped to this + file. + = - - delimiter (default: ";"): What delimter to use to - separate statements - + + delimiter (default: ";"): What delimter to use to sepa= rate statements + = - - format (default: false): Apply basic formatting to t= he - statements. - - = - - haltonerror (default: false): Halt build process if = an error occurs. - - = - - + + format (default: false): Apply basic formatting to the= statements. + = -
- Example + + haltonerror (default: false): Halt build process if an= error occurs. + = - Basic example of using <hbm2ddl>, which does not exp= ort - to the database but simply dumps the sql to a file named - sql.ddl. + + + = - +
+ Example + + Basic example of using + <hbm2ddl>, which does not = export to the database + but simply dumps the sql to a file named + sql.ddl. + + ]]> -
+
= -
- POJO java code exporter - (<literal><hbm2java></literal>) +
+ POJO java code exporter (<literal><hbm2java></literal>)= = - <hbm2java> is a java codegenerator. Options for - controlling wether JDK 5 syntax can be used and wether the POJO sh= ould - be annotated with EJB3/Hibernate Annotations. + + <hbm2java> is a java codegen= erator. Options for controlling wether JDK 5 + syntax can be used and wether the POJO should be annotated with EJ= B3/Hibernate Annotations. = - - - + + + + = - - + + = - ]]> = - - - jdk (default: false): Code will contain JDK 5 constr= ucts - such as generics and static imports - + + + jdk (default: false): Code will contain JDK 5 construc= ts such as generics and + static imports + = - - ejb3 (default: false): Code will contain EJB 3 featu= res, - e.g. using annotations from javax.persistence and - org.hibernate.annotations - - - + + ejb3 (default: false): Code will contain EJB 3 feature= s, e.g. using annotations + from javax.persistence and org.hibernate.annotations + + + + = -
- Example +
+ Example = - Basic example of using <hbm2java> to generate POJO's - that utilize jdk5 constructs. + Basic example of using + <hbm2java> to generate POJ= O's that utilize jdk5 + constructs. = - + ]]> -
+
= -
- Hibernate Mapping files exporter - (<literal><hbm2hbmxml></literal>) +
+ Hibernate Mapping files exporter (<literal><hbm2hbmxml>= </literal>) = - <hbm2hbmxml> generates a set of .hbm files. Intended t= o be - used together with a <jdbcconfiguration> when performing rev= erse - engineering, but can be used with any kind of configuration. e.g. = to - convert from annotation based pojo's to hbm.xml. Note that not eve= ry - possible mapping transformation is possible/implemented (contribut= ions - welcome) so some hand editing might be necessary. + + <hbm2hbmxml> generates a set= of .hbm files. Intended to be used together + with a + <jdbcconfiguration> when p= erforming reverse engineering, but can be + used with any kind of configuration. e.g. to convert from annotati= on based pojo's to + + hbm.xml. Note that not every pos= sible mapping transformation is possible/implemented + (contributions welcome) so some hand editing might be necessary. = - ]]> + ]]> = -
- Example +
+ Example = - Basic usage of <hbm2hbmxml> + Basic usage of + <hbm2hbmxml>. = - + ]]> = - <hbm2hbmxml> is normally used with a - <jdbcconfiguration> like in the above example, but any oth= er - configuration can also be used to convert between the different = ways - of performing mappings. Here is an example of that, using an - <annotationconfiguration>. Note: not all conversions is - implemented (contributions welcome), so some hand editing might = be - necessary. + + <hbm2hbmxml> + is normally used with a + <jdbcconfiguration> + + like in the above example, but any other configuration can also = be used to convert between + the different ways of performing mappings. Here is an example of= that, using an + + <annotationconfiguration>. + = + Not all conversions is implemented + (contributions welcome), so some hand editing might be necessary.<= /para> + = - + + -]]> -
+]]> +
+
= -
- Hibernate Configuration file exporter - (<literal><hbm2cfgxml></literal>) +
+ Hibernate Configuration file exporter (<literal><hbm2cfgxm= l></literal>) = - <hbm2cfgxml> generates a hibernate.cfg.xml. Intended t= o be - used together with a <jdbcconfiguration> when performing rev= erse - engineering, but can be used with any kind of configuration. The - <hbm2cfgxml> will contain the properties used and adds mappi= ng - entries for each mapped class. + + <hbm2cfgxml> generates a + hibernate.cfg.xml. Intended to b= e used together + with a + <jdbcconfiguration> when p= erforming reverse engineering, but can be + used with any kind of configuration. The + <hbm2cfgxml> will contain = the + properties used and adds mapping entries for each mapped class. = - - - - + + + + + = - ]]> = - - - ejb3 (default: false): the generated cfg.xml will ha= ve - <mapping class=3D".."/>, opposed to <mapping - resource=3D"..."/> for each mapping. - - - -
+ + + ejb3 (default: false): the generated cfg.xml will have= <mapping + class=3D".."/>, opposed to <mapping resource=3D"..."= /> for each + mapping. + + + + +
= -
- Documentation exporter - (<literal><hbm2doc></literal>) +
+ Documentation exporter (<literal><hbm2doc></literal>)</= title> = - <para><hbm2doc> generates html documentation a'la javadoc for - the database schema et.al.</para> + <para><emphasis> + <property><hbm2doc></property></emphasis> generates html doc= umentation a'la javadoc for the database + schema et.al.</para> = - <programlisting><![CDATA[<hbm2doc/>]]></programlisting> - </section> + <programlisting><![CDATA[<hbm2doc/>]]></programlisting> + </section> = - <section> - <title>Query exporter (<query>) +
+ Query exporter (<query>) = - <query> is used to execute a HQL query statements and - optionally send the output to a file. Can be used for verifying the - mappings and for basic data extraction. + + <query> is used to execute a= HQL query statements and optionally send the + output to a file. Can be used for verifying the mappings and for b= asic data extraction. = - [a HQL query string] ]]> = - Currently one session is opened and used for all queries and= the - query is executed via the list() method. In the future more options - might become available, like performing executeUpdate(), use named - queries etc. + Currently one session is opened and used for all queries and t= he query is executed via + the list() method. In the future more options might become availab= le, like performing + executeUpdate(), use named queries etc. = - + = -
- Examples +
+ Examples = - Simplest usage of <query> will just execute the query - without dumping to a file. This can be used to verify that queri= es - can actually be performed. + Simplest usage of + <query> will just execute = the query without dumping to + a file. This can be used to verify that queries can actually be = performed. = - + from java.lang.Object ]]> = - Multiple queries can be executed by nested <hql> - elements. In this example we also let the output be dumped to - queryresult.txt. Note that currently the dump= is - simply a call to toString on each element. + Multiple queries can be executed by nested + <hql> elements. In this + example we also let the output be dumped to + queryresult.txt. + = + + Currently the dump is simply a call to toString on each element.= + = - + + select c.name from Customer c where c.age > 42 from Cat -]]> -
+]]> +
+
= -
- Generic Hibernate metamodel exporter (<literal><hbmtempl= ate></literal>) +
+ Generic Hibernate metamodel exporter (<literal><hbmtemplat= e></literal>) = - Generic exporter that can be controlled by a user provided - template or class. + Generic exporter that can be controlled by a user provided tem= plate or class. = - ]]> = - NOTICE: Previous versions of the tools used Velocity. We are= now - using Freemarker which provides us much better exception and error - handling. + Previous versions of the tools used Velocity. We are now= using Freemarker which + provides us much better exception and error handling. + = -
- Exporter via - <literal><hbmtemplate></literal> +
+ Exporter via <literal><hbmtemplate></literal> = - The following is an example of reverse engineering via - <jdbcconfiguration> and use a custom - Exporter via the <hbmtemplate>. + The following is an example of reverse engineering via + + <jdbcconfiguration> and = use a custom Exporter via the + + <hbmtemplate>. = - + + = @@ -759,64 +828,74 @@ filepattern=3D"."/> = -]]> -
+]]> +
+
= -
- Using properties to configure Exporters +
+ Using properties to configure Exporters = - Exporters can be controlled by user properties. The user - properties is specificed via <property> or - <propertyset> and each exporter will have - access to them directly in the templates and via - Exporter.setProperties(). + Exporters can be controlled by user properties. The user propert= ies is specificed via + + <property> or + + <propertyset> and each exporter will have access to them + directly in the templates and via Exporter.setProperties()<= /literal>. = -
- <literal><property></literal> and + <section> + <title><literal><property></literal> and <literal><propertyset></literal> = - The <property> allows you bind a string value to a key. - The value will be available in the templates via $<key>. The - following example will assign the string value "true" to the varia= ble - $descriptors + The + <property> allows you bind a= string value to a key. The value will be + available in the templates via $<key>. The following example= will assign the + string value + "true" to the variable= $descriptors = - ]]> + ]]> = - Most times using <property> is enou= gh - for specifying the properties needed for the exporters. Still the = ant - tools supports the notion of <propertyset>. - The functionallity of <propertyset> is - explained in detail in the Ant task manual. -
+ Most times using + <property> is enough for specifying + the properties needed for the exporters. Still the ant tools suppo= rts the notion of + + <propertyset>. The functionallity of + + <propertyset> is explained in detail in the Ant task + manual. +
= -
- Getting access to user specific classes +
+ Getting access to user specific classes = - If the templates need to access some user class it is possib= le - by specifying a "toolclass" in the properties. + If the templates need to access some user class it is possible= by specifying a + + "toolclass" in the pro= perties. = - + ]]> = - Placing the above <property> tag in - <hibernatetool> or inside any exporter wi= ll - automatically create an instance of - x.y.z.NameOfToolClass and it will be available = in - the templates as $sometool. This is usefull to - delegate logic and code generation to java code instead of placing - such logic in the templates. + Placing the above + <property> tag in + + <hibernatetool> or inside any exporter will automatically + create an instance of x.y.z.NameOfToolClass and= it will be available in + the templates as $sometool. This is usefull to = delegate logic and code + generation to java code instead of placing such logic in the templ= ates. = -
- Example +
+ Example = - Here is an example that uses <hbmtemplate> together = with - <property> which will be available to the templates/export= er. - Note: This example actually simulates what <hbm2java> actu= ally - does. + Here is an example that uses + <hbmtemplate> together with + + <property> which will be= available to the templates/exporter. + This + example actually simulates what <hbm2java> actually does.<= /para> + = - + ]]> -
+
Modified: trunk/hibernatetools/docs/reference/en/modules/codegen.xml =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/hibernatetools/docs/reference/en/modules/codegen.xml 2007-11-29 1= 2:41:06 UTC (rev 5147) +++ trunk/hibernatetools/docs/reference/en/modules/codegen.xml 2007-11-29 1= 3:48:54 UTC (rev 5148) @@ -2,7 +2,8 @@ Controlling POJO code generation = - When using <hbm2java> or the eclipse plugin to generate POJO + When using + <hbm2java> or the eclipse plugin= to generate POJO java code you have the possibility to control certain aspects of the code generation. This is primarily done through the <meta> tag in the mapping files. The following section describes the possible meta tags and @@ -11,17 +12,22 @@
The <literal><meta></literal> attribute = - The <meta> tag is a simple way of - annotating the hbm.xml with information, so tools h= ave + The + <meta> tag is a simple way of + annotating the + hbm.xml with information, so tools= have a natural place to store/read information that is not directly related= to the Hibernate core. = - You can use the <meta> tag to e.g. tell - hbm2java to only generate "protected" setters, have + You can use the + <meta> tag to e.g. tell + hbm2java to only generate + "protected" setters, have classes always implement a certain set of interfaces or even have them extend a certain base class and even more. = - The following example shows how to use various <meta> + The following example shows how to use various + <meta> attributes and the resulting java code. = <class name=3D"Person"> @@ -39,7 +45,8 @@ </property> </class> = - The above hbm.xml will produce something like the following (code + The above + hbm.xml will produce something like = the following (code shortened for better understanding). Notice the Javadoc comment and the protected set methods: = @@ -219,37 +226,50 @@ = - Attributes declared via the <meta> tag = are - per default "inherited" inside an hbm.xml file. + Attributes declared via the + <meta> tag are + per default + "inherited" inside an + hbm.xml file. = What does that mean? It means that if you e.g want to have all y= our classes implement IAuditable then you just add an - <meta - attribute=3D"implements">IAuditable</meta> in the t= op of - the hbm.xml file, just after - <hibernate-mapping>. Now all classes defined = in - that hbm.xml file will implement + + <meta + attribute=3D"implements">IAuditable</meta> in the = top of + the + hbm.xml file, just after + + <hibernate-mapping>. Now all= classes defined in + that + hbm.xml file will implement IAuditable! = - Note: This applies to all + This applies to all <meta>-tags. Thus it can also e.g. be used to specify that all fields should be declare protected, instead of the default private. This is done by adding <meta attribute=3D"scope-field">protected</meta> at e.g. = just under the <class> tag and all fields of that class will be protected. + = - To avoid having a <meta>-tag inherited = then - you can simply specify inherit=3D"false" for the - attribute, e.g. <meta attribute=3D"scope-class" - inherit=3D"false">public abstract</meta> will restr= ict - the "class-scope" to the current class, not the subclasses. + To avoid having a + <meta> tag inherited then + you can simply specify + inherit =3D "false" for the + attribute, e.g. + <meta attribute =3D "scope-class" + inherit =3D "false">public abstract</meta> will r= estrict + the + "class-scope" to the cu= rrent class, not the subclasses. =
Recomendations = The following are some good practices when using - <meta> attributes. + + <meta> attributes. =
Dangers of a class level <literal>use-in-string and @@ -268,7 +288,8 @@ </class> </hibernate-mapping></programlisting> = - <para>and for <literal>Event.hbm</literal> file:</para> + <para>and for <emphasis> + <property>Event.hbm</property></emphasis> file:</para> = <programlisting><hibernate-mapping> = <class name=3D"events.Event" table=3D"EVENTS"> @@ -286,7 +307,8 @@ </class> </hibernate-mapping></programlisting> = - <para>Then <literal><hbm2java></literal> will assume you wan= t to + <para>Then <emphasis> + <property><hbm2java></property></emphasis> will assume you= want to include all properties and collections in the <literal>toString()/equals()</literal> methods and this can result= in infinite recursive calls.</para> @@ -358,11 +380,13 @@ = <para>Therefore automatically configuration the generation of <literal>equals()/hashCode()</literal> methods specifying at class - scope level the <literal><meta></literal> attribute + scope level the <emphasis> + <property><meta></property></emphasis> attribute <literal>use-in-equals</literal> could be a dangerous decision that could produce non expected side-effect.</para> = - <para>See http://www.hibernate.org/109.html for an more in-depth + <para><ulink + url=3D"http://www.hibernate.org/109.html">Here</ulink> you can = get more in-depth explanation on the subject of equals() and hashcode().</para> </section> </section> @@ -373,7 +397,7 @@ = <para>This section shows an example for using meta attributes (inclu= ding userspecific attributes) together with the code generation features = in - Hibernate Tools.</para> + <property>Hibernate Tools</property>.</para> = <para>The usecase being implemented is to automatically insert some = pre- and post-conditions into the getter and setters of the generated POJ= O. @@ -382,24 +406,32 @@ <section> <title>Generate pre/post-conditions for methods = - With an <meta attribute=3D"class-code">, + With an + <meta attribute=3D"class-code">, you can add addional methods on a given class, nevertheless such - <meta> attribute can not be used at prope= rty - scope level and Hibernatetools does not provide such - <meta> attributes. + + <meta> attribute can not= be used at property + scope level and Hibernate Tools does not prov= ide such + + <meta> attributes. = A possibly solution for this is to modify the freemarker templates responsable for generating the POJO's. If you look inside - hibernate-tools.jar, you can find the template: - pojo/PojoPropertyAccessor.ftl + + hibernate-tools.jar, you can f= ind the template: + + pojo/PojoPropertyAccessor.ftl<= /para> = This file is as the named indicates used to generate property accessors for pojo's. = - Extract the PojoPropertyAccessor.ftl into= a - local folder i.e. ${hbm.template.path}, respect= ing + Extract the + PojoPropertyAccessor.ftl into a + local folder i.e. + ${hbm.template.path}, respecti= ng the whole path, for example: - ${hbm.template.path}/pojo/PojoPropertyAccessor.ftl + + ${hbm.template.path}/pojo/PojoPropertyAccessor.ftl = The contents of the file is something like this: = @@ -434,8 +466,10 @@ </#foreach> = - Now if in any *hbm.xml file we define the - <meta> attributes: + Now if in any + *hbm.xml file we define the + + <meta> attributes: pre-cond or post-cond, their contents will be generated into the body of the relevant set method. @@ -443,7 +477,8 @@ As an examlpe let us add a pre-condition for property name preventing no Person can have an empty name. So we have to modify the - Person.hbm.xml file like this: + + Person.hbm.xml file like this:= = <hibernate-mapping> <class name=3D"Person"> @@ -460,16 +495,19 @@ </class> </hibernate-mapping> = - Notes: i) If you don't use <[[CDATA[]]> - you have to scape the & symbol, i.e.: &amp; ii). Note that= we + i) If you don'' use <[[CDATA[]]> + you have to scape the & symbol, i.e.: &amp; + ii). Note that we are referring to "firstName" directly and this is the parameter na= me not the actual field name. If you want to refer the field you have= to use "this.firstName" instead. + = - Finally we have to generate the Person.java + Finally we have to generate the Person.java class, for this we can use both Eclipse and Ant as long as you remember to set or fill in the templatepath setting. For Ant we - configure <hibernatetool> task via + configure + <hibernatetool> task via the templatepath attribute as in: = @@ -491,9 +529,11 @@ </hibernatetool> </target> = - Invoking the target <hbm2java> will - generate on the ${hbm2java.dest.dir} the file: - Person.java: + Invoking the target + <hbm2java> will + generate on the + ${hbm2java.dest.dir} the file: + Person.java: = // default package import java.io.Serializable; Modified: trunk/hibernatetools/docs/reference/en/modules/codegenarchitectur= e.xml =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/hibernatetools/docs/reference/en/modules/codegenarchitecture.xml = 2007-11-29 12:41:06 UTC (rev 5147) +++ trunk/hibernatetools/docs/reference/en/modules/codegenarchitecture.xml = 2007-11-29 13:48:54 UTC (rev 5148) @@ -2,95 +2,112 @@ Code generation architecture = - The code generation mechanism in the Hibernate Tools consists of a= few - core concepts. This section explains their overall structure which are t= he - same for the Ant and Eclipse tools. + The code generation mechanism in the Hibernate Tools consists of a few + core concepts. This section explains their overall structure which are= the same for the Ant and + Eclipse tools. =
Hibernate Meta Model = - The meta model is the model used by Hibernate core to perform its - object relational mapping. The model includes information about tables, - columns, classes, properties, components, values, collections etc. The= API - is in org.hibernate.mapping and its main entry poin= t is - the Configuration class, the same class that is use= d to - build a session factory. + The meta model is the model used by Hibernate Core to perform it= s object relational + mapping. The model includes information about tables, columns, class= es, properties, + components, values, collections etc. The API is in org.hibe= rnate.mapping + and its main entry point is the Configuration cla= ss, the same class that is + used to build a session factory. = - The model represented by the Configuration cl= ass - can be build in many ways. The following list the currently supported = ones - in Hibernate Tools. + The model represented by the Configuration cl= ass can be build in many + ways. The following list the currently supported ones in H= ibernate Tools. = - + + - A Core configuration uses Hibernate C= ore - and supports reading hbm.xml files, requires a hibernate.cfg.xml. - Named core in Eclipse and <configuration> - in ant. + A + Core configuration + uses Hibernate Core and supports reading + hbm.xml + files, requires a + hibernate.cfg.xml + . Named core in Eclipse and + <configuration> + in ant. = - A Annotation configuration uses Hiber= nate - Annotations and supports hbm.xml and annotated classes, requires= a - hibernate.cfg.xml. Named annotations in Eclipse and - <annotationconfiguration> in ant. + A + Annotation configuration + uses Hibernate Annotations and supports + hbm.xml + and annotated classes, requires a + hibernate.cfg.xml + . Named annotations in Eclipse and + + <annotationconfiguration>= in ant. = - A JPA configuration uses a Hibernate - EntityManager and supports hbm.xml and annotated classes requires - that the project has a META-INF/persistence.xml in its classpath. - Named JPA in Eclipse and <jpaconfiguration> - in ant. + A + JPA configuration + uses a Hibernate EntityManager and supports + hbm.xml + and annotated classes requires that the project ha= s a + META-INF/persistence.xml + in its classpath. Named JPA in Eclipse and + + <jpaconfiguration> in ant. = - A JDBC configuration uses Hibernate T= ools - reverse engineering and reads its mappings via JDBC metadata + - additional reverse engineering files (reveng.xml). Automatically - used in Eclipse when doing reverse engineering from JDBC and nam= ed - <jdbcconfiguration> in ant. + A + JDBC configuration + uses Hibernate Tools reverse = engineering and reads its + mappings via JDBC metadata + additional reverse engineering fi= les (reveng.xml). + Automatically used in Eclipse when doing reverse engineering f= rom JDBC and named + + <jdbcconfiguration> in ant. - + + = - In most projects you will normally use only one of the Core, - Annotation or JPA configuration and possibly the JDBC configuration if= you - are using the reverse engineering facilities of Hibernate Tools. The - important thing to note is that no matter which Hibnerate Configuration - type you are using Hibernate Tools supports them. + In most projects you will normally use only one of the Core, Ann= otation or JPA + configuration and possibly the JDBC configuration if you are using t= he reverse engineering + facilities of Hibernate Tools. The important th= ing to note is that no matter which Hibnerate + Configuration type you are using Hibernate Tools supports them. = The following drawing illustrates the core concepts: = - + +
+ Hibernate Core Concepts + - + = - + = + - + +
+
= - The code generation is done based on the Configuration model no - matter which type of configuration have been used to create the meta - model, and thus the code generation is independent on the source of the - meta model and represented via Exporters. + The code generation is done based on the Configuration model no = matter which type of + configuration have been used to create the meta model, and thus the = code generation is + independent on the source of the meta model and represented via Expo= rters.
=
Exporters = - Code generation is done in so called Exporters. An - Exporter is handed a Hibernate Meta Model represent= ed - as a Configuration instance and it is then the job = of - the exporter to generate a set of code artifacts. + Code generation is done in so called Exporters. An Expo= rter is handed a + Hibernate Meta Model represented as a Configuration instance and it is then + the job of the exporter to generate a set of code artifacts. = - The tools provides a default set of Exporter's which can be used= in - both Ant and the Eclipse UI. Documentation for these Exporters is in t= he - Ant and Eclipse sections. + The tools provides a default set of Exporter's which can be used= in both Ant and the + Eclipse UI. Documentation for these Exporters is in the Ant and Ecli= pse sections. = - Users can provide their own customer Exporter's, either by custom - classes implementing the Exporter interface or simply be providing cus= tom - templates. This is documented at + Users can provide their own customer Exporter's, either by custo= m classes implementing the + Exporter interface or simply be providing custom templates. This is = documented at
-
\ No newline at end of file + Modified: trunk/hibernatetools/docs/reference/en/modules/plugins.xml =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/hibernatetools/docs/reference/en/modules/plugins.xml 2007-11-29 1= 2:41:06 UTC (rev 5147) +++ trunk/hibernatetools/docs/reference/en/modules/plugins.xml 2007-11-29 1= 3:48:54 UTC (rev 5148) @@ -5,547 +5,690 @@
Introduction = - + = - The following features are available in the Hibernate Tools Ecli= pse - plugins: + The following features are available in the Hibernate = Tools Eclipse + plugins: = - Mapping Editor: An editor for - Hibernate XML mapping files, supporting auto-completion and syntax - highlighting. It also supports semantic auto-completion for class names - and property/field names, making it much more versatile than a normal = XML - editor. + Mapping Editor: An editor for= Hibernate XML mapping + files, supporting auto-completion and syntax highlighting. It also s= upports semantic + auto-completion for class names and property/field names, making it = much more versatile than a + normal XML editor. = - Hibernate Console: The consol= e is a - new perspective in Eclipse. It provides an overview of your Hibernate - Console configurations, were you also can get an interactive view of y= our - persistent classes and their relationships. The console allows you to - execute HQL queries against your database and browse the result direct= ly - in Eclipse. + Hibernate Console: The consol= e is a new perspective in + Eclipse. It provides an overview of your Hibernate Console configura= tions, were you also can + get an interactive view of your persistent classes and their relatio= nships. The console allows + you to execute HQL queries against your database and browse the resu= lt directly in Eclipse. = - Configuration Wizards and Code - generation: A set of wizards are provided with the Hibernate - Eclipse tools; you can use a wizard to quickly generate common Hiberna= te - configuration (cfg.xml) files, and from these you can code generate a - series of various artifacts, there is even support for completely reve= rse - engineer an existing database schema and use the code generation to - generate POJO source files and Hibernate mapping files. + Configuration Wizards and Code generatio= n: A set of + wizards are provided with the Hibernate Eclipse tools; you can use a= wizard to quickly + generate common Hibernate configuration (cfg.xml) files, and from th= ese you can code generate + a series of various artifacts, there is even support for completely = reverse engineer an + existing database schema and use the code generation to generate POJ= O source files and + Hibernate mapping files. = - Eclipse JDT integration: Hibe= rnate - Tools integrates into the Java code completion and build support of Ja= va - in Eclipse. This gives you codecompletion of HQL inside Java code plus - Hibernate Tools will add problem markers if your queries are not valid - against the console configuration associated with the project. + Eclipse JDT integration: Hibe= rnate Tools integrates into + the Java code completion and build support of Java in Eclipse. This = gives you codecompletion + of HQL inside Java code plus Hibernate Tools wi= ll add problem markers if + your queries are not valid against the console configuration associa= ted with the project. = Please note that these tools do not try to hide any functionalit= y of - Hibernate. The tools make working with Hibernate easier, but you are s= till - encouraged/required to read the documentation for Hibernate to fully - utilize Hibernate Tools and especially Hibernate it self. + Hibernate. The tools make working with Hibernate + easier, but you are still encouraged/required to read the documentat= ion for Hibernate to fully + utilize Hibernate Tools and especially Hibernate it + self.
=
Creating a Hibernate configuration file = - To be able to reverse engineer, prototype queries, and of course= to - simply use Hibernate Core a hibernate.properties or hibernate.cfg.xml = file - is needed. The Hibernate Tools provide a wizard for generating the - hibernate.cfg.xml file if you do not already have such file. + To be able to reverse engineer, prototype queries, and of course= to simply use + Hibernate Core a + hibernate.properties + or + hibernate.cfg.xml + file is needed. The Hibernate Tools= provide a wizard for + generating the + hibernate.cfg.xml + file if you do not already have such file. = - Start the wizard by clicking "New Wizard" (Ctrl+N), select the - Hibernate/Hibernate Configuration file (cfg.xml) wizard and press "Nex= t". - After selecting the wanted location for the hibernate.cfg.xml file, you - will see the following page: + Start the wizard by clicking + New Wizard + (Ctrl+N), select the Hibernate/Hibernate Configuration f= ile (cfg.xml) wizard and + press + Next + . After selecting the wanted location for the + hibernate.cfg.xml + file, you will see the following page: = - - - - +
+ Hibernate Configuration File Wizard + + + + = - - - - + + + + +
= - Tip: The contents in the combo boxes for the JDBC driver class a= nd - JDBC URL change automatically, depending on the Dialect and actual dri= ver - you have chosen. + + The contents in the combo boxes for the JDBC driver class and = JDBC URL change + automatically, depending on the Dialect and actual driver you have= chosen. + = - Enter your configuration information in this dialog. Details abo= ut - the configuration options can be found in Hibernate reference - documentation. + Enter your configuration information in this dialog. Details abo= ut the configuration + options can be found in Hibernate reference doc= umentation. = - Press "Finish" to create the configuration file, after optionally - creating a Console onfiguration, the hibernate.cfg.xml will be - automatically opened in an editor. The last option "Create Console - Configuration" is enabled by default and when enabled i will automatic= ally - use the hibernate.cfg.xml for the basis of a "Console - Configuration" + Press + Finish + to create the configuration file, after optionally creat= ing a Console + onfiguration, the + hibernate.cfg.xml + will be automatically opened in an editor. The last opti= on + Create Console Configuration + is enabled by default and when enabled i will automatica= lly use the + hibernate.cfg.xml + for the basis of a Console Configuration.
=
Creating a Hibernate Console configuration = - A Console Configuration describes to the Hibernate plugin how it - should configure Hibernate and what configuration files, including whi= ch - classpath is needed to load the POJO's, JDBC drivers etc. It is requir= ed - to make usage of query prototyping, reverse engineering and code - generation. You can have multiple named console configurations. Normal= ly - you would just need one per project, but more is definitly - possible. + A Console Configuration describes to the Hibernate plugin how it + should configure Hibernate and what configurati= on files, including which + classpath is needed to load the POJO's, JDBC drivers etc. It is requ= ired to make usage of + query prototyping, reverse engineering and code generation. You can = have multiple named + console configurations. Normally you would just need one per project= , but more is definitly + possible. = - You create a console configuration by running the Console - Configuration wizard, shown in the following screenshot. The same wiza= rd - will also be used if you are coming from the hibernate.cfg.xml wizard = and - had enabled "Create Console Configuration". + You create a console configuration by running the Console Config= uration wizard, shown in + the following screenshot. The same wizard will also be used if you a= re coming from the + hibernate.cfg.xml + wizard and had enabled + Create Console Configuration + . = - Tip: the wizard will look at the current selection in the IDE and - try and auto-detect the settings which you then can just approve or mo= dify - to suit your needs. + + The wizard will look at the current selection in the IDE and t= ry and auto-detect the + settings which you then can just approve or modify to suit your ne= eds. + + = - +
+ Creating Hibernate Console Configuration + + + + = - - - - + + + + = - - - +
= - Creating a Hibernate Console configuration - + The dialog consists of three tabs, + General + for the basic/required settings, + Classpath + for classpath and + Mappings + for additional mappings. The two latter ones is normally= not required if you + specify a project and it has + + /hibernate.cfg.xml + + or + + /META-INF/persistence.xml + + in its project classpath. = - The dialog consists of three tabs, "General" for the basic/requi= red - settings, "Classpath" for classpath and "Mappings" for additional - mappings. The two latter ones is normally not required if you specify a - project and it has /hibernate.cfg.xml or - /META-INF/persistence.xml in its project - classpath. + The following table describes the available settings. The wizard= can automatically detect + default values for most of these if you started the Wizard with the = relevant java project or + resource selected = - The following table describes the available settings. The wizard= can - automatically detect default values for most of these if you started t= he - Wizard with the relevant java project or resource selected - Hibernate Console Configuration Parameters = - + = - + = - + = - Parameter + + Parameter + = - Description + + Description + = - Auto detected value + + Auto detected value + = - Name + + Name + = - The unique name of the console - configuration + + The unique name of the console configuration + = - Name of the selected project + + Name of the selected project + = - Project + + Project + = - The name of a java project which classpath should be us= ed - in the console configuration + + The name of a java project which classpath should be u= sed in the console + configuration + = - Name of the selected project + + Name of the selected project + = - Type + + Type + = - Choose between "Core", "Annotations" and "JPA". Note th= at - the two latter requires running Eclipse IDE with a JDK 5 runti= me, - otherwise you will get classloading and/or version errors. + + Choose between "Core", "Annotations&quo= t; and + "JPA". Note that the two latter requires running= Eclipse IDE with + a JDK 5 runtime, otherwise you will get classloading and/o= r version errors. + = - No default value + + No default value + = - Property file + + Property file + = - Path to a hibernate.properties file + + Path to a hibernate.properties file + = - First hibernate.properties file found in the sele= cted - project + + First hibernate.properties file found in the selected = project + = - Configuration file + + Configuration file + = - Path to a hibernate.cfg.xml file + + Path to a hibernate.cfg.xml file + = - First hibernate.cfg.xml file found in the selected - project + + First hibernate.cfg.xml file found in the selected pro= ject + = - Persistence unit + + Persistence unit + = - Name of the persistence unit to use + + Name of the persistence unit to use + = - No default value (lets Hibernate Entity Manager find the - persistence unit) + + No default value (lets Hibernate Entity Manager find t= he persistence + unit) + = - Naming strategy + + Naming strategy + = - Fully qualified classname of a custom NamingStrategy. O= nly - required if you use a special naming strategy. + + Fully qualified classname of a custom NamingStrategy. = Only required if you use a + special naming strategy. + = - No default value + + No default value + = - Entity resolver + + Entity resolver + = - Fully qualified classname of a custom EntityResol= ver. - Only required if you have special xml entity includes in your - mapping files. + + Fully qualified classname of a custom EntityResolver. = Only required if you have + special xml entity includes in your mapping files. + = - No default value + + No default value +
= - - - - +
+ Specifying Classpath in Hibernate Console Configuration</titl= e> + <mediaobject> + <imageobject role=3D"fo"> + <imagedata align=3D"center" fileref=3D"images/consolecfgclasspat= h.png" format=3D"PNG"/> + </imageobject> = - <imageobject role=3D"html"> - <imagedata align=3D"center" - fileref=3D"images/consolecfgclasspath.png" - format=3D"PNG" /> - </imageobject> + <imageobject role=3D"html"> + <imagedata align=3D"center" fileref=3D"images/consolecfgclasspat= h.png" format=3D"PNG"/> + </imageobject> = - <caption>Specifying classpath in a Hibernate Console - configuration</caption> - </mediaobject> + </mediaobject> + </figure> = - <para><table> + <para> + <table> <title>Hibernate Console Configuration Classpath = - + = - + = - + = - Parameter + + Parameter + = - Description + + Description + = - Auto detected value + + Auto detected value + = - Classpath + + Classpath + = - The classpath for loading POJO and JDBC drivers; - only needed if the default classpath of the Project does not - contain the required classes. Do not add Hibernate core - libraries or dependencies, they are already included. If you= get - ClassNotFound errors then check this list for possible missi= ng - or redundant directories/jars. + + The classpath for loading POJO and JDBC drivers; onl= y needed if the default + classpath of the Project does not contain the required c= lasses. Do not add + Hibernate core libraries or dependencies, they are alrea= dy included. If you get + ClassNotFound errors then check this list for possible m= issing or redundant + directories/jars. + = - empty + + empty + = - Include default classpath from - project + + Include default classpath from project + = - When enabled the project classpath will be appe= nded - to the classpath specified above. + + When enabled the project classpath will be appended = to the classpath specified + above. + = - Enabled + + Enabled + - + + = - - - - + +
+ Specifying additional Mappings in Hibernate Console Configu= ration + + + + = - - - + + + + +
= - Specifying additional mappings in a Hibernate console - configuration -
+ +
Hibernate Console Configuration Mappings = - + = - + = - + = - Parameter + + Parameter + = - Description + + Description + = - Auto detected value + + Auto detected value + = - Mapping files + + Mapping files + = - List of additional mapping files that should be - loaded. Note: A hibernate.cfg.xml or persistence.xml can also - contain mappings. Thus if these are duplicated here, you will - get "Duplicate mapping" errors when using the console - configuration. + + List of additional mapping files that should be load= ed. Note: A + hibernate.cfg.xml or persistence.xml can also contain ma= ppings. Thus if these are + duplicated here, you will get "Duplicate mapping" errors= when using the console + configuration. + = - empty + + empty + -
+ + = - Clicking "Finish" creates the configuration and shows it in the - "Hibernate Configurations" view + Clicking + Finish + creates the configuration and shows it in the + Hibernate Configurations + view = - - - - +
+ Console Overview + + + + = - - - + + + = - Console overview - + +
+
=
Reverse engineering and code generation = - A "click-and-generate" reverse engineering and code generation - facility is available. This facility allows you to generate a range of - artifacts based on database or an already existing Hibernate - configuration, be that mapping files or annotated classes. Some of the= se - are POJO Java source file, Hibernate *.hbm.xml, hibernate.cfg.xml - generation and schema documentation. + A "click-and-generate" reverse engineering and code generation f= acility is available. This + facility allows you to generate a range of artifacts based on databa= se or an already existing + Hibernate configuration, be that mapping files or annotated classes.= Some of these are POJO + Java source file, Hibernate + *.hbm.xml, + hibernate.cfg.xml generation and= schema documentation. = - To start working with this process, start the "Hibernate Code - Generation" which is available in the toolbar via the Hibernate icon or - via the "Run/Hibernate Code Generation" menu item. + To start working with this process, start the Hibernat= e Code + Generation which is available in the toolbar via the Hibernate + icon or via the + Run > Hibernate Code Generation + menu item. =
Code Generation Launcher = - When you click on "Hibernate Code Generation" the standard Ecl= ipse - launcher dialog will appear. In this dialog you can create, edit and - delete named Hibernate code generation "launchers". + When you click on + Hibernate Code Generation... + the standard Eclipse launcher dialog will appear. In t= his dialog you can create, + edit and delete named Hibernate code generation "launchers". = - - - - +
+ Getting Hibernate Code Generation Wizard + + + + = - - - - + + + + +
= - + = - - - - +
+ Hibernate Code Generation Wizard + + + + = - - - - + + + + +
= - The first time you create a code generation launcher you should - give it a meaningfull name, otherwise the default prefix - "New_Generation" will be used. + The first time you create a code generation launcher you shoul= d give it a meaningfull + name, otherwise the default prefix + New_Generation + will be used. = - Note: The "At least one exporter option must be selected" is j= ust - a warning stating that for this launch to work you need to select an - exporter on the Exporter tab. When an exporter has been selected the - warning will disappear. + + The "At least one exporter option must be selected"= ; is just a + warning stating that for this launch to work you need to select = an exporter on the + Exporter tab. When an exporter has been selected the warning wil= l disappear. + = - The dialog also have the standard tabs "Refresh" and "Common" = that - can be used to configure which directories should be automatically - refreshed and various general settings launchers, such as saving the= m in - a project for sharing the launcher within a team. + The dialog also have the standard tabs + Refresh + and + Common + that can be used to configure which directories should= be automatically + refreshed and various general settings launchers, such as saving t= hem in a project for + sharing the launcher within a team. = - On the "Main" tab you see the following fields: + On the + Main + tab you see the following fields: = Code generation "Main" tab fields = - + = - + = - + = - Field + + Field + = - Description + + Description + = - Console Configuration + + Console Configuration + = - The name of the console configuration which sho= uld - be used when code generating. + + The name of the console configuration which should b= e used when code + generating. + = - Output directory + + Output directory + = - Path to a directory into where all output will = be - written by default. Be aware that existing files will be - overwritten, so be sure to specify the correct - directory. + + Path to a directory into where all output will be wr= itten by default. Be aware + that existing files will be overwritten, so be sure to s= pecify the correct + directory. + = - Reverse engineer from JDBC - Connection + + Reverse engineer from JDBC Connection + = - If enabled the tools will reverse engineer the - database available via the connection information in the - selected Hibernate Console Configuration and generate code b= ased - on the database schema. If not enabled the code generation w= ill - just be based on the mappings already specified in the Hiber= nate - Console configuration. + + If enabled the tools will reverse engineer the datab= ase available via the + connection information in the selected Hibernate Console= Configuration and + generate code based on the database schema. If not enabl= ed the code generation + will just be based on the mappings already specified in = the Hibernate Console + configuration. + = - Package + + Package + = - The package name here is used as the default - package name for any entities found when reverse - engineering. + + The package name here is used as the default package= name for any entities + found when reverse engineering. + = - reveng.xml + + reveng.xml + = - Path to a reveng.xml file. A reveng.xml file al= lows - you to control certain aspects of the reverse engineering. e= .g. - how jdbc types are mapped to hibernate types and especially - important which tables are included/excluded from the proces= s. - Clicking "setup" allows you to select an existing reveng.xml - file or create a new one. See more details about the reveng.= xml - file in . + + Path to a reveng.xml file. A reveng.xml file allows = you to control certain + aspects of the reverse engineering. e.g. how jdbc types = are mapped to hibernate + types and especially important which tables are included= /excluded from the + process. Clicking "setup" allows you to select an existi= ng reveng.xml file or + create a new one. See more details about the reveng.xml = file in . + = - reveng. strategy + + reveng. strategy + = - If reveng.xml does not provide enough customiza= tion - you can provide your own implementation of an - ReverseEngineeringStrategy. The class need to be in the clas= path - of the Console Configuration, otherwise you will get class n= ot - found exceptions. See - for details and an example of a custom strategy. + + If reveng.xml does not provide enough customization = you can provide your own + implementation of an ReverseEngineeringStrategy. The cla= ss need to be in the + claspath of the Console Configuration, otherwise you wil= l get class not found + exceptions. See for details and an + example of a custom strategy. + = - Generate basic typed composite ids + + Generate basic typed composite ids + = - A table that has a multi-colum primary key a - <composite-id> mapping will always be created. If this - option is enabled and there are matching foreign-keys each k= ey - column is still considered a 'basic' scalar (string, long, e= tc.) - instead of a reference to an entity. If you disable this opt= ion - a <key-many-to-one> instead. Note: a <many-to-one&g= t; - property is still created, but is simply marked as non-updat= able - and non-insertable. + + A table that has a multi-colum primary key a <com= posite-id> + mapping will always be created. If this option is enable= d and there are matching + foreign-keys each key column is still considered a 'basi= c' scalar (string, long, + etc.) instead of a reference to an entity. If you disabl= e this option a + <key-many-to-one> instead. Note: a <many-to-one= > + property is still created, but is simply marked as non-u= pdatable and + non-insertable. + = Detect optimistic lock columns = - Automatically detect optimistic lock columns. - Controllable via reveng. strategy; the current default is to= use - columns named VERSION or TIMESTAMP. + Automatically detect optimistic lock columns. Control= lable via reveng. + strategy; the current default is to use columns named VERS= ION or TIMESTAMP. = Detect many-to-many tables = - Automatically detect many-to-many tables. Controllable - via reveng. strategy. + Automatically detect many-to-many tables. Controllabl= e via reveng. + strategy. = - Use custom templates + + Use custom templates + = - If enabled, the Template directory will be sear= ched - first when looking up the templates, allowing you to redefine - how the individual templates process the hibernate mapping - model. + + If enabled, the Template directory will be searched = first when looking up the + templates, allowing you to redefine how the individual t= emplates process the + hibernate mapping model. + = - Template directory + + Template directory + = - A path to a directory with custom - templates. + + A path to a directory with custom templates. + @@ -555,414 +698,525 @@
Exporters = - The exporters tab is used to specify which type of code that - should be generated. Each selection represents an "Exporter" that are - responsible for generating the code, hence the name. + The + Exporters + tab is used to specify which type of code that should = be generated. Each + selection represents an Exporter that are responsible for generati= ng the code, hence the + name. = - - - - +
+ Selecting Exporters + + + + = - - - - + + + + +
= - The following table describes in short the various - exporters. Remember you can Add and Remove any exporters depending o= n your needs. + The following table describes in short the various exporters. = Remember you can + add/remove any Exporters depending on your needs. =
Code generation "Exporter" tab fields = - + = - + = - Field + + Field + = - Description + + Description + = - Domain code + + Domain code + = - Generates POJO's for all the persistent classes= and - components found in the given Hibernate - configuration. + + Generates POJO's for all the persistent classes and = components found in the + given Hibernate configuration. + = - DAO code + + DAO code + = - Generates a set of DAO's for each entity - found. + + Generates a set of DAO's for each entity found. + = - Hibernate XML Mappings + + Hibernate XML Mappings + = - Generate mapping (hbm.xml) files for each - entity + + Generate mapping (hbm.xml) files for each entity + = - Hibernate XML Configuration + + Hibernate XML Configuration + = - Generate a hibernate.cfg.xml file. Used to keep= the - hibernate.cfg.xml uptodate with any new found mapping - files. + + Generate a hibernate.cfg.xml file. Used to keep the = hibernate.cfg.xml uptodate + with any new found mapping files. + = - Schema Documentation (.html) + + Schema Documentation (.html) + = - Generates set of html pages that documents the - database schema and some of the mappings. + + Generates set of html pages that documents the datab= ase schema and some of the + mappings. + = - Generic Exporter (hbmtemplate) + + Generic Exporter (hbmtemplate) + = - Fully customizable exporter which can be used t= o perform custom generation. + + Fully customizable exporter which can be used to per= form custom + generation. + =
= - Each exporter listens to certain properties and these can be s= etup - in the "Properties" section where you can add/remove predefined or - customer properties for each of the exporters. The following table l= ists - the time of writing pre-defined properties: + Each Exporter listens to certain properties and these can be s= etup in the + Properties + section where you can add/remove predefined or custome= r properties for each of + the exporters. The following table lists the time of writing pre-d= efined properties: = - + +
Exporter Properties = - + = - + = - Name + + Name + = - Description + + Description + = - jdk5 + + jdk5 + = - Generate Java 5 syntax + + Generate Java 5 syntax + = - ejb3 + + ejb3 + = - Generate EJB 3 annotations + + Generate EJB 3 annotations + = - - for_each + + + for_each + = - Specifies which type of model elements the ex= porter should create a file and run through the templates. Possible values = are: entity, component, configuration + + Specifies which type of model elements the exporte= r should create a file and + run through the templates. Possible values are: entity= , component, + configuration + = - template_path + + template_path + = - Custom template directory for this specific e= xporter. You can use Eclipse variables. + + Custom template directory for this specific export= er. You can use Eclipse + variables. + = - - template_name + + + template_name + = - Name for template relative to the template pa= th + + Name for template relative to the template path + = - outputdir + + outputdir + = - Custom output directory for this specific exp= orter. You can use Eclipse variables. + + Custom output directory for this specific exporter= . You can use Eclipse + variables. + = - - file_pattern + + + file_pattern + = - Pattern to use for the generated files, relat= ively for the output dir. Example: {package-name}/{class-name}.java<= /entry> + + Pattern to use for the generated files, relatively= for the output dir. + Example: {package-name}/{class-name}.java + = = = - dot.executable + + dot.executable + = - executable to run GraphViz (only relevant, but - optional for Schema documentation) + + executable to run GraphViz (only relevant, but opt= ional for Schema + documentation) + -
+ +
=
Hibernate Mapping and Configuration File Editor = - The Hibernate Mapping file editor provides XML editing functiona= lity - for the hbm.xml and cfg.xml files. The editor is based on the Eclipse = WTP - tools and extend its functionallity to provide hibernate specific code - completion. + The Hibernate Mapping file editor provides XML editing functiona= lity for the + hbm.xml + and + cfg.xml + files. The editor is based on the Eclipse WTP tools and = extend its functionallity + to provide Hibernate specific code completion. = - - - - +
+ XML Editing Functionality + + + + = - - - - + + + + +
=
Java property/class completion = - Package, class, and field completion is enabled for relevant X= ML - attributes. The auto-completion detects it's context and limits the - completion for e.g. <property> and only shows the - properties/fields available in the enclosing <class>, - <subclass> etc. It is also possible to navigate from the hbm.x= ml - files to the relevant class/field in java code. + Package, class, and field completion is enabled for relevant X= ML attributes. The + auto-completion detects its context and limits the completion for = e.g. + <property> + and only shows the properties/fields available in the = enclosing + <class> + , + <subclass> + etc. It is also possible to navigate from the + hbm.xml + files to the relevant class/field in java code. = - - - - +
+ Navigation Functionallity + + + + + = - - - - - - - + + + + + + + + = - - - - + + + + + +
= - This is done via the standard hyperlink navigation functionall= ity - in Eclipse; per default it is done by pressing F3 while the cursor i= s on - a class/field or by pressing Ctrl and the mouse button to perform the - same navigation. + This is done via the standard hyperlink navigation functionall= ity in Eclipse; per + default it is done by pressing F3 while the cursor is on a class/f= ield or by pressing + Ctrl + and the mouse button to perform the same navigation. = - For java completion and navigation to work the file needs to - reside inside an Eclipse Java project, otherwise no completion will - occur. Note: java completion does not require a hibernate console - configuration to be used. + For java completion and navigation to work the file needs to r= eside inside an Eclipse + Java project, otherwise no completion will occur. + + Java completion does not require a Hibernate console configu= ration to be used. +
=
Table/Column completion = - Table and column completion is also available for all table and - column attributes. + Table and column completion is also available for all table an= d column attributes. + +
+ Table and Column Completion + - + = - + - + +
= - Note that it requires a proper configured hibernate console - configuration and this configuration should be the default for the - project where the hbm.xml resides. + Note that it requires a proper configured hibernate console co= nfiguration and this + configuration should be the default for the project where the + hbm.xml + resides. = - You can check which console configuration is selected under the - Properties of a project and look under the "Hibernate Settings" page. - When a proper configuration is selected it will be used to fetch the - table/column names in the background. + You can check which console configuration is selected under th= e Properties of a project + and look under the + Hibernate Settings + page. When a proper configuration is selected it will = be used to fetch the + table/column names in the background. = - Note: Currently it is not recommended to use this feature on l= arge - databases since it does not fetch the information iteratively. It wi= ll - be improved in future versions. + + Currently it is not recommended to use this feature on large= databases since it does + not fetch the information iteratively. It will be improved in fu= ture versions. +
=
Configuration property completion = - In cfg.xml code completion for the value of <property> n= ame - attributes is available. + In + cfg.xml + code completion for the value of + <property> + name attributes is available. = - + = +
+ Property Completion + - + = - + - + +
+ =
=
Reveng.xml editor = - A reveng.xml file is used to customize and control how reverse - engineering is performed by the tools. The plugins provide and editor = to - ease the editing of this file and hence used to configure the reverse - engineering process. + A + reveng.xml + file is used to customize and control how reverse engineering is = performed by + the tools. The plugins provide and editor to ease the editing of thi= s file and hence used to + configure the reverse engineering process. = - The editor is intended to allow easy definition of type mappings, - table include/excludes and specific override settings for columns, e.g. - define a explicit name for a column when the default naming rules is n= ot - applicable. + The editor is intended to allow easy definition of type mappings= , table include/excludes + and specific override settings for columns, e.g. define a explicit n= ame for a column when the + default naming rules is not applicable. = - Note that not all the features of the .reveng.xml file is expose= d or - fully implemented in the editor, but the main functionallity is there.= To - understand the full flexibility of the reveng.xml, please see + Note that not all the features of the + .reveng.xml file is exposed or fully= implemented in + the editor, but the main functionallity is there. To understand the = full flexibility of the + + reveng.xml, please see = - The editor is activated as soon as an .reveng.xml file is opened= . To - get an initial reveng.xml file the reveng.xml wizard can be started via - Ctrl+N or via the code generation launcher. + The editor is activated as soon as an + .reveng.xml file is opened. To get a= n initial + + reveng.xml file the reveng.xml wiz= ard can be started via + Ctrl+N or via the code generation + launcher. = - The following screentshot shows the overview page where the want= ed - console configuration is selected (auto-detected if Hibernate 3 suppor= t is - enabled for the project) + The following screentshot shows the + Overview page where the wanted conso= le configuration + is selected (auto-detected if Hibernate 3 support is enabled for the= project) = - +
+ Overview Page + - + = - + - + +
= - The table filter page allows you to specify which tables to incl= ude - and exclude. Pressing refresh shows the tables from the database that = have - not yet been excluded. + The + Table Filter page allows you to spec= ify which tables to include and exclude. Pressing + refresh shows the tables from the database that have not yet been ex= cluded. = - +
+ Table Filters Page + - + = - + - + +
= - Type mappings page is used for specifying type mappings from jdbc - types to any hibernate type (including usertypes) if the default rules= are - not applicable. + The + Type Mappings page is used for speci= fying type mappings from jdbc types to any Hibernate + type (including usertypes) if the default rules are not applicable.<= /para> = - +
+ Type Mappings Page + - + = - + - + +
= - Table Columns page allow the user to explicit set e.g. which - hibernatetype and propertyname that should be used in the reverse - engineered model. + The + Table and Columns page allow the use= r to explicit set e.g. which hibernatetype and + propertyname that should be used in the reverse engineered model. = - +
+ Table and Columns Page + - + = - + - + +
=
Hibernate Console perspective = - The Hibernate Console perspective combines a set of views which - allow you to see the structure of your mapped entities/classes, edit H= QL - queries, execute the queries, and see the results. To use this perspec= tive - you need to create a console configuration. + The Hibernate Console perspective combines = a set of views which allow you to see the + structure of your mapped entities/classes, edit HQL queries, execute= the queries, and see the + results. To use this perspective you need to create a console config= uration. =
Viewing the entity structure = - To view your new configuration and entity/class structure, exp= and - the Hibernate Console configuration by clicking on the + icon. + To view your new configuration and entity/class structure, exp= and the Hibernate Console + configuration by clicking on the + icon. = - Clicking on the small + symbol allows you to - browse the class/entity structure and see the relationships. + Clicking on the small + symbol allows you t= o browse the class/entity + structure and see the relationships. = - +
+ Hibernate Console Perspective + - + = - + - Hibernate Console perspective showing entity struct= ure, - query editor and result + = + = +
+ = + Hibernate Console perspective showing ent= ity structure, query editor and + result + = = - The console configuration does not dynamically adjust to chang= es done in mappings and java code; to reload the configuration select the c= onfiguration and click the 'Reload' button in the view toolbar or in the co= ntext menu. + The console configuration does not dynamically adjust to chang= es done in mappings and + java code; to reload the configuration select the configuration an= d click the + Reload + + button in the view toolbar or in the context menu.
Mapping Diagram = - A mapping diagram for entities are available by right clicki= ng on the entity you want an mapping diagram for and then choose "Open Mapp= ing Diagram" + A mapping diagram for entities are available by right clicki= ng on the entity you want + an mapping diagram for and then choose + Open Mapping Diagram = - +
+ Mapping Diagram + - + = - + - + +
=
@@ -970,89 +1224,95 @@
Prototyping Queries = - Queries can be prototyped by entering them in the HQL or Crite= ria editor. The - query editors are opened by right-clicking the Console configuration= and - selecting either "HQL Editor" or "Criteria Editor". - = - If the menu item is disabled then you need to first create an - SessionFactory. That is done by simply expanding the Session - Factory node. + Queries can be prototyped by entering them in the HQL or Crite= ria editor. The query + editors are opened by right-clicking the Console configuration and= selecting either + HQL + Editor or + Criteria Editor. = - Executing the query is done by clicking the green run button in - the toolbar or pressing Ctrl+Enter. + If the menu item is disabled then you need to first create an = SessionFactory. That is + done by simply expanding the Session Factory node. = - Errors during creation of the SessionFactory or - running the queries (e.g. if your configuration or query is incorrec= t) - will be shown in a message dialog or inlined in the view that detect= ed - the error, you may get more information about the error in the Error= Log - view on the right pane. + Executing the query is done by clicking the green run button i= n the toolbar or pressing + + Ctrl+Enter. = - Results of a query will be shown in the Query result view and - details of possible errors (syntax errors, database errors, etc.) ca= n be - seen in the Error Log view. + Errors during creation of the SessionFactory or running the queries + (e.g. if your configuration or query is incorrect) will be shown i= n a message dialog or + inlined in the view that detected the error, you may get more info= rmation about the error in + the Error Log view on the right pane. = - Tip: HQL queries are executed by default using list()= thus - without any limit of the size of the output the query could return a= large result set. = - You might run out of memory. To avoid this you can put a value in th= e Max results field to reduce the number of elements returned. + Results of a query will be shown in the Query result view and = details of possible errors + (syntax errors, database errors, etc.) can be seen in the Error Lo= g view. = + + HQL queries are executed by default using list() thus without + any limit of the size of the output the query could return a large= result set. You might run + out of memory. To avoid this you can put a value in the Max result= s field to reduce the + number of elements returned. + +
Dynamic Query Translator = - If the "Hibernate Dynamic Query Translator" view is visible - while writing in the HQL editor it will show the generated SQL for= a - HQL query. + If the + Hibernate Dynamic Query Translator view is visible while writing in the HQL + editor it will show the generated SQL for a HQL query. = +
+ Hibernate Dynamic Query Translator View - + = - + +
= - The translation is done each time you stop typing into the - editor, if there are an error in the HQL the parse exception will = be - shown embedded in the view. + The translation is done each time you stop typing into the e= ditor, if there are an + error in the HQL the parse exception will be shown embedded in t= he view.
=
Properties view = - The properties view shows the structure of any selected persis= tent - object in the results view. Editing is not yet supported. + The + Properties view shows the structur= e of any selected persistent object in the results + view. Editing is not yet supported. = - +
+ Properties View + - + = - + - + +
=
Enable debug logging in the plugins = - It is possible to configure the eclipse plugin to route all logg= ing - made by the plugins and hibernate code it self to the "Error log" view= in - Eclipse. + It is possible to configure the eclipse plugin to route all logg= ing made by the plugins + and hibernate code it self to the + Error log view in Eclipse. = - This is done by editing the "hibernate-log4j.properties" in - org.hibernate.eclipse/ directory/jar. This file includes a default - configuration that only logs WARN and above to a set of custom appende= rs - (PluginFileAppender and PluginLogAppender). You can change these setti= ngs - to be as verbose or silent as you please - see hibernate documentation= for - interesting categories and log4j documentation for how to configure - logging via a log4j property file. + This is done by editing the + hibernate-log4j.properties in + org.hibernate.eclipse/ + directory/jar. This file includes a default co= nfiguration that only logs WARN and above to a + set of custom appenders (PluginFileAppender and PluginLogAppender). = You can change these + settings to be as verbose or silent as you please - see hibernate do= cumentation for + interesting categories and log4j documentation for how to configure = logging via a log4j + property file.
- \ No newline at end of file + Modified: trunk/hibernatetools/docs/reference/en/modules/reverseengineering= .xml =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/hibernatetools/docs/reference/en/modules/reverseengineering.xml 2= 007-11-29 12:41:06 UTC (rev 5147) +++ trunk/hibernatetools/docs/reference/en/modules/reverseengineering.xml 2= 007-11-29 13:48:54 UTC (rev 5148) @@ -2,16 +2,20 @@ Controlling reverse engineering = - When using the <jdbcconfiguration> the ant task will read the + When using the + <jdbcconfiguration> the ant task= will read the database metadata and from that perform a reverse engineering of the database schema into a normal Hibernate Configuration. It is from this - object e.g. >hbm2java< can generate other artifacts such as .java, - .hbm.xml etc. + object e.g. + <hbm2java>can generate other art= ifacts such as + .java, + + .hbm.xml etc. = - To govern this process Hibernate uses a reverse engineering strate= gy. + To govern this process Hibernate uses a rever= se engineering strategy. A reverse engineering strategy is mainly called to provide more java like names for tables, column and foreignkeys into classes, properties and - associations. It also used to provide mappings from SQL types to Hiberna= te + associations. It also used to provide mappings from SQL types to Hibernate types. The strategy can be customized by the user. The user can even pro= vide its own custom reverse engineering strategy if the provided strategy is = not enough, or simply just provide a small part of the strategy and delegate= the @@ -22,24 +26,28 @@ = The default strategy uses some rules for mapping JDBC artifact n= ames to java artifact names. It also provide basic typemappings from JDBC t= ypes - to Hibernate types. It is the default strategy that uses the packagena= me + to = + Hibernate + types. It is the default strategy that uses the packagename attribute to convert a table name to a fully qualified classname.
=
hibernate.reveng.xml file = - To have fine control over the process a hibernate.reveng.xml file + To have fine control over the process a + hibernate.reveng.xml file can be provided. In this file you can specify type mappings and table filtering. This file can be created by hand (its just basic XML) or you can use the Hibernate plugins which have a specialized editor. = - Note: many databases is case-sensitive with their names and thus= if + Many databases is case-sensitive with their names and thus= if you cannot make some table match and you are sure it is not excluded b= y a - <table-filter> then check if the case matches; most databases st= ores - table names in uppercase. + <table-filter>then check if the case matches; most databases sto= res + table names in uppercase. = - The following is an example of a reveng.xml. Following the examp= le + The following is an example of a + reveng.xml. Following the example is more details about the format. = @@ -93,23 +101,31 @@
Schema Selection (<schema-selection>) = - <schema-selection> is used to drive w= hich - schema's the reverse engineering will try and process. + + <schema-selection> is used t= o drive which + schema's the reverse engineering will try and process. = By default the reverse engineering will read all schemas and t= hen - use <table-filter> to decide which tables g= et + use + <table-filter> to decide w= hich tables get reverse engineered and which do not; this makes it easy to get start= ed but can be inefficient on databases with many schemas. = - With <schema-selection> it is thus + With + <schema-selection> it is thus possible to limit the actual processed schemas and thus significantly speed-up the reverse engineering. - <table-filter> is still used to then decide + + <table-filter> is still us= ed to then decide which tables will be included/excluded. = - Note: If no <schema-selection> is + If no <schema-selection> is specified, the reverse engineering works as if all schemas should be - processed. This is equal to: + processed. + = + = + = + This is equal to: = ]]> = @@ -120,15 +136,19 @@
Examples = - The following will process all tables from MY_SCHEMA. + The following will process all tables from + "MY_SCHEMA". = ]]> = It is possible to have multiple schema-selection's to support multi-schema read= ing or simply to limit the processing to very specific tables. The - following example process all tables in MY_SCHEMA, a specific CITY - table plus all tables that starts with CODES_ in COMMON_SCHEMA. + following example process all tables in + "MY_SCHEMA", a specifi= c + "CITY" + table plus all tables that starts with + "CODES_ in COMMON_SCHEMA". = @@ -139,12 +159,13 @@
Type mappings (<type-mapping>) = - The <type-mapping> section specifies = how - the JDBC types found in the database should be mapped to Hibernate + The + <type-mapping> section speci= fies how + the JDBC types found in the database should be mapped to Hibernate types. e.g. java.sql.Types.VARCHAR with a length of 1 should be mapp= ed to the Hibernate type yes_no or java.sql.Types.NUMERIC should generally just be converted to the - Hibernate type long. + Hibernate type long. = ]]> = The number of attributes specificed and the sequence of the - sql-type's is important. Meaning that Hibernate w= ill + sql-type's is important. Meaning that Hibernate will search for the most specific first, and if no specific match is foun= d it will seek from top to bottom when trying to resolve a type mapping. @@ -334,7 +355,8 @@
Table filters (<table-filter>) = - The <table-filter> let you specifcy matching rules for + The + <table-filter> let you speci= fcy matching rules for performing general filtering/setup for tables, e.g. let you include = or exclude specific tables based on the schema or even a specifc prefix. @@ -392,7 +414,8 @@
Specific table configuration (<table>) = - <table> allows you to provide explicit + + <table> allows you to provid= e explicit configuration on how a table should be reverse engineered. Amongst o= ther things it allow control over the naming of a class for the table, specify which identifier generator should be used for the primary key @@ -443,7 +466,8 @@
<primary-key> = - A <primary-key> allows you to defin= e a + A + <primary-key> allows you t= o define a primary-key for tables that does not have such defined in the database, and probably more importantly it allows you to define wh= ich identifier strategy that should be used (even for already existing @@ -491,9 +515,10 @@
<column> = - With a <column> it is possible to explicitly name the + With a + <column> it is possible to= explicitly name the resulting property for a column. It is also possible to redefine w= hat - jdbc and/or hibernate type a column should be processed and finall= y it + jdbc and/or Hibernate type a column should be processed and finall= y it is possible to completely exclude a column from processing. = @@ -549,7 +574,8 @@
<foreign-key> = - The <foreign-key> has two purposes. One for allowing to + The + <foreign-key> has two purp= oses. One for allowing to define foreign-keys in databases that does not support them or does not have them defined in their schema. Secondly, to allow defining= the name of the resulting properties (many-to-one and @@ -645,16 +671,17 @@ Custom strategy = It is possible to implement a user strategy. Such strategy must - implement org.hibernate.cfg.reveng.ReverseEngineeringStrategy. It is - recommended that one uses the DelegatingReverseEngineeringStrategy and + implement + org.hibernate.cfg.reveng.ReverseEngineeringStrategy. It is + recommended that one uses the DelegatingReverseEngineeringSt= rategy and provide a public constructor which takes another - ReverseEngineeringStrategy as argument. This will allow you to only + ReverseEngineeringStrategy as argument. This w= ill allow you to only implement the relevant methods and provide a fallback strategy. Exampl= e of custom delegating strategy which converts all column names that ends w= ith - "PK" into a property named "id". + + "PK" into a property nam= ed + "id". = - - Custom Database Metadata = By default the reverse engineering is performed by reading using= the - JDBC database metadata API. This is done via the class - org.hibernate.cfg.reveng.dialect.JDBCMetaDataDialect + JDBC database metadata API. This is done via the class + + org.hibernate.cfg.reveng.dialect.JDBCMetaDataDialect which is an implementation of - org.hibernate.cfg.reveng.dialect.MetaDataDialect. + + org.hibernate.cfg.reveng.dialect.MetaDataDialect. = The default implementation can be replaced with an alternative implementation by setting the property - hibernatetool.metadatadialect to a fully qualified + + hibernatetool.metadatadialect to a= fully qualified classname for a class that implements - JDBCMetaDataDialect. + JDBCMetaDataDialect. = This can be used to provide database specific optimized metadata reading. If you create an optimized/better metadata reading for your Modified: trunk/hibernatetools/docs/reference/en/modules/setup.xml =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/hibernatetools/docs/reference/en/modules/setup.xml 2007-11-29 12:= 41:06 UTC (rev 5147) +++ trunk/hibernatetools/docs/reference/en/modules/setup.xml 2007-11-29 13:= 48:54 UTC (rev 5148) @@ -2,69 +2,78 @@ Download and install Hibernate Tools = - Hibernate tools can be used "standalone" via Ant 1.6.x or fully - integrated into a Eclipse 3.3.x + WTP 2.x based IDE, such as JBoss Tools= or an - default Eclipse 3.3.x + WTP 2.x installation. The following describes th= e install - steps in these environments. + Hibernate Tools can be used "standalone&= quot; via Ant + 1.6.x or fully integrated into a Eclipse 3.3.x + WTP 2.x based IDE, su= ch as JBoss + Tools or an default Eclipse 3.3.x + WTP 2.x installation.= The following describes + the install steps in these environments. =
JBoss Tools = - JBoss Tools 2.x includes Hibernate Tools and thus nothing is - required besides downloading and installing JBoss Tools. If you need - to update to a newer version of the Hibernate Tools just follow the - instructions in the Eclipse IDE section. + JBoss Tools 2.x includes Hibernat= e Tools and + thus nothing is required besides downloading and installing JBoss Tools. + If you need to update to a newer version of the Hibernate = Tools just + follow the instructions in the Eclipse IDE section.
=
Eclipse IDE = - To install into any Eclipse 3.3.x based Eclipse IDE you can eith= er - download the Hibernate Tools distribution from the Hibernate website or - use the JBoss Tools update site (see http://tools.hibernate.org for = - links to the update site). + To install into any Eclipse 3.3.x based Ecl= ipse IDE you can either + download the Hibernate Tools distribution from = the Hibernate website or us= e the JBoss + Tools update site (see also http://tools.hibernate.org for links to the update site).= = - If you download the Hibernate Tools distribution you need to pla= ce - the /plugins and /feature directory into your eclipse directory or ecl= ipse - extensions directory. Sometimes Eclipse does not automatically detect = new - plugins and thus the tools will not be activated. To ensure eclipse se= es - these changes run eclipse with the -clean option. E.g. eclipse - -clean Using the updatesite does not require any additional - steps. + If you download the Hibernate Tools distrib= ution you need to place + the + /plugins + and + /feature + directory into your eclipse directory or eclipse extensi= ons directory. Sometimes + Eclipse does not automatically detect new plugins and thus the tools= will not be activated. To + ensure eclipse sees these changes run eclipse with the -clean option= . E.g. eclipse + -clean Using the updatesite does not require any additio= nal steps. = - Tip: If you need more basic instructions on installing plugins a= nd - general usage of eclipse then check out - https://eclipse-tutorial.dev.java.net/ and especially - https://eclipse-tutorial.dev.java.net/visual-tutorials/updatemanager.h= tml - which covers using the update manager. + + If you need more basic instructions on installing plugins and = general usage of eclipse + then check out https://eclipse-tutorial.dev.java.net/ and especially <= ulink + url=3D"https://eclipse-tutorial.dev.java.net/visual-tutorials/up= datemanager.html" + >https://eclipse-tutorial.dev.java.net/visual-tutorials/update= manager.html which covers + using the update manager. + =
Usage of Eclipse WTP = - The Hibernate tools plugins currently uses WTP 2.x which at th= is - time is the latest stable release from the Eclipse Webtools - project. + The Hibernate Tools plugins currently use= s WTP + 2.x which at this time is the latest stable release fro= m the Eclipse Webtools + project. = - Because the WTP project not always have had proper versioning = of their plugins - there might exist WTP plugins in your existing eclipse directory from - other Eclipse based projects that are from an earlier WTP release but - has either the same version number or higher. It is thus recommended - that if you have issues with WTP provided features to try and install - the plugins on a clean install of eclipse to ensure there are no - version collisions. - = + Because the WTP project not always have had proper versioning = of + their plugins there might exist WTP plugins in your existing eclip= se + directory from other Eclipse based projects that are from an earli= er + WTP release but has either the same version number or higher. It is + thus recommended that if you have issues with WTP provided feature= s to + try and install the plugins on a clean install of eclipse to ensur= e there are no version + collisions. +
=
Ant = - To use the tools via Ant you need the hibernate-tools.jar and - associated libraries. The libraries are included in the distribution f= rom - the Hibernate website and the Eclipse updatesite. The libraries are - located in the eclipse plugins directory at - /plugins/org.hibernate.eclipse.x.x.x/lib/tools/.The= se - libraries are 100% independent from the eclipse platform. How to use t= hese - via ant tasks are described in the Ant chapter. + To use the tools via Ant you need the + hibernate-tools.jar + and associated libraries. The libraries are included in = the distribution from the + Hibernate website and the Eclipse updatesite. The libraries are loca= ted in the eclipse plugins + directory at + + /plugins/org.hibernate.eclipse.x.x.x/lib/tools/. + + These libraries are 100% independent from the eclipse pla= tform. How to use these + via ant tasks are described in the Ant chapter.
-
\ No newline at end of file + --===============3047155201791890748==--