Hibernate middlegen中mssql.xml配置

类别:Java 点击:0 评论:0 推荐:

1,将jdbc,lib中3个jar包copy到应用的lib目录下,然后进行配置。
2,mssql.xml如下
 
   <!-- ant properties/targets for MS SQL Server                            -->
   <!-- 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=""/>
   <property name="database.driver.file"           value="${lib.dir}/mssqlserver.jar" />
   <property name="database.driver"                value="com.microsoft.jdbc.sqlserver.SQLServerDriver"/>
   <property name="database.url"                   value="jdbc:microsoft:sqlserver://localhost:1433;database=dada"/>
   <property name="database.userid"                value="sa"/>
   <property name="database.password"              value="sa"/>
   <!-- In MS SQL the schema is the owner of the tables as displayed by SQL Server Enterprise Manager -->
   <property name="database.schema"                value="dbo"/>
   <!-- In MS SQL the catalog is the database, for example, 'Northwind' -->
   <property name="database.catalog"               value="dada"/>

   <property name="jboss.datasource.mapping"       value="MS SQLSERVER"/>
   <!--property name="jboss.datasource.mapping"       value="MS SQLSERVER2000"/-->
3,build.xml中
      <middlegen
         appname="${name}"
         prefsdir="${src.dir}"
         gui="${gui}"
         databaseurl="${database.url}"
         initialContextFactory="${java.naming.factory.initial}"
         providerURL="${java.naming.provider.url}"
         datasourceJNDIName="${datasource.jndi.name}"
         driver="${database.driver}"
         username="${database.userid}"
         password="${database.password}"  
          schema="dbo" //不是删除
         catalog="dada"    
         includeViews="false"
      >

本文地址:http://com.8s8s.com/it/it11331.htm