Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/401.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Spring Boot-如何设置PostgreSQL的默认模式?_Java_Spring_Hibernate_Postgresql - Fatal编程技术网

Java Spring Boot-如何设置PostgreSQL的默认模式?

Java Spring Boot-如何设置PostgreSQL的默认模式?,java,spring,hibernate,postgresql,Java,Spring,Hibernate,Postgresql,我当前在我的应用程序.properties文件中执行的操作是: spring.datasource.url=jdbc:postgresql://localhost:5432/myDB?currentSchema=mySchema 这里不是还有别的地方吗?由于它看起来很粗糙,并且根据一篇帖子(仍然发现链接,很抱歉,稍后会更新),因此它只适用于PostgreSQL 9.4。您可以尝试为jdbc用户设置默认模式 (一) 将用户名称集搜索路径更改为“架构” 2) 你试过这个酒店吗? spring.da

我当前在我的
应用程序.properties
文件中执行的操作是:

spring.datasource.url=jdbc:postgresql://localhost:5432/myDB?currentSchema=mySchema

这里不是还有别的地方吗?由于它看起来很粗糙,并且根据一篇帖子(仍然发现链接,很抱歉,稍后会更新),因此它只适用于PostgreSQL 9.4。

您可以尝试为jdbc用户设置默认模式

(一) 将用户名称集搜索路径更改为“架构”

2) 你试过这个酒店吗? spring.datasource.schema


由于这是一个非常古老的问题,而且还没有正确的答案,因此要设置的正确属性如下:

spring.jpa.properties.hibernate.default_schema=yourschema

谢谢你!我尝试了这个方法,但我尽可能地想在我的应用程序中的某个地方设置它(我也不想在某个地方执行sql文件)。那么JDBC配置呢,而不是JPA?设置currentSchema=mySchema for JDBCTemplate不起作用。我用的是postgres 12。