2017-05-25 59 views
1

我加入到我的Jhipster申请一个新的连接:显示SQL在Jhipster 4.4.1

data: 
    mongodb: 
     uri: mongodb://localhost:27017 
     database: crm 
datasources:  
    elser: 
     driver-class-name: org.postgresql.Driver 
     url: jdbc:postgresql://localhost:5432/elser 
     name: elser 
     username: elser 
     password: elser 

我想在我的Postgres到连接生成SQL日志来查看。

我已经在 '应用程序dev.yml' 加入以下代码测试:

jpa: 
    properties: 
    hibernate: 
     show_sql: true 
     format_sql: true 

或:

jpa: 
    show_sql: true 
    format_sql: true 

但无论是选择为我工作。

有人可以帮助我。

谢谢

回答

3

根据春天文档设置spring.jpa.show-sql=true应该做的伎俩。 你检查过它是否出现在stdout中?

从春天启动文档:

# JPA (JpaBaseConfiguration, HibernateJpaAutoConfiguration) 
spring.data.jpa.repositories.enabled=true # Enable JPA repositories. 
spring.jpa.database= # Target database to operate on, auto-detected by default. Can be alternatively set using the "databasePlatform" property. 
spring.jpa.database-platform= # Name of the target database to operate on, auto-detected by default. Can be alternatively set using the "Database" enum. 
spring.jpa.generate-ddl=false # Initialize the schema on startup. 
spring.jpa.hibernate.ddl-auto= # DDL mode. This is actually a shortcut for the "hibernate.hbm2ddl.auto" property. Default to "create-drop" when using an embedded database, "none" otherwise. 
spring.jpa.hibernate.naming.implicit-strategy= # Hibernate 5 implicit naming strategy fully qualified name. 
spring.jpa.hibernate.naming.physical-strategy= # Hibernate 5 physical naming strategy fully qualified name. 
spring.jpa.hibernate.naming.strategy= # Hibernate 4 naming strategy fully qualified name. Not supported with Hibernate 5. 
spring.jpa.hibernate.use-new-id-generator-mappings= # Use Hibernate's newer IdentifierGenerator for AUTO, TABLE and SEQUENCE. 
spring.jpa.open-in-view=true # Register OpenEntityManagerInViewInterceptor. Binds a JPA EntityManager to the thread for the entire processing of the request. 
spring.jpa.properties.*= # Additional native properties to set on the JPA provider. 
spring.jpa.show-sql=false # Enable logging of SQL statements.