我正试图以邮政局8.4.2 DB为生。 每当我试图实施一个简单的java法典时,即:
List<User> users = service.findAllUsers();
我有以下错误:
PSQLException: ERROR: relation "TABLE_NAME" does not exist
自2006年以来 我有选择。 • 显示“sql”方案是真实的,我可以看到,解放者正在试图管理以下指挥系统:
select this_.USERNAME as USERNAME0_0_, this_.PASSWORD as PASSWORD0_0_
from "TABLE_NAME" this_
在现实中,它至少应该像:
select this_."USERNAME" as USERNAME0_0_, this_."PASSWORD" as PASSWORD0_0_
from "SCHEMA_NAME"."TABLE_NAME" as this_
是否有任何人知道,我需要做些什么改变才能为PogreSQL制定正确的标准?
我在申请中建立了必要的邮政数据来源。
<!-- Use Spring annotations -->
<context:annotation-config />
<!-- postgreSQL datasource -->
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">
<property name="driverClassName" value="org.postgresql.Driver" />
<property name="url"
value="jdbc:postgresql://localhost/DB_NAME:5432/SCHEMA_NAME" />
<property name="username" value="postgres" />
<property name="password" value="password" />
<property name="defaultAutoCommit" value="false" />
</bean>
在同一个档案中,我设立了“SQL”透视厂:
<!-- Hibernate session factory -->
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="annotatedClasses">
<list>
<value>com.myPackage.dbEntities.domain.User</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</prop>
<prop key="hibernate.show_sql">true</prop>
</props>
</property>
</bean>
<!-- setup transaction manager -->
<bean id="transactionManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory">
<ref bean="sessionFactory" />
</property>
</bean>
最后,我对表上域类别进行测绘的方式是:
@Entity
@Table(name = "`TABLE_NAME`")
public class User {
@Id
@Column(name = "USERNAME")
private String username;
Has anyone encountered a similar error?. Any help in solving this issue will be much appreciated. Please note that question is different to post Cannot simply use PostgreSQL table name (”relation does not exist”)
长期职位的候选人。