2014-02-27 2 views
0

1) 디스패처 - 서블릿org.hibernate.exception.GenericJDBCException : 오류 : 데이터베이스 간 참조는

<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"> 
    <property name="driverClassName" value="${driverClassName}"/> 
    <property name="url" value="${url}"/> 
    <property name="username" value="${username}"/> 
    <property name="password" value="${password}"/> 
</bean> 

<bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"> 
    <property name="dataSource" ref="dataSource"/> 
    <property name="configLocation"> 
     <value>classpath:hibernate.cfg.xml</value> 
    </property> 

    <property name="hibernateProperties"> 
     <props> 
      <prop key="hibernate.dialect">${dialect}</prop> 
      <prop key="hibernate.show_sql">true</prop> 
      <prop key="hibernate.default_catalog.null"></prop>  
     </props> 
    </property> 
</bean> 

2) database.properties

driverClassName=org.postgresql.Driver 
dialect=org.hibernate.dialect.PostgreSQLDialect 
url=jdbc:postgresql://192.168.1.20:5432/GSW 
username=postgres 
password=postgres 

3) 자바 클래스

를 구현되지 않습니다
@Entity 
@Table(name = "std_users_v", catalog = "GSW", schema = "public") 
@NamedQueries({ 
@NamedQuery(name = "StdUsersV.findAll", query = "SELECT s FROM StdUsersV s")}) 
public class StdUsersV implements Serializable { 
private static final long serialVersionUID = 1L; 
@Id 
@Column(name = "id") 
private Integer id; 
@Column(name = "user_group_id") 
private BigInteger userGroupId; 
@Size(max = 50) 
@Column(name = "user_name", length = 50) 
private String userName; 
@Size(max = 100) 
@Column(name = "password", length = 100) 
private String password; 
@Column(name = "org_unit_id") 
private BigInteger orgUnitId; 
@Column(name = "active_flag") 
private Boolean activeFlag; 
@Column(name = "start_date") 
@Temporal(TemporalType.TIMESTAMP) 
private Date startDate; 
@Column(name = "end_date") 
@Temporal(TemporalType.TIMESTAMP) 
private Date endDate; 
@Column(name = "created_by") 
private BigInteger createdBy; 
@Column(name = "creation_date") 
@Temporal(TemporalType.TIMESTAMP) 
private Date creationDate; 
@Column(name = "updated_by") 
private BigInteger updatedBy; 
@Column(name = "update_date") 
@Temporal(TemporalType.TIMESTAMP) 
private Date updateDate; 
@Size(max = 20) 
@Column(name = "user_group_name", length = 20) 
private String userGroupName; 
getters and setters... 

저는 PostgreSQL을 사용하고 있습니다. 내가 표 StdUserV.java에서 데이터를 가져 오기 위해 노력하고 있지만 내가 무엇입니까 다음과 같은 오류 -

org.hibernate.exception.GenericJDBCException: ERROR: cross-database references are not  implemented: "gsw.public.std_users_v" 

내가 주변에 검색 좀하고 난 gsw.public .std_users_v에서 굵은 텍스트를 제거하는 데 필요한 솔루션을 발견했다 (ie 카탈로그) 그러나 나는 그것을 어떻게 할 수 있는지 얻지 않고있다. "hibernate.default_catalog.null"속성은이 문제에 대한 하나의 노력이었습니다. 이 "상호 참조"문제에 대한 다른 솔루션도 환영합니다. 도와주세요.

@Table(name = "std_users_v") 
+0

표시하시기 바랍니다 자바 : 그것으로 끝이 카탈로그를 제거하지 않으면

Hibernate: select count(*) as col_0_0_ from public.std_users_v

속성 :

이 같은 접두사로 스키마를 사용하여 쿼리 결과 클래스, 매핑 및 어떻게 쿼리를 실행합니다. –

+0

업데이트 된 Java 클래스를 찾으십시오. – Viks

답변

1

발견 솔루션은 내가 봄 부팅이 포스트 그레스를 사용과 같은 문제가 있었다. 나는 당신이 단지 Table.catalog 속성을 제거해야한다는 것을 알았다. Postgres 데이터베이스에 여러 개의 스키마가있는 경우 스키마 속성을 그대로 두는 것이 좋습니다. ,,

Hibernate: select count(*) as col_0_0_ from GSW.public.std_users_v

ERROR: cross-database references are not implemented: "GSW.public.std_users_v"

0

대 changing-

@Table(name = "std_users_v", catalog = "GSW", schema = "public") 

관련 문제