Hibernate query object SQL output

Discussion in 'Java' started by bb, Jul 21, 2005.

  1. bb

    bb Guest

    Hi,
    My team is using Hibernate. We are trying to get the Hibernate query
    object to output pure SQL, not stuff like the following:

    update T_CONTROL set id=?, max_order_number=?, max_requisition_number=?

    where row_id=?

    insert into T_CREDIT (id, vendor_id, amount, update_user,
    update_timestamp, status, note, reason, date_paid, isas_id)
    values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)

    In other words, get rid of the question marks and insert the ACTUAL
    values that are being used. This would make debugging SQL errors a lot
    easier.

    I'm sure other's have a similar problem. Any help would be greatly
    appreciated.
     
    bb, Jul 21, 2005
    #1
    1. Advertisements

  2. bb

    Guest

    I don't know what you mean ... but you can change log level in log4j:
    log4j.logger.org.hibernate.type=debug
    This didn't replace question mark but you will be able to see values.

    Greetings
    luc
     
    , Jul 21, 2005
    #2
    1. Advertisements

  3. bb

    Rico Guest

    On Thu, 21 Jul 2005 10:28:43 -0700, bb wrote:
    > Hi,
    > My team is using Hibernate. We are trying to get the Hibernate query
    > object to output pure SQL, not stuff like the following:
    >
    > update T_CONTROL set id=?, max_order_number=?, max_requisition_number=?
    >
    > where row_id=?
    >
    > insert into T_CREDIT (id, vendor_id, amount, update_user,
    > update_timestamp, status, note, reason, date_paid, isas_id)
    > values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
    >
    > In other words, get rid of the question marks and insert the ACTUAL
    > values that are being used. This would make debugging SQL errors a lot
    > easier.
    >
    > I'm sure other's have a similar problem. Any help would be greatly
    > appreciated.


    humm... as luc mentioned, you can see the values being bound to the
    parameters by adjusting the debug level.

    for my part, I'd say that if I wanted to be debugging SQL errors, I
    wouldn't be using Hibernate.

    Rico.
     
    Rico, Jul 22, 2005
    #3
  4. bb

    Hemal Pandya Guest

    bb wrote:
    > In other words, get rid of the question marks and insert the ACTUAL
    > values that are being used. This would make debugging SQL errors a lot
    > easier.
    >


    Look for p6spy which provides a jdbc driver that logs the SQL
    statements being executed. I found it very useful. While looking for
    information on p6spy I just came across
    http://www.informit.com/articles/article.asp?p=353736&rl=1 which you
    may find relevant.
     
    Hemal Pandya, Jul 22, 2005
    #4
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ilias Lazaridis
    Replies:
    0
    Views:
    1,999
    Ilias Lazaridis
    Dec 27, 2004
  2. Replies:
    0
    Views:
    4,166
  3. Anonymous
    Replies:
    0
    Views:
    1,921
    Anonymous
    Oct 13, 2005
  4. jstorta
    Replies:
    1
    Views:
    12,284
  5. ZelluX
    Replies:
    1
    Views:
    3,225
    Arne Vajhøj
    Jun 7, 2008
  6. Eleanna Skouta
    Replies:
    2
    Views:
    9,236
    Arne Vajhøj
    Dec 9, 2008
  7. Amit Jain
    Replies:
    7
    Views:
    3,808
    Amit Jain
    Apr 27, 2009
  8. Philip McCracken

    SQL Query Causing Inifinate Output

    Philip McCracken, Jun 21, 2004, in forum: ASP General
    Replies:
    0
    Views:
    141
    Philip McCracken
    Jun 21, 2004
Loading...