Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/svn/5.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
Spring boot Spring引导,获取用于将db extract映射到POJO的查询_Spring Boot - Fatal编程技术网

Spring boot Spring引导,获取用于将db extract映射到POJO的查询

Spring boot Spring引导,获取用于将db extract映射到POJO的查询,spring-boot,Spring Boot,我想知道是否有办法知道Spring Boot创建的查询从数据库中提取数据。详细说明:鉴于Spring Boot需要将POJO映射到数据库中的多个表,它如何创建关节以提供结果JSON?有没有办法在日志中查看它生成的查询?您可以在application.properties中添加以下配置以查看Spring Boot/Hibernate生成的查询 spring.jpa.show-sql=true spring.jpa.properties.hibernate.show_sql=true hiberna

我想知道是否有办法知道Spring Boot创建的查询从数据库中提取数据。详细说明:鉴于Spring Boot需要将POJO映射到数据库中的多个表,它如何创建关节以提供结果JSON?有没有办法在日志中查看它生成的查询?

您可以在application.properties中添加以下配置以查看Spring Boot/Hibernate生成的查询

spring.jpa.show-sql=true
spring.jpa.properties.hibernate.show_sql=true
hibernate.show_sql=true
hibernate.format_sql=true
logging.level.org.hibernate.SQL=DEBUG
logging.level.org.hibernate.type.descriptor.sql.BasicBinder=TRACE
spring.jpa.properties.hibernate.format_sql=true
spring.jpa.properties.*=true
您可以在控制台中看到查询。在这里我分享一个例子

2019-07-10 11:46:38:823 [http-nio-8080-exec-7] DEBUG org.hibernate.SQL - 
    select
        * 
    from
        user 
    where
        statusenable=true
Hibernate: 
    select
        * 
    from
        user 
    where
        statusenable=true
如果您已将参数传递给查询,您也可以看到它(最后一行)


您可以在application.properties中添加以下配置,以查看Spring Boot/Hibernate生成的查询

spring.jpa.show-sql=true
spring.jpa.properties.hibernate.show_sql=true
hibernate.show_sql=true
hibernate.format_sql=true
logging.level.org.hibernate.SQL=DEBUG
logging.level.org.hibernate.type.descriptor.sql.BasicBinder=TRACE
spring.jpa.properties.hibernate.format_sql=true
spring.jpa.properties.*=true
您可以在控制台中看到查询。在这里我分享一个例子

2019-07-10 11:46:38:823 [http-nio-8080-exec-7] DEBUG org.hibernate.SQL - 
    select
        * 
    from
        user 
    where
        statusenable=true
Hibernate: 
    select
        * 
    from
        user 
    where
        statusenable=true
如果您已将参数传递给查询,您也可以看到它(最后一行)


是否要在日志中显示Spring Boot/Hibernate生成的查询?Spring JPA默认使用Hibernate触发查询。启用hibernate日志以查看查询。是否要在日志中显示Spring Boot/hibernate生成的查询?Spring JPA默认使用hibernate触发查询。启用hibernate日志以查看查询。