Working in a JPA project, I had this error:
javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not extract ResultSet
....
Caused by: org.postgresql.util.PSQLException: ERROR: relation .. does not exist
This error can appear if you are working with two schema in your database. If you are declaring a persistence.xml with only one persistence-unit, there will be an ambiguity as Hibernate will not know the schema on which you are working.
So to resolve this, one possible solution is to add schema name in you entity.
@Entity
@Table(name = "my_table", schema="schema_one")
public class MyTable implements java.io.Serializable
javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not extract ResultSet
....
Caused by: org.postgresql.util.PSQLException: ERROR: relation .. does not exist
This error can appear if you are working with two schema in your database. If you are declaring a persistence.xml with only one persistence-unit, there will be an ambiguity as Hibernate will not know the schema on which you are working.
So to resolve this, one possible solution is to add schema name in you entity.
@Entity
@Table(name = "my_table", schema="schema_one")
public class MyTable implements java.io.Serializable
This comment has been removed by a blog administrator.
ReplyDelete