FAQ
So... I'm very annoyed today with one of out beloved developers...

Due to some "security" measures (in fact it was a political issue) we had to
do a database refresh and upgrade all in one step using expdp. It's not all
that bad, but the dev team that is supposed to use the new database is
having a lot of trouble with the new DB (everything from synonyms to grants
had to be reviewed, thank god for TOAD's "compare database" feature).

The problem is that the database was refreshed from the production DB and
the old dev DB had a few modifications, so basically now they are having
trouble with the dev version of the app (missing columns/tables?).

The app is a java monster that uses hibernate to connect to Oracle (did I
ever mention my aversion to frameworks?) and when I asked exactly WHAT table
was missing the dev team didn't seem to have an answer, all they are getting
is ORA-942... so I asked for the SQL Query and the reply was that they are
using hibernate and that it doesn't allow them to see the queries.

I honestly know very little about java and even less about hibernate, but
there must be a way to see this (other that tracing the session)... so my
question to those of you who know hibernate or work with hibernate is how do
you see what query the framework is executing?

and if hibernate doesn't actually have a way to easily log what its doing...
well I'm amazed that anyone would choose it for production use.

thanks :-)
Alan.-

Search Discussions

  • Anonymous at Jul 28, 2011 at 2:52 pm
    Alan,

    When this happens here, I trace the session and capture the sql in the log file. Probably the quickest way to discover what's missing if you do not have a log of database changes that were made.

    Hope this helps.

    Tom

    From: oracle-l-bounce_at_freelists.org On Behalf Of Guillermo Alan Bort
    Sent: Thursday, July 28, 2011 10:47 AM
    To: oracle-l-freelists
    Subject: Question for Java developers on Hibernate

    So... I'm very annoyed today with one of out beloved developers...

    Due to some "security" measures (in fact it was a political issue) we had to do a database refresh and upgrade all in one step using expdp. It's not all that bad, but the dev team that is supposed to use the new database is having a lot of trouble with the new DB (everything from synonyms to grants had to be reviewed, thank god for TOAD's "compare database" feature).

    The problem is that the database was refreshed from the production DB and the old dev DB had a few modifications, so basically now they are having trouble with the dev version of the app (missing columns/tables?).

    The app is a java monster that uses hibernate to connect to Oracle (did I ever mention my aversion to frameworks?) and when I asked exactly WHAT table was missing the dev team didn't seem to have an answer, all they are getting is ORA-942... so I asked for the SQL Query and the reply was that they are using hibernate and that it doesn't allow them to see the queries.

    I honestly know very little about java and even less about hibernate, but there must be a way to see this (other that tracing the session)... so my question to those of you who know hibernate or work with hibernate is how do you see what query the framework is executing?

    and if hibernate doesn't actually have a way to easily log what its doing... well I'm amazed that anyone would choose it for production use.

    thanks :-)
    Alan.-
  • Ingrid Voigt at Jul 28, 2011 at 3:41 pm
    Hi,

    try the following trigger. It catches the error-causing SQL by inserting
    a table.

    Simple version:
    http://www.adp-gmbh.ch/ora/sql/trigger/servererror.html

    Slightly more fancy version:
    http://blog.sydoracle.com/2011/02/using-oracles-servererror-to-catch.html

    Best regards
    Ingrid
    On 28.07.2011 16:47, Guillermo Alan Bort wrote:
    So... I'm very annoyed today with one of out beloved developers...

    Due to some "security" measures (in fact it was a political issue) we
    had to do a database refresh and upgrade all in one step using expdp.
    It's not all that bad, but the dev team that is supposed to use the new
    database is having a lot of trouble with the new DB (everything from
    synonyms to grants had to be reviewed, thank god for TOAD's "compare
    database" feature).

    The problem is that the database was refreshed from the production DB
    and the old dev DB had a few modifications, so basically now they are
    having trouble with the dev version of the app (missing columns/tables?).

    The app is a java monster that uses hibernate to connect to Oracle (did
    I ever mention my aversion to frameworks?) and when I asked exactly WHAT
    table was missing the dev team didn't seem to have an answer, all they
    are getting is ORA-942... so I asked for the SQL Query and the reply was
    that they are using hibernate and that it doesn't allow them to see the
    queries.

    I honestly know very little about java and even less about hibernate,
    but there must be a way to see this (other that tracing the session)...
    so my question to those of you who know hibernate or work with hibernate
    is how do you see what query the framework is executing?

    and if hibernate doesn't actually have a way to easily log what its
    doing... well I'm amazed that anyone would choose it for production use.

    thanks :-)
    Alan.-
    --
    http://www.freelists.org/webpage/oracle-l
  • Priit Piipuu at Jul 28, 2011 at 3:58 pm

    On Thu, Jul 28, 2011 at 5:47 PM, Guillermo Alan Bort wrote:

    so I asked for the SQL Query and the reply was that they are
    using hibernate and that it doesn't allow them to see the queries.
    This is not true, see for example
    http://docs.jboss.org/hibernate/core/3.6/reference/en-US/html/session-configuration.html#configuration-logging
    This feature is present in the older versions as well. IIRC it even
    logs failing queries with actual errors :)
  • Blanchard, William G at Jul 28, 2011 at 4:00 pm
    This has everything to do with lazy or incompetent developers and
    nothing to do with Java or Hibernate. You can log the sql statements
    using log4j or via a configuration property.





    WGB



    From: oracle-l-bounce_at_freelists.org
    On Behalf Of Guillermo Alan Bort
    Sent: Thursday, July 28, 2011 9:47 AM
    To: oracle-l-freelists
    Subject: Question for Java developers on Hibernate



    So... I'm very annoyed today with one of out beloved developers...

    Due to some "security" measures (in fact it was a political issue) we
    had to do a database refresh and upgrade all in one step using expdp.
    It's not all that bad, but the dev team that is supposed to use the new
    database is having a lot of trouble with the new DB (everything from
    synonyms to grants had to be reviewed, thank god for TOAD's "compare
    database" feature).

    The problem is that the database was refreshed from the production DB
    and the old dev DB had a few modifications, so basically now they are
    having trouble with the dev version of the app (missing
    columns/tables?).

    The app is a java monster that uses hibernate to connect to Oracle (did
    I ever mention my aversion to frameworks?) and when I asked exactly WHAT
    table was missing the dev team didn't seem to have an answer, all they
    are getting is ORA-942... so I asked for the SQL Query and the reply was
    that they are using hibernate and that it doesn't allow them to see the
    queries.

    I honestly know very little about java and even less about hibernate,
    but there must be a way to see this (other that tracing the session)...
    so my question to those of you who know hibernate or work with hibernate
    is how do you see what query the framework is executing?

    and if hibernate doesn't actually have a way to easily log what its
    doing... well I'm amazed that anyone would choose it for production use.

    thanks :-)
    Alan.-

    The information contained in this message is proprietary and/or confidential. If you are not the intended recipient, please: (i) delete the message and all copies; (ii) do not disclose, distribute or use the message in any manner; and (iii) notify the sender immediately. In addition, please be aware that any message addressed to our domain is subject to archiving and review by persons other than the intended recipient. Thank you.
  • David Fitzjarrell at Jul 28, 2011 at 5:32 pm
    I use this in a dev environment to catch errors and sql text:

    CREATE TABLE stats$error_log (
    err_dt          TIMESTAMP,
    db_user         VARCHAR2(30),
    msg_stack       VARCHAR2(2000),
    sqltxt          VARCHAR2(1000))
    tablespace users;

    CREATE OR REPLACE TRIGGER log_server_errors
    AFTER SERVERERROR
    ON DATABASE
    DECLARE
    v_sqltext VARCHAR2(1000);
    nl_sqltext ora_name_list_t;
    BEGIN
    -- Capture entire error text
    FOR i IN 1 .. ora_sql_txt(nl_sqltext) LOOP
    v_sqltext := v_sqltext || nl_sqltext(i);
    END LOOP;
    INSERT INTO STATS$ERROR_LOG
    (err_dt, db_user, msg_stack, sqltxt)
    VALUES
    (systimestamp,
    sys.login_user,
    dbms_utility.format_error_stack, v_sqltext);
    END log_server_errors;
    /

    You can change the tablespace to one that's convenient to use (in our environment USERS is there but unused).

    David Fitzjarrell

    From: "Blanchard, William G"
    To: cicciuxdba_at_gmail.com; oracle-l-freelists
    Sent: Thursday, July 28, 2011 9:00 AM
    Subject: RE: Question for Java developers on Hibernate

    This has everything to do with lazy or incompetent developers and nothing to do with Java or Hibernate.  You can log the sql statements using log4j or via a configuration property.


    WGB

    From:oracle-l-bounce_at_freelists.org On Behalf Of Guillermo Alan Bort
    Sent: Thursday, July 28, 2011 9:47 AM
    To: oracle-l-freelists
    Subject: Question for Java developers on Hibernate

    So... I'm very annoyed today with one of out beloved developers...

    Due to some "security" measures (in fact it was a political issue) we had to do a database refresh and upgrade all in one step using expdp. It's not all that bad, but the dev team that is supposed to use the new database is having a lot of trouble with the new DB (everything from synonyms to grants had to be reviewed, thank god for TOAD's "compare database" feature).

    The problem is that the database was refreshed from the production DB and the old dev DB had a few modifications, so basically now they are having trouble with the dev version of the app (missing columns/tables?).

    The app is a java monster that uses hibernate to connect to Oracle (did I ever mention my aversion to frameworks?) and when I asked exactly WHAT table was missing the dev team didn't seem to have an answer, all they are getting is ORA-942... so I asked for the SQL Query and the reply was that they are using hibernate and that it doesn't allow them to see the queries.

    I honestly know very little about java and even less about hibernate, but there must be a way to see this (other that tracing the session)... so my question to those of you who know hibernate or work with hibernate is how do you see what query the framework is executing?

    and if hibernate doesn't actually have a way to easily log what its doing... well I'm amazed that anyone would choose it for production use.

    thanks :-)
    Alan.-
    _____________

    The information contained in this message is proprietary and/or confidential. If you are not the intended recipient, please: (i) delete the message and all copies; (ii) do not disclose, distribute or use the message in any manner; and (iii) notify the sender immediately. In addition, please be aware that any message addressed to our domain is subject to archiving and review by persons other than the intended recipient. Thank you.
    _____________
  • Anthony Ballo at Jul 28, 2011 at 5:48 pm
    Is it possible to return the column's name when the contents is NULL? I've looked at FInd_String but was wondering if someone had a (better) way?

    Thanks,

    Anthony
  • Michael Moore at Jul 28, 2011 at 7:59 pm
    select nvl(mycol,'MYCOL') from mytable;

    On Thu, Jul 28, 2011 at 10:48 AM, Anthony Ballo
    wrote:
    Is it possible to return the column's name when the contents is NULL? I've
    looked at FInd_String but was wondering if someone had a (better) way?


    Thanks,

    Anthony

    --
    http://www.freelists.org/webpage/oracle-l
  • Fergal Taheny at Jul 28, 2011 at 6:55 pm
    Hi,

    "Audit not exist" is a very handy feature for this.

    Regards
    Fergal
    On 28 Jul 2011 15:48, "Guillermo Alan Bort" wrote:

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouporacle-l @
categoriesoracle
postedJul 28, '11 at 2:47p
activeJul 28, '11 at 7:59p
posts9
users9
websiteoracle.com

People

Translate

site design / logo © 2022 Grokbase