Reputation: 1373
I am using Spring Boot, JPA and Postgres and I have one database with multiple schemas. I implement a web service using JPA and I receive this error:
o.h.engine.jdbc.spi.SqlExceptionHelper : ERROR: cross-database references are not implemented: "kaloudia_db_v2.enumeration.unit"
Do you know any way to overcome this error?
My class is
@Entity
@Table(name = "unit", schema = "enumeration", catalog = kaloudia_db_v2")
@XmlRootElement
@NamedQueries({
@NamedQuery(name = "Unit.findAll", query = "SELECT u FROM Unit u"),
@NamedQuery(name = "Unit.findById", query = "SELECT u FROM Unit u WHERE u.id = :id"),
@NamedQuery(name = "Unit.findByNameEn", query = "SELECT u FROM Unit u WHERE u.nameEn = :nameEn"),
@NamedQuery(name = "Unit.findByNameEl", query = "SELECT u FROM Unit u WHERE u.nameEl = :nameEl")})
public class Unit implements Serializable {
private static final long serialVersionUID = 1L;
@Id
and call of JPA function is:
public Object getAllUnits() {
List<Unit> units = unitRepository.findAll();
return units;
}
Upvotes: 1
Views: 2182
Reputation: 1373
As Jack said, I saw the application properties file and I found out that I forgot to change spring.datasource.url property!!
I am sorry for my question! It works fine now!
Upvotes: 1