问题
I am trying to reverse engineer pojos (using hibernate tools plugin v3.2.4x in eclipse 3.4.2) from a database that I have created in Postgres but my tables are being ignored. It works if I specify 'public' as the value for the 'hibernate.default_schema' property in my hibernate.cfg.xml file but if I try to specify a different schema then nothing is generated.
I've tried modifying the case (i.e. lower, upper, camel) but I still get the same result. Here is my hibernate.cfg.xml file:
<?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>
Here is a picture of my setup in pgAdmin III - http://twitpic.com/snj8i
I'm pretty sure that I'm doing (or missing) something easy. As I say, if I change the schema to public then pojos from all tables in that schema are generated!
Can anyone help?
Many thanks, Damian
回答1:
OK, I found the problem. It seems that the table names must be in lowercase or hibernate tools does not see them. I don't know if this is a bug with the PostgresSQL dialect or Hibernate itself.
回答2:
Does the postgres user have permission to the tables in the locatimus schema ?
来源:https://stackoverflow.com/questions/1867699/using-hibernate-tools-to-reverse-engineer-pojos-from-postgres