Create an hbm file and java code by using Middlegen.

Source: Internet
Author: User

I recently used SSH configuration, but since the Hibernate Code involves a large range of code, it is not my hope to manually write the Hibernate code file of 38 data tables, so we have this article. Prepare to add the environment variable Ant: Ant_HOME = D: \ Program Files (x86) \ apache-ant-1.9.3 path = % Ant_HOME % \ bin configuration: 1. first open the Middlegen-Hibernate-r5 \ config \ database \ * here there are all the xml files connected to the database I use mysql5.1, so I chose mysql. in xml, where the pink flag is edited, edit the value copy code. <! -- ===================================================== ============================================= --> <! -- Ant properties/targets for mysql --> <! -- Note: this is not a proper xml file (there is no root element) --> <! -- It is intended to be imported from a * real * xml file --> <! -- ===================================================== ========================================= --> <Property name = "database. script. file "value =" $ {src. dir}/SQL/$ {name}-mysql. SQL "/> <property name =" database. driver. file "value =" $ {lib. dir}/mysql-connector-java-5.1.28-bin.jar "/> <property name =" database. driver. classpath "value =" $ {database. driver. file} "/> <property name =" database. driver "value =" org. gjt. mm. mysql. driver "/> <prope Rty name = "database. url "value =" jdbc: mysql: // localhost/uel "/> <property name =" database. userid "value =" root "/> <property name =" database. password "value =" password "/> <property name =" database. schema "value =" "/> <property name =" database. catalog "value =" "/> <property name =" jboss. datasource. mapping "value =" mySQL "/> copy code I'm using here the mysql-connector-java-5.1.28-bin.jar needs to copy the mysql-connector-java-5.1.28-bin.jar to Middl Egen-Hibernate-r5 \ lib directory and then go to the directory Middlegen-Hibernate-r5 root directory edit build. xml file find the following code to change the database connection file to what you need, I use mysql. xml here <! DOCTYPE project [<! ENTITY database SYSTEM "file :. /config/database/mysql. xml ">]> then find the following code to copy the Code

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.