论坛首页 Java企业应用论坛

使用Middlegen-Hibernate连oracle取不出表,下面是build.xml...

浏览 4989 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
作者 正文
   发表时间:2003-11-13  
oracle.xml
  <!-- =================================================================== -->
   <!-- ant properties/targets for oracle 8/9                               -->
   <!-- note: this is not a proper xml file (there is no root element)      -->
   <!--       it is intended to be imported from a *real* xml file          -->
   <!-- =================================================================== -->

   <!-- please set your Oracle-SID according to your needs -->

   <property environment="env"/>

   <property name="database.script.file"           value=""/>
   <property name="database.driver.file"           value="${lib.dir}/classes12.jar"/>
   <property name="database.driver.classpath"      value="${database.driver.file}"/>
   <property name="database.driver"                value="oracle.jdbc.driver.OracleDriver"/>
   <property name="database.url"                   value="jdbc:oracle:thin:@192.168.0.1:1521:tridb"/>
   <property name="database.userid"                value="DBAVC"/>
   <property name="database.password"              value="trig"/>
   <property name="database.schema"                value="DBAVC"/>
   <property name="database.catalog"               value=""/>

   <!--property name="jboss.datasource.mapping"       value="Oracle7"/-->
   <!--property name="jboss.datasource.mapping"       value="Oracle8"/-->
   <property name="jboss.datasource.mapping"       value="Oracle9i"/>
schema我设置了和用户名称一样的
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="${database.schema}"
         catalog="${database.catalog}"
      >
请问这个是为什么呢?
下面是报错的信息:
Buildfile: build.xml

init:

fail-if-no-xdoclet-1.2:

check-driver-present:

panic-if-driver-not-present:

middlegen:
     [echo] Class path = D:\Mid\Middlegen-Hibernate-r1
[middlegen] Database URL:jdbc:oracle:thin:@192.168.0.1:1521:tridb
[middlegen] No <table> elements specified. Reading all tables. This might take a
while...
[middlegen] (middlegen.MiddlegenPopulator        743 ) WARNING: The JDBC driver
didn't report any primary key columns in REL_AUTH_GROUP_LT
[middlegen] (middlegen.MiddlegenPopulator        743 ) WARNING: The JDBC driver
didn't report any primary key columns in REL_STATION_GROUP_LT
[middlegen] (middlegen.MiddlegenPopulator        743 ) WARNING: The JDBC driver
didn't report any primary key columns in T_AUTHORIZATION_LT
[middlegen] (middlegen.MiddlegenPopulator        743 ) WARNING: The JDBC driver
didn't report any primary key columns in T_SYSTEMOPTION
[middlegen] (middlegen.MiddlegenPopulator        743 ) WARNING: The JDBC driver
didn't report any primary key columns in T_AUTHGROUP_LT
[middlegen] (middlegen.MiddlegenPopulator        743 ) WARNING: The JDBC driver
didn't report any primary key columns in T_ACCESSLOG_LT
界面出来了,但是没表
如果把
schema="${database.schema}"
         catalog="${database.catalog}"
改为:
schema=""
catalog=""
则报:
middlegen:
     [echo] Class path = D:\Mid\Middlegen-Hibernate-r1
[middlegen] Database URL:jdbc:oracle:thin:@192.168.0.1:1521:tridb
[middlegen] No <table> elements specified. Reading all tables. This might take a
while...

BUILD FAILED
file:D:/Mid/Middlegen-Hibernate-r1/build.xml:191: middlegen.MiddlegenException:
Middlegen successfully connected to the database, but couldn't find any tables.
Perhaps the specified schema or catalog is wrong? -Or maybe there aren't any tab
les in the database at all?
出错,怎么修改
请帖一个成功的build.xml和oralce.xml出来,谢谢!
   发表时间:2004-02-19  
database.schema不能为空,填上你的用户名.你点击界面的Generator。会生成*.hbm.xml文件的!

didn't report any primary key

说明这个表没有设主键,但是这不影响生成对应的映射文件的生成,默认会把所有的字段组成一个compsite-id!
0 请登录后投票
   发表时间:2004-02-20  
除了设置schema之外,设catalog为数据库名,或者干脆将 schema="" 或
catalog="" 去掉(不是设为空)。我遇到过这种情况,就是这样处理的。
0 请登录后投票
论坛首页 Java企业应用版

跳转论坛:
Global site tag (gtag.js) - Google Analytics