gpt4 book ai didi

eclipse - 使用 hibernate 工具从 Postgres 逆向工程 pojos

转载 作者:行者123 更新时间:2023-11-29 11:46:18 29 4
gpt4 key购买 nike

我正在尝试从我在 Postgres 中创建的数据库中对 pojos(使用 eclipse 3.4.2 中的 hibernate 工具插件 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

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

有人能帮忙吗?

非常感谢,达米安

最佳答案

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

关于eclipse - 使用 hibernate 工具从 Postgres 逆向工程 pojos,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1867699/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com