springフレームワークを使ってPostgresにアクセスしているのですが、
publicにしか接続できず困っています。
接続設定はapplication.propertiesに
spring.datasource.url=jdbc:postgresql:/localhost:5432/test
spring.datasource.username=postgres
spring.datasource.password=postgres
を記載し
entityに
@Table(name="f_log") public class FLog implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy=GenerationType.IDENTITY) @Column(name="log_no") private BigDecimal logNo; }
daoに
@Transactional @Repository public class FLogDAO { @PersistenceContext private EntityManager entityManager; public FLog get(String logNo) { return entityManager.find(FLog.class, logNo); } }
と書いています。
このテーブルはpublicではなく、logスキーマなので
org.postgresql.util.PSQLException: ERROR: relation "f_log" does not exist
となってしまいます。
どうすればアクセスできるでしょうか?
スキーマ内で同じテーブルはないため、
最初に
set search_path to public,log;
と投げれる形でもよいのですが。
回答3件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。