From: <leg...@at...> - 2003-11-18 21:19:45
|
The following issue has been updated: Updater: Per Thomas Jahr (mailto:Per...@nr...) Date: Tue, 18 Nov 2003 3:18 PM Changes: Attachment changed to JcsClassCache.java --------------------------------------------------------------------- For a full history of the issue, see: http://opensource.atlassian.com/projects/hibernate/secure/ViewIssue.jspa?key=HB-480&page=history --------------------------------------------------------------------- View the issue: http://opensource.atlassian.com/projects/hibernate/secure/ViewIssue.jspa?key=HB-480 Here is an overview of the issue: --------------------------------------------------------------------- Key: HB-480 Summary: Ant task that generates hibernate.cfg.xml Type: Patch Status: Unassigned Priority: Minor Project: Hibernate2 Components: toolset Versions: 2.0.3 Assignee: Reporter: Per Thomas Jahr Created: Tue, 18 Nov 2003 3:17 PM Updated: Tue, 18 Nov 2003 3:18 PM Description: I have written an Ant task that generates the hibernate.cfg.xml file. This can be usefull either as a standalone Ant task or one can write a more generic Hibernate tool and then write a Ant task for it (like hbm2java). Background: I use middlegen to generate all the mapping files from my database. This gives me one mapping file for each table, but middlegen does not update the hibernate.cfg.xml file. This task will scan a directory (or filesets as it is called in Ant) and fill in the correct mappings that it finds. Usage: 1. The class that defines the task must be defined (by using taskdef). 2. The "dest" attribute is the destination for generated config file. 3. <sfproperty name="" value=""/> is the session factory properties. 4. <mapping dir=""/> is the folder where the mapping files can be found. Note that this is a fileset so you could write something like: <mapping dir="my_mapping_folder> <include name="**/*.hbm"/> <exclude name="**/Testtable.hbm"/> </mapping> <target name="updatehibernateconfig"> <taskdef name="hibconfig" classname="no.nr.ant HibernateConfigFileTask"/> <hibconfig dest="hibernate.cfg.xml"> <sfproperty name="connection.datasource" value="java:comp/env/jdbc/hibernate"/> <sfproperty name="show_sql" value="false"/> <sfproperty name="dialect" value="net.sf.hibernate.dialect.SybaseDialect"/> <mapping dir="mapping_dir"/> </hibconfig> </target> Some limitations: * Only "mapping resource" is supported (not jar or file). And I don't know what they mean. * It uses the 2.0 version of the DTD (http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd). It should be designed so that it can easily support new DTD's. --------------------------------------------------------------------- JIRA INFORMATION: This message is automatically generated by JIRA. If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira |