1

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;
}
5
  • Please write application.properties file. Commented Jan 5, 2016 at 23:07
  • 2
    Postgres does not support catalogs (=database) as port of an identifier. You should remove the catalog=... attribute from the annotation. Commented Jan 5, 2016 at 23:40
  • @a_horse_with_no_name If I remove the catalogo=... , I receive this error ERROR: relation "enumeration.unit" does not exist Commented Jan 6, 2016 at 9:00
  • 1
    @jackk You are right my friend!! I forgot to change this property: spring.datasource.url=jdbc:postgresql://127.0.0.1:5432/kaloudia_db_v2 It works now!! Thank you and I am sorry. Commented Jan 6, 2016 at 9:03
  • @psmaster you are welcome . +1 :) Commented Jan 6, 2016 at 12:25

1 Answer 1

1

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!

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.