1

how to write hibernate sql queries log in log file with values.

Example:-

Now print queries :-

 select
        employee0_.id as id1_0_0_,
        employee0_.age as age2_0_0_,
        employee0_.dept as dept3_0_0_,
        employee0_.lname as lname4_0_0_,
        employee0_.name as name5_0_0_,
        employee0_.salary as salary6_0_0_ 
    from
        employee employee0_ 
    where
        employee0_.id=?

but there is print question mark in last line.
i want to print like :-

 select
    employee0_.id as id1_0_0_,
    employee0_.age as age2_0_0_,
    employee0_.dept as dept3_0_0_,
    employee0_.lname as lname4_0_0_,
    employee0_.name as name5_0_0_,
    employee0_.salary as salary6_0_0_ 
from
    employee employee0_ 
where
    employee0_.id=1
Hitesh
  • 271
  • 2
  • 5
  • 18
  • 1
    @i.bondarenko but in this link print separate log for values , i want to print values where question mark in log file. – Hitesh Sep 16 '19 at 09:20
  • 1
    From the answer `# Logs the JDBC parameters passed to a query log4j.logger.org.hibernate.type=trace ` – i.bondarenko Sep 16 '19 at 09:21
  • 1
    @Hitesh, `i.bondarenko` has answered your question. – Buhake Sindi Sep 16 '19 at 09:22
  • 1
    @BuhakeSindi I did not get my answer because of there is print separate values in log file like :- `6908 --- [nio-8088-exec-2] o.h.type.descriptor.sql.BasicBinder : binding parameter [1] as [INTEGER] - [9] ` – Hitesh Sep 16 '19 at 09:27
  • @Hitesh, that is Hibernate specific implementation. You will have query with the Hibernate Dev team (RedHat) to check how to possibly do it. – Buhake Sindi Sep 17 '19 at 08:20

0 Answers0