org.hibernate.MappingException:无法从文件配置覆盖:hibernate.reveng.xml

时间:2018-01-14 19:14:16

标签: java hibernate oracle10g hibernate-mapping

[Hibernate代码3.6]与oracle数据库连接 我已经使用架构DB1建立了数据库,最近我在我的dababase中添加了一个新表(5个表)

所以我在eclipse中使用hibernate来生成.class和hbm.xml以便与数据库进行映射

我需要转换5个独立的新表,我的意思是没有映射一对一或一对多

另一方面,这5个表之间有一个映射

这是我的配置:

enter image description here

这是我的配置文件hibernate.reveng.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-reverse-engineering PUBLIC "-//Hibernate/Hibernate Reverse Engineering DTD 3.0//EN" "http://hibernate.org/dtd/hibernate-reverse-engineering-3.0.dtd" >

<hibernate-reverse-engineering>
  <table-filter match-schema="XX" match-name="tab1"/>
  <table-filter match-schema="XX" match-name="tab2"/>
  <table-filter match-schema="XX" match-name="tab3"/>
  <table-filter match-schema="XX" match-name="tab4"/>
  <table-filter match-schema="XX" match-name="tab5"/>
</hibernate-reverse-engineering>

当我在没有hibernate.reveng.xml的情况下生成 Hibernate代码配置时 (这意味着他将从数据库生成所有表格)它运作良好我已经创建了我的所有tab1,2,3,4,5但是所有其他表格

所以我需要生成我的新表

请你帮帮我

2 个答案:

答案 0 :(得分:1)

我在更改DOCTYPE后解决了我的异常

我改变了这个

<!-- dont know why but its not working -->
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE hibernate-reverse-engineering PUBLIC "-//Hibernate/Hibernate Reverse Engineering DTD 3.0//EN" "http://hibernate.org/dtd/hibernate-reverse-engineering-3.0.dtd" >

这一个

<!-- works fine -->

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE hibernate-reverse-engineering PUBLIC "-//Hibernate/Hibernate Reverse Engineering DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-reverse-engineering-3.0.dtd" >

谢谢

答案 1 :(得分:0)

升级后的今天,我解决了更改我的DOCTYPE的问题。

我删除了这个(没有工作)

<!DOCTYPE hibernate-reverse-engineering PUBLIC "-//Hibernate/Hibernate Reverse Engineering DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-reverse-engineering-3.0.dtd" >

with this(Works)

<!DOCTYPE hibernate-reverse-engineering PUBLIC "-//Hibernate/Hibernate Reverse Engineering DTD 3.0//EN" "http://hibernate.org/dtd/hibernate-reverse-engineering-3.0.dtd" >