【问题标题】:Using hibernate tools to reverse engineer pojos from Postgres使用休眠工具从 Postgres 逆向工程 pojos
【发布时间】:2010-12-24 11:21:13
【问题描述】:

我正在尝试从我在 Postgres 中创建的数据库中对 pojos(在 eclipse 3.4.2 中使用休眠工具插件 v3.2.4x)进行逆向工程,但我的表被忽略了。如果我在 hibernate.cfg.xml 文件中将 'public' 指定为 'hibernate.default_schema' 属性的值,它会起作用,但如果我尝试指定不同的架构,则不会生成任何内容。

我尝试过修改大小写(即下、上、骆驼),但我仍然得到相同的结果。这是我的 hibernate.cfg.xml 文件:

 <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
      "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
      "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
    <session-factory name="MyFactory">
        <property name="hibernate.connection.driver_class">org.postgresql.Driver</property>
        <property name="hibernate.connection.password">[mypassword]</property>
        <property name="hibernate.connection.url">jdbc:postgresql://localhost:5432/testgis</property>
        <property name="hibernate.connection.username">postgres</property>
        <property name="hibernate.default_schema">locatimus</property>
        <property name="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</property>
    </session-factory>
</hibernate-configuration>

这是我在 pgAdmin III 中设置的图片 - http://twitpic.com/snj8i

我很确定我正在做(或错过)一些简单的事情。正如我所说,如果我将架构更改为公共,则会生成该架构中所有表的 pojo!

谁能帮忙?

非常感谢, 达米安

【问题讨论】:

    标签: eclipse hibernate postgresql postgis hibernate-tools


    【解决方案1】:

    好的,我发现了问题。似乎表名必须是小写的,否则休眠工具看不到它们。我不知道这是 PostgresSQL 方言还是 Hibernate 本身的错误。

    【讨论】:

      【解决方案2】:

      postgres 用户是否有权访问 locatimus 架构中的表?

      【讨论】:

      • 是的,postgres 用户在两种模式上拥有完全相同的权限(使用、创建)
      猜你喜欢
      • 1970-01-01
      • 2016-11-23
      • 2011-07-11
      • 2011-08-08
      • 2014-08-11
      • 2012-10-27
      • 2014-08-10
      • 1970-01-01
      • 2012-03-15
      相关资源
      最近更新 更多