You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "Catalina Wei (JIRA)" <ji...@apache.org> on 2010/03/19 03:51:27 UTC

[jira] Created: (OPENJPA-1585) Additional trace to relate SQL pushdowns with entity action or JPQL query

Additional trace to relate SQL pushdowns with entity action or JPQL query
-------------------------------------------------------------------------

                 Key: OPENJPA-1585
                 URL: https://issues.apache.org/jira/browse/OPENJPA-1585
             Project: OpenJPA
          Issue Type: Improvement
    Affects Versions: 2.0.0
            Reporter: Catalina Wei
            Assignee: Catalina Wei
            Priority: Trivial


Additional trace can help users understand and relate query or entity actions with SQL pushdowns:
1.  why SQL pushdown has JOINs that are generated, a trace dumping out eager relations for the generated SQL is very helpful.
2. a JPQL or a simple em.find() generated caused more than one SQL requests.
3. entity instance actions (INSERT, UPDATE, DELETE) generated SQL

Examples:
1. JOIN is generated because of the eager relation 'entitya':
4891  p1  TRACE  [main] openjpa.Query - Executing query: select s from CascadeB s
4906  p1  TRACE  [main] openjpa.jdbc.Extra - Eager relations: [test.entities.CascadeB.entitya]
5141  p1  TRACE  [main] openjpa.jdbc.SQL - <t 26882784, conn 9493> executing prepstmnt 25862088 SELECT t0.id, t1.id, t1.name, t0.name FROM CascadeB t0 LEFT OUTER JOIN CascadeA t1 ON t0.ENTITYA_ID = t1.id 

2. flush for new instance of entity action:
7250  p1  TRACE  [main] openjpa.jdbc.Extra - flush: org.apache.openjpa.kernel.PNewState for oid=1
7250  p1  TRACE  [main] openjpa.jdbc.SQL -: INSERT INTO BasicA (age,id,name) VALUES (?,?,?) [1,1,name1]

2: loading relation 'entitya':
7734  p1  TRACE  [main] openjpa.jdbc.Extra - load field: 'entitya' for oid=1 class test.entities.BasicB
7734  p1  TRACE  [main] openjpa.jdbc.Extra - find: oid=1 class test.entities.BasicA
7734  p1  TRACE  [main] openjpa.jdbc.Extra - getInitializeStateResult: oid=1 class test.entities.BasicA
7969  pdq1  TRACE  [main] openjpa.jdbc.SQL - <t 26882784, conn 3125250> executing prepstmnt 28008463 SELECT t0.name FROM BasicA t0 WHERE t0.id = ?  optimize for 1 row [params=(int) 1]




-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Re: [jira] Updated: (OPENJPA-1585) Additional trace to relate SQL pushdowns with entity action or JPQL query

Posted by Albert Lee <al...@gmail.com>.
Sounds good.

Albert Lee.

On Fri, Mar 19, 2010 at 1:24 PM, catalina wei <ca...@gmail.com>wrote:

> Hi Albert,
> thanks for your input.
> I will auto-enable SQL trace when this trace is enabled.
> BTW,
> I am changing the the name 'Extra' to 'DIAG'.
>
> If you there no objections, I will commit the patch.
>
> Catalina
>
> On Thu, Mar 18, 2010 at 8:27 PM, Albert Lee <al...@gmail.com> wrote:
>
> > >> It would only make sense to turn on Extra trace when Query and SQL
> > traces
> > are also turned on.
> >
> > Shouldn't we automatically enable the SQL log at the same level as Extra
> if
> > it is specified alone.
> >
> > Albert Lee.
> >
> > On Thu, Mar 18, 2010 at 10:01 PM, Catalina Wei (JIRA) <jira@apache.org
> > >wrote:
> >
> > >
> > >     [
> > >
> >
> https://issues.apache.org/jira/browse/OPENJPA-1585?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
> > ]
> > >
> > > Catalina Wei updated OPENJPA-1585:
> > > ----------------------------------
> > >
> > >    Attachment: OPENJPA-1585.patch
> > >
> > > In this patch, a trace channel named 'openjpa.jdbc.Extra' is defined
> for
> > > getting additional trace information that may help users relate the
> SQLs
> > > generated to entity activities or JPQL queries.
> > >
> > > To turn on this trace, add as below:
> > >
> > >    <property name="openjpa.Log"
> > value="Query=TRACE,SQL=TRACE,Extra=TRACE"/>
> > >
> > > It would only make sense to turn on Extra trace when Query and SQL
> traces
> > > are also turned on.
> > >
> > > > Additional trace to relate SQL pushdowns with entity action or JPQL
> > query
> > > >
> > -------------------------------------------------------------------------
> > > >
> > > >                 Key: OPENJPA-1585
> > > >                 URL:
> > https://issues.apache.org/jira/browse/OPENJPA-1585
> > > >             Project: OpenJPA
> > > >          Issue Type: Improvement
> > > >    Affects Versions: 2.0.0
> > > >            Reporter: Catalina Wei
> > > >            Assignee: Catalina Wei
> > > >            Priority: Trivial
> > > >         Attachments: OPENJPA-1585.patch
> > > >
> > > >
> > > > Additional trace can help users understand and relate query or entity
> > > actions with SQL pushdowns:
> > > > 1.  why SQL pushdown has JOINs that are generated, a trace dumping
> out
> > > eager relations for the generated SQL is very helpful.
> > > > 2. a JPQL or a simple em.find() generated caused more than one SQL
> > > requests.
> > > > 3. entity instance actions (INSERT, UPDATE, DELETE) generated SQL
> > > > Examples:
> > > > 1. JOIN is generated because of the eager relation 'entitya':
> > > > 4891  p1  TRACE  [main] openjpa.Query - Executing query: select s
> from
> > > CascadeB s
> > > > 4906  p1  TRACE  [main] openjpa.jdbc.Extra - Eager relations:
> > > [test.entities.CascadeB.entitya]
> > > > 5141  p1  TRACE  [main] openjpa.jdbc.SQL - <t 26882784, conn 9493>
> > > executing prepstmnt 25862088 SELECT t0.id, t1.id, t1.name, t0.nameFROM
> > > CascadeB t0 LEFT OUTER JOIN CascadeA t1 ON t0.ENTITYA_ID = t1.id
> > > > 2. flush for new instance of entity action:
> > > > 7250  p1  TRACE  [main] openjpa.jdbc.Extra - flush:
> > > org.apache.openjpa.kernel.PNewState for oid=1
> > > > 7250  p1  TRACE  [main] openjpa.jdbc.SQL -: INSERT INTO BasicA
> > > (age,id,name) VALUES (?,?,?) [1,1,name1]
> > > > 2: loading relation 'entitya':
> > > > 7734  p1  TRACE  [main] openjpa.jdbc.Extra - load field: 'entitya'
> for
> > > oid=1 class test.entities.BasicB
> > > > 7734  p1  TRACE  [main] openjpa.jdbc.Extra - find: oid=1 class
> > > test.entities.BasicA
> > > > 7734  p1  TRACE  [main] openjpa.jdbc.Extra -
> getInitializeStateResult:
> > > oid=1 class test.entities.BasicA
> > > > 7969  pdq1  TRACE  [main] openjpa.jdbc.SQL - <t 26882784, conn
> 3125250>
> > > executing prepstmnt 28008463 SELECT t0.name FROM BasicA t0 WHERE t0.id=
> > ?
> > >  optimize for 1 row [params=(int) 1]
> > >
> > > --
> > > This message is automatically generated by JIRA.
> > > -
> > > You can reply to this email to add a comment to the issue online.
> > >
> > >
> >
> >
> > --
> > Albert Lee.
> >
>



-- 
Albert Lee.

Re: [jira] Updated: (OPENJPA-1585) Additional trace to relate SQL pushdowns with entity action or JPQL query

Posted by catalina wei <ca...@gmail.com>.
Albert,
openjpa.jdbc.SQLDiag sounds good. I will use that.
I found out auto-enabling SQL trace channel is not possible for Logs that
are not using openjpa.
A good exmple is com.ibm.ws.jpa.management.TraceLogChannel which implements
Log interface, but there is no public method to enable trace.
So, it will be users choice to turn on SQL and SQLDiag traces.

Catalina

On Fri, Mar 19, 2010 at 12:15 PM, Albert Lee <al...@gmail.com> wrote:

> Another thought.....
>
> Would openjpa.jdbc.SQLDiag or openjpa.jdbc.SQL.DIAG a better name depicts
> its intention and associate it to the SQL channel?
>
> Albert Lee.
>
> On Fri, Mar 19, 2010 at 1:24 PM, catalina wei <catalina.wei@gmail.com
> >wrote:
>
> > Hi Albert,
> > thanks for your input.
> > I will auto-enable SQL trace when this trace is enabled.
> > BTW,
> > I am changing the the name 'Extra' to 'DIAG'.
> >
> > If you there no objections, I will commit the patch.
> >
> > Catalina
> >
> > On Thu, Mar 18, 2010 at 8:27 PM, Albert Lee <al...@gmail.com> wrote:
> >
> > > >> It would only make sense to turn on Extra trace when Query and SQL
> > > traces
> > > are also turned on.
> > >
> > > Shouldn't we automatically enable the SQL log at the same level as
> Extra
> > if
> > > it is specified alone.
> > >
> > > Albert Lee.
> > >
> > > On Thu, Mar 18, 2010 at 10:01 PM, Catalina Wei (JIRA) <jira@apache.org
> > > >wrote:
> > >
> > > >
> > > >     [
> > > >
> > >
> >
> https://issues.apache.org/jira/browse/OPENJPA-1585?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
> > > ]
> > > >
> > > > Catalina Wei updated OPENJPA-1585:
> > > > ----------------------------------
> > > >
> > > >    Attachment: OPENJPA-1585.patch
> > > >
> > > > In this patch, a trace channel named 'openjpa.jdbc.Extra' is defined
> > for
> > > > getting additional trace information that may help users relate the
> > SQLs
> > > > generated to entity activities or JPQL queries.
> > > >
> > > > To turn on this trace, add as below:
> > > >
> > > >    <property name="openjpa.Log"
> > > value="Query=TRACE,SQL=TRACE,Extra=TRACE"/>
> > > >
> > > > It would only make sense to turn on Extra trace when Query and SQL
> > traces
> > > > are also turned on.
> > > >
> > > > > Additional trace to relate SQL pushdowns with entity action or JPQL
> > > query
> > > > >
> > >
> -------------------------------------------------------------------------
> > > > >
> > > > >                 Key: OPENJPA-1585
> > > > >                 URL:
> > > https://issues.apache.org/jira/browse/OPENJPA-1585
> > > > >             Project: OpenJPA
> > > > >          Issue Type: Improvement
> > > > >    Affects Versions: 2.0.0
> > > > >            Reporter: Catalina Wei
> > > > >            Assignee: Catalina Wei
> > > > >            Priority: Trivial
> > > > >         Attachments: OPENJPA-1585.patch
> > > > >
> > > > >
> > > > > Additional trace can help users understand and relate query or
> entity
> > > > actions with SQL pushdowns:
> > > > > 1.  why SQL pushdown has JOINs that are generated, a trace dumping
> > out
> > > > eager relations for the generated SQL is very helpful.
> > > > > 2. a JPQL or a simple em.find() generated caused more than one SQL
> > > > requests.
> > > > > 3. entity instance actions (INSERT, UPDATE, DELETE) generated SQL
> > > > > Examples:
> > > > > 1. JOIN is generated because of the eager relation 'entitya':
> > > > > 4891  p1  TRACE  [main] openjpa.Query - Executing query: select s
> > from
> > > > CascadeB s
> > > > > 4906  p1  TRACE  [main] openjpa.jdbc.Extra - Eager relations:
> > > > [test.entities.CascadeB.entitya]
> > > > > 5141  p1  TRACE  [main] openjpa.jdbc.SQL - <t 26882784, conn 9493>
> > > > executing prepstmnt 25862088 SELECT t0.id, t1.id, t1.name,
> t0.nameFROM
> > > > CascadeB t0 LEFT OUTER JOIN CascadeA t1 ON t0.ENTITYA_ID = t1.id
> > > > > 2. flush for new instance of entity action:
> > > > > 7250  p1  TRACE  [main] openjpa.jdbc.Extra - flush:
> > > > org.apache.openjpa.kernel.PNewState for oid=1
> > > > > 7250  p1  TRACE  [main] openjpa.jdbc.SQL -: INSERT INTO BasicA
> > > > (age,id,name) VALUES (?,?,?) [1,1,name1]
> > > > > 2: loading relation 'entitya':
> > > > > 7734  p1  TRACE  [main] openjpa.jdbc.Extra - load field: 'entitya'
> > for
> > > > oid=1 class test.entities.BasicB
> > > > > 7734  p1  TRACE  [main] openjpa.jdbc.Extra - find: oid=1 class
> > > > test.entities.BasicA
> > > > > 7734  p1  TRACE  [main] openjpa.jdbc.Extra -
> > getInitializeStateResult:
> > > > oid=1 class test.entities.BasicA
> > > > > 7969  pdq1  TRACE  [main] openjpa.jdbc.SQL - <t 26882784, conn
> > 3125250>
> > > > executing prepstmnt 28008463 SELECT t0.name FROM BasicA t0 WHERE
> t0.id=
> > > ?
> > > >  optimize for 1 row [params=(int) 1]
> > > >
> > > > --
> > > > This message is automatically generated by JIRA.
> > > > -
> > > > You can reply to this email to add a comment to the issue online.
> > > >
> > > >
> > >
> > >
> > > --
> > > Albert Lee.
> > >
> >
>
>
>
> --
> Albert Lee.
>

Re: [jira] Updated: (OPENJPA-1585) Additional trace to relate SQL pushdowns with entity action or JPQL query

Posted by Albert Lee <al...@gmail.com>.
Another thought.....

Would openjpa.jdbc.SQLDiag or openjpa.jdbc.SQL.DIAG a better name depicts
its intention and associate it to the SQL channel?

Albert Lee.

On Fri, Mar 19, 2010 at 1:24 PM, catalina wei <ca...@gmail.com>wrote:

> Hi Albert,
> thanks for your input.
> I will auto-enable SQL trace when this trace is enabled.
> BTW,
> I am changing the the name 'Extra' to 'DIAG'.
>
> If you there no objections, I will commit the patch.
>
> Catalina
>
> On Thu, Mar 18, 2010 at 8:27 PM, Albert Lee <al...@gmail.com> wrote:
>
> > >> It would only make sense to turn on Extra trace when Query and SQL
> > traces
> > are also turned on.
> >
> > Shouldn't we automatically enable the SQL log at the same level as Extra
> if
> > it is specified alone.
> >
> > Albert Lee.
> >
> > On Thu, Mar 18, 2010 at 10:01 PM, Catalina Wei (JIRA) <jira@apache.org
> > >wrote:
> >
> > >
> > >     [
> > >
> >
> https://issues.apache.org/jira/browse/OPENJPA-1585?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
> > ]
> > >
> > > Catalina Wei updated OPENJPA-1585:
> > > ----------------------------------
> > >
> > >    Attachment: OPENJPA-1585.patch
> > >
> > > In this patch, a trace channel named 'openjpa.jdbc.Extra' is defined
> for
> > > getting additional trace information that may help users relate the
> SQLs
> > > generated to entity activities or JPQL queries.
> > >
> > > To turn on this trace, add as below:
> > >
> > >    <property name="openjpa.Log"
> > value="Query=TRACE,SQL=TRACE,Extra=TRACE"/>
> > >
> > > It would only make sense to turn on Extra trace when Query and SQL
> traces
> > > are also turned on.
> > >
> > > > Additional trace to relate SQL pushdowns with entity action or JPQL
> > query
> > > >
> > -------------------------------------------------------------------------
> > > >
> > > >                 Key: OPENJPA-1585
> > > >                 URL:
> > https://issues.apache.org/jira/browse/OPENJPA-1585
> > > >             Project: OpenJPA
> > > >          Issue Type: Improvement
> > > >    Affects Versions: 2.0.0
> > > >            Reporter: Catalina Wei
> > > >            Assignee: Catalina Wei
> > > >            Priority: Trivial
> > > >         Attachments: OPENJPA-1585.patch
> > > >
> > > >
> > > > Additional trace can help users understand and relate query or entity
> > > actions with SQL pushdowns:
> > > > 1.  why SQL pushdown has JOINs that are generated, a trace dumping
> out
> > > eager relations for the generated SQL is very helpful.
> > > > 2. a JPQL or a simple em.find() generated caused more than one SQL
> > > requests.
> > > > 3. entity instance actions (INSERT, UPDATE, DELETE) generated SQL
> > > > Examples:
> > > > 1. JOIN is generated because of the eager relation 'entitya':
> > > > 4891  p1  TRACE  [main] openjpa.Query - Executing query: select s
> from
> > > CascadeB s
> > > > 4906  p1  TRACE  [main] openjpa.jdbc.Extra - Eager relations:
> > > [test.entities.CascadeB.entitya]
> > > > 5141  p1  TRACE  [main] openjpa.jdbc.SQL - <t 26882784, conn 9493>
> > > executing prepstmnt 25862088 SELECT t0.id, t1.id, t1.name, t0.nameFROM
> > > CascadeB t0 LEFT OUTER JOIN CascadeA t1 ON t0.ENTITYA_ID = t1.id
> > > > 2. flush for new instance of entity action:
> > > > 7250  p1  TRACE  [main] openjpa.jdbc.Extra - flush:
> > > org.apache.openjpa.kernel.PNewState for oid=1
> > > > 7250  p1  TRACE  [main] openjpa.jdbc.SQL -: INSERT INTO BasicA
> > > (age,id,name) VALUES (?,?,?) [1,1,name1]
> > > > 2: loading relation 'entitya':
> > > > 7734  p1  TRACE  [main] openjpa.jdbc.Extra - load field: 'entitya'
> for
> > > oid=1 class test.entities.BasicB
> > > > 7734  p1  TRACE  [main] openjpa.jdbc.Extra - find: oid=1 class
> > > test.entities.BasicA
> > > > 7734  p1  TRACE  [main] openjpa.jdbc.Extra -
> getInitializeStateResult:
> > > oid=1 class test.entities.BasicA
> > > > 7969  pdq1  TRACE  [main] openjpa.jdbc.SQL - <t 26882784, conn
> 3125250>
> > > executing prepstmnt 28008463 SELECT t0.name FROM BasicA t0 WHERE t0.id=
> > ?
> > >  optimize for 1 row [params=(int) 1]
> > >
> > > --
> > > This message is automatically generated by JIRA.
> > > -
> > > You can reply to this email to add a comment to the issue online.
> > >
> > >
> >
> >
> > --
> > Albert Lee.
> >
>



-- 
Albert Lee.

Re: [jira] Updated: (OPENJPA-1585) Additional trace to relate SQL pushdowns with entity action or JPQL query

Posted by catalina wei <ca...@gmail.com>.
Hi Albert,
thanks for your input.
I will auto-enable SQL trace when this trace is enabled.
BTW,
I am changing the the name 'Extra' to 'DIAG'.

If you there no objections, I will commit the patch.

Catalina

On Thu, Mar 18, 2010 at 8:27 PM, Albert Lee <al...@gmail.com> wrote:

> >> It would only make sense to turn on Extra trace when Query and SQL
> traces
> are also turned on.
>
> Shouldn't we automatically enable the SQL log at the same level as Extra if
> it is specified alone.
>
> Albert Lee.
>
> On Thu, Mar 18, 2010 at 10:01 PM, Catalina Wei (JIRA) <jira@apache.org
> >wrote:
>
> >
> >     [
> >
> https://issues.apache.org/jira/browse/OPENJPA-1585?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
> ]
> >
> > Catalina Wei updated OPENJPA-1585:
> > ----------------------------------
> >
> >    Attachment: OPENJPA-1585.patch
> >
> > In this patch, a trace channel named 'openjpa.jdbc.Extra' is defined for
> > getting additional trace information that may help users relate the SQLs
> > generated to entity activities or JPQL queries.
> >
> > To turn on this trace, add as below:
> >
> >    <property name="openjpa.Log"
> value="Query=TRACE,SQL=TRACE,Extra=TRACE"/>
> >
> > It would only make sense to turn on Extra trace when Query and SQL traces
> > are also turned on.
> >
> > > Additional trace to relate SQL pushdowns with entity action or JPQL
> query
> > >
> -------------------------------------------------------------------------
> > >
> > >                 Key: OPENJPA-1585
> > >                 URL:
> https://issues.apache.org/jira/browse/OPENJPA-1585
> > >             Project: OpenJPA
> > >          Issue Type: Improvement
> > >    Affects Versions: 2.0.0
> > >            Reporter: Catalina Wei
> > >            Assignee: Catalina Wei
> > >            Priority: Trivial
> > >         Attachments: OPENJPA-1585.patch
> > >
> > >
> > > Additional trace can help users understand and relate query or entity
> > actions with SQL pushdowns:
> > > 1.  why SQL pushdown has JOINs that are generated, a trace dumping out
> > eager relations for the generated SQL is very helpful.
> > > 2. a JPQL or a simple em.find() generated caused more than one SQL
> > requests.
> > > 3. entity instance actions (INSERT, UPDATE, DELETE) generated SQL
> > > Examples:
> > > 1. JOIN is generated because of the eager relation 'entitya':
> > > 4891  p1  TRACE  [main] openjpa.Query - Executing query: select s from
> > CascadeB s
> > > 4906  p1  TRACE  [main] openjpa.jdbc.Extra - Eager relations:
> > [test.entities.CascadeB.entitya]
> > > 5141  p1  TRACE  [main] openjpa.jdbc.SQL - <t 26882784, conn 9493>
> > executing prepstmnt 25862088 SELECT t0.id, t1.id, t1.name, t0.name FROM
> > CascadeB t0 LEFT OUTER JOIN CascadeA t1 ON t0.ENTITYA_ID = t1.id
> > > 2. flush for new instance of entity action:
> > > 7250  p1  TRACE  [main] openjpa.jdbc.Extra - flush:
> > org.apache.openjpa.kernel.PNewState for oid=1
> > > 7250  p1  TRACE  [main] openjpa.jdbc.SQL -: INSERT INTO BasicA
> > (age,id,name) VALUES (?,?,?) [1,1,name1]
> > > 2: loading relation 'entitya':
> > > 7734  p1  TRACE  [main] openjpa.jdbc.Extra - load field: 'entitya' for
> > oid=1 class test.entities.BasicB
> > > 7734  p1  TRACE  [main] openjpa.jdbc.Extra - find: oid=1 class
> > test.entities.BasicA
> > > 7734  p1  TRACE  [main] openjpa.jdbc.Extra - getInitializeStateResult:
> > oid=1 class test.entities.BasicA
> > > 7969  pdq1  TRACE  [main] openjpa.jdbc.SQL - <t 26882784, conn 3125250>
> > executing prepstmnt 28008463 SELECT t0.name FROM BasicA t0 WHERE t0.id =
> ?
> >  optimize for 1 row [params=(int) 1]
> >
> > --
> > This message is automatically generated by JIRA.
> > -
> > You can reply to this email to add a comment to the issue online.
> >
> >
>
>
> --
> Albert Lee.
>

Re: [jira] Updated: (OPENJPA-1585) Additional trace to relate SQL pushdowns with entity action or JPQL query

Posted by Albert Lee <al...@gmail.com>.
>> It would only make sense to turn on Extra trace when Query and SQL traces
are also turned on.

Shouldn't we automatically enable the SQL log at the same level as Extra if
it is specified alone.

Albert Lee.

On Thu, Mar 18, 2010 at 10:01 PM, Catalina Wei (JIRA) <ji...@apache.org>wrote:

>
>     [
> https://issues.apache.org/jira/browse/OPENJPA-1585?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel]
>
> Catalina Wei updated OPENJPA-1585:
> ----------------------------------
>
>    Attachment: OPENJPA-1585.patch
>
> In this patch, a trace channel named 'openjpa.jdbc.Extra' is defined for
> getting additional trace information that may help users relate the SQLs
> generated to entity activities or JPQL queries.
>
> To turn on this trace, add as below:
>
>    <property name="openjpa.Log" value="Query=TRACE,SQL=TRACE,Extra=TRACE"/>
>
> It would only make sense to turn on Extra trace when Query and SQL traces
> are also turned on.
>
> > Additional trace to relate SQL pushdowns with entity action or JPQL query
> > -------------------------------------------------------------------------
> >
> >                 Key: OPENJPA-1585
> >                 URL: https://issues.apache.org/jira/browse/OPENJPA-1585
> >             Project: OpenJPA
> >          Issue Type: Improvement
> >    Affects Versions: 2.0.0
> >            Reporter: Catalina Wei
> >            Assignee: Catalina Wei
> >            Priority: Trivial
> >         Attachments: OPENJPA-1585.patch
> >
> >
> > Additional trace can help users understand and relate query or entity
> actions with SQL pushdowns:
> > 1.  why SQL pushdown has JOINs that are generated, a trace dumping out
> eager relations for the generated SQL is very helpful.
> > 2. a JPQL or a simple em.find() generated caused more than one SQL
> requests.
> > 3. entity instance actions (INSERT, UPDATE, DELETE) generated SQL
> > Examples:
> > 1. JOIN is generated because of the eager relation 'entitya':
> > 4891  p1  TRACE  [main] openjpa.Query - Executing query: select s from
> CascadeB s
> > 4906  p1  TRACE  [main] openjpa.jdbc.Extra - Eager relations:
> [test.entities.CascadeB.entitya]
> > 5141  p1  TRACE  [main] openjpa.jdbc.SQL - <t 26882784, conn 9493>
> executing prepstmnt 25862088 SELECT t0.id, t1.id, t1.name, t0.name FROM
> CascadeB t0 LEFT OUTER JOIN CascadeA t1 ON t0.ENTITYA_ID = t1.id
> > 2. flush for new instance of entity action:
> > 7250  p1  TRACE  [main] openjpa.jdbc.Extra - flush:
> org.apache.openjpa.kernel.PNewState for oid=1
> > 7250  p1  TRACE  [main] openjpa.jdbc.SQL -: INSERT INTO BasicA
> (age,id,name) VALUES (?,?,?) [1,1,name1]
> > 2: loading relation 'entitya':
> > 7734  p1  TRACE  [main] openjpa.jdbc.Extra - load field: 'entitya' for
> oid=1 class test.entities.BasicB
> > 7734  p1  TRACE  [main] openjpa.jdbc.Extra - find: oid=1 class
> test.entities.BasicA
> > 7734  p1  TRACE  [main] openjpa.jdbc.Extra - getInitializeStateResult:
> oid=1 class test.entities.BasicA
> > 7969  pdq1  TRACE  [main] openjpa.jdbc.SQL - <t 26882784, conn 3125250>
> executing prepstmnt 28008463 SELECT t0.name FROM BasicA t0 WHERE t0.id = ?
>  optimize for 1 row [params=(int) 1]
>
> --
> This message is automatically generated by JIRA.
> -
> You can reply to this email to add a comment to the issue online.
>
>


-- 
Albert Lee.

[jira] Updated: (OPENJPA-1585) Additional trace to relate SQL pushdowns with entity action or JPQL query

Posted by "Catalina Wei (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-1585?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Catalina Wei updated OPENJPA-1585:
----------------------------------

    Attachment: OPENJPA-1585.patch

In this patch, a trace channel named 'openjpa.jdbc.Extra' is defined for getting additional trace information that may help users relate the SQLs generated to entity activities or JPQL queries.

To turn on this trace, add as below:

    <property name="openjpa.Log" value="Query=TRACE,SQL=TRACE,Extra=TRACE"/>

It would only make sense to turn on Extra trace when Query and SQL traces are also turned on.

> Additional trace to relate SQL pushdowns with entity action or JPQL query
> -------------------------------------------------------------------------
>
>                 Key: OPENJPA-1585
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1585
>             Project: OpenJPA
>          Issue Type: Improvement
>    Affects Versions: 2.0.0
>            Reporter: Catalina Wei
>            Assignee: Catalina Wei
>            Priority: Trivial
>         Attachments: OPENJPA-1585.patch
>
>
> Additional trace can help users understand and relate query or entity actions with SQL pushdowns:
> 1.  why SQL pushdown has JOINs that are generated, a trace dumping out eager relations for the generated SQL is very helpful.
> 2. a JPQL or a simple em.find() generated caused more than one SQL requests.
> 3. entity instance actions (INSERT, UPDATE, DELETE) generated SQL
> Examples:
> 1. JOIN is generated because of the eager relation 'entitya':
> 4891  p1  TRACE  [main] openjpa.Query - Executing query: select s from CascadeB s
> 4906  p1  TRACE  [main] openjpa.jdbc.Extra - Eager relations: [test.entities.CascadeB.entitya]
> 5141  p1  TRACE  [main] openjpa.jdbc.SQL - <t 26882784, conn 9493> executing prepstmnt 25862088 SELECT t0.id, t1.id, t1.name, t0.name FROM CascadeB t0 LEFT OUTER JOIN CascadeA t1 ON t0.ENTITYA_ID = t1.id 
> 2. flush for new instance of entity action:
> 7250  p1  TRACE  [main] openjpa.jdbc.Extra - flush: org.apache.openjpa.kernel.PNewState for oid=1
> 7250  p1  TRACE  [main] openjpa.jdbc.SQL -: INSERT INTO BasicA (age,id,name) VALUES (?,?,?) [1,1,name1]
> 2: loading relation 'entitya':
> 7734  p1  TRACE  [main] openjpa.jdbc.Extra - load field: 'entitya' for oid=1 class test.entities.BasicB
> 7734  p1  TRACE  [main] openjpa.jdbc.Extra - find: oid=1 class test.entities.BasicA
> 7734  p1  TRACE  [main] openjpa.jdbc.Extra - getInitializeStateResult: oid=1 class test.entities.BasicA
> 7969  pdq1  TRACE  [main] openjpa.jdbc.SQL - <t 26882784, conn 3125250> executing prepstmnt 28008463 SELECT t0.name FROM BasicA t0 WHERE t0.id = ?  optimize for 1 row [params=(int) 1]

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (OPENJPA-1585) Additional trace to relate SQL pushdowns with entity action or JPQL query

Posted by "Catalina Wei (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-1585?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Catalina Wei updated OPENJPA-1585:
----------------------------------

    Attachment: ecblank.gif
                graycol.gif


Hi Pinaki,
Thanks for your comment.
Yes, it would be nice to introduce another level of tracing
(openjpa.jdbc.SQL=DIAG level),
but that involves changing the Log interface, and I found that the
com.ibm.ws.jpa.management.TraceLogChannel  implements Log interface.
I was afraid of any build/compile breaks at this time since we are about to
cut 2.0.0  branch.
I will take another shot at this after we have that done and work on it at
trunk code.

as far as message ids, there are lots of trace messages that we logged were
non-localized messages.
It seems that if trace messages is providing information that user need to
take some action, then a message id should be used.
Because messages will get translated into different languages and users
other than US-speakings would know what actions to take.

The diagnostic trace that I added are mostly informational, no actions were
given to users. So I think it should be OK with non-localized messages.

Thanks again.

Regards, Catalina

Department: DMQA
e-mail: fancy@us.ibm.com
Tie:  543-3290


                                                                       
  From:       "Pinaki Poddar (JIRA)" <ji...@apache.org>                 
                                                                       
  To:         Catalina Wei/Silicon Valley/IBM@IBMUS                    
                                                                       
  Date:       03/22/2010 07:57 AM                                      
                                                                       
  Subject:    [jira] Commented: (OPENJPA-1585) Additional trace to relate SQL pushdowns with entity action or
              JPQL query                                               
                                                                       






    [
https://issues.apache.org/jira/browse/OPENJPA-1585?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12848152#action_12848152
 ]

Pinaki Poddar commented on OPENJPA-1585:
----------------------------------------

1. How about adding these useful trace statements to SQL=TRACE level itself
instead of having an extra channel.
2. The trace messages use non-localized hard coded Strings. Generally that
is not done for other parts of the code base.

actions with SQL pushdowns:
eager relations for the generated SQL is very helpful.
requests.
CascadeB s
[test.entities.CascadeB.entitya]
executing prepstmnt 25862088 SELECT t0.id, t1.id, t1.name, t0.name FROM
CascadeB t0 LEFT OUTER JOIN CascadeA t1 ON t0.ENTITYA_ID = t1.id
org.apache.openjpa.kernel.PNewState for oid=1
(age,id,name) VALUES (?,?,?) [1,1,name1]
oid=1 class test.entities.BasicB
test.entities.BasicA
oid=1 class test.entities.BasicA
executing prepstmnt 28008463 SELECT t0.name FROM BasicA t0 WHERE t0.id = ?
optimize for 1 row [params=(int) 1]

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.




> Additional trace to relate SQL pushdowns with entity action or JPQL query
> -------------------------------------------------------------------------
>
>                 Key: OPENJPA-1585
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1585
>             Project: OpenJPA
>          Issue Type: Improvement
>    Affects Versions: 2.0.0
>            Reporter: Catalina Wei
>            Assignee: Catalina Wei
>            Priority: Trivial
>             Fix For: 2.0.0
>
>         Attachments: ecblank.gif, graycol.gif, OPENJPA-1585.patch
>
>
> Additional trace can help users understand and relate query or entity actions with SQL pushdowns:
> 1.  why SQL pushdown has JOINs that are generated, a trace dumping out eager relations for the generated SQL is very helpful.
> 2. a JPQL or a simple em.find() generated caused more than one SQL requests.
> 3. entity instance actions (INSERT, UPDATE, DELETE) generated SQL
> Examples:
> 1. JOIN is generated because of the eager relation 'entitya':
> 4891  p1  TRACE  [main] openjpa.Query - Executing query: select s from CascadeB s
> 4906  p1  TRACE  [main] openjpa.jdbc.Extra - Eager relations: [test.entities.CascadeB.entitya]
> 5141  p1  TRACE  [main] openjpa.jdbc.SQL - <t 26882784, conn 9493> executing prepstmnt 25862088 SELECT t0.id, t1.id, t1.name, t0.name FROM CascadeB t0 LEFT OUTER JOIN CascadeA t1 ON t0.ENTITYA_ID = t1.id 
> 2. flush for new instance of entity action:
> 7250  p1  TRACE  [main] openjpa.jdbc.Extra - flush: org.apache.openjpa.kernel.PNewState for oid=1
> 7250  p1  TRACE  [main] openjpa.jdbc.SQL -: INSERT INTO BasicA (age,id,name) VALUES (?,?,?) [1,1,name1]
> 2: loading relation 'entitya':
> 7734  p1  TRACE  [main] openjpa.jdbc.Extra - load field: 'entitya' for oid=1 class test.entities.BasicB
> 7734  p1  TRACE  [main] openjpa.jdbc.Extra - find: oid=1 class test.entities.BasicA
> 7734  p1  TRACE  [main] openjpa.jdbc.Extra - getInitializeStateResult: oid=1 class test.entities.BasicA
> 7969  pdq1  TRACE  [main] openjpa.jdbc.SQL - <t 26882784, conn 3125250> executing prepstmnt 28008463 SELECT t0.name FROM BasicA t0 WHERE t0.id = ?  optimize for 1 row [params=(int) 1]

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (OPENJPA-1585) Additional trace to relate SQL pushdowns with entity action or JPQL query

Posted by "Pinaki Poddar (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-1585?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12848152#action_12848152 ] 

Pinaki Poddar commented on OPENJPA-1585:
----------------------------------------

1. How about adding these useful trace statements to SQL=TRACE level itself instead of having an extra channel.
2. The trace messages use non-localized hard coded Strings. Generally that is not done for other parts of the code base.

> Additional trace to relate SQL pushdowns with entity action or JPQL query
> -------------------------------------------------------------------------
>
>                 Key: OPENJPA-1585
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1585
>             Project: OpenJPA
>          Issue Type: Improvement
>    Affects Versions: 2.0.0
>            Reporter: Catalina Wei
>            Assignee: Catalina Wei
>            Priority: Trivial
>             Fix For: 2.0.0
>
>         Attachments: OPENJPA-1585.patch
>
>
> Additional trace can help users understand and relate query or entity actions with SQL pushdowns:
> 1.  why SQL pushdown has JOINs that are generated, a trace dumping out eager relations for the generated SQL is very helpful.
> 2. a JPQL or a simple em.find() generated caused more than one SQL requests.
> 3. entity instance actions (INSERT, UPDATE, DELETE) generated SQL
> Examples:
> 1. JOIN is generated because of the eager relation 'entitya':
> 4891  p1  TRACE  [main] openjpa.Query - Executing query: select s from CascadeB s
> 4906  p1  TRACE  [main] openjpa.jdbc.Extra - Eager relations: [test.entities.CascadeB.entitya]
> 5141  p1  TRACE  [main] openjpa.jdbc.SQL - <t 26882784, conn 9493> executing prepstmnt 25862088 SELECT t0.id, t1.id, t1.name, t0.name FROM CascadeB t0 LEFT OUTER JOIN CascadeA t1 ON t0.ENTITYA_ID = t1.id 
> 2. flush for new instance of entity action:
> 7250  p1  TRACE  [main] openjpa.jdbc.Extra - flush: org.apache.openjpa.kernel.PNewState for oid=1
> 7250  p1  TRACE  [main] openjpa.jdbc.SQL -: INSERT INTO BasicA (age,id,name) VALUES (?,?,?) [1,1,name1]
> 2: loading relation 'entitya':
> 7734  p1  TRACE  [main] openjpa.jdbc.Extra - load field: 'entitya' for oid=1 class test.entities.BasicB
> 7734  p1  TRACE  [main] openjpa.jdbc.Extra - find: oid=1 class test.entities.BasicA
> 7734  p1  TRACE  [main] openjpa.jdbc.Extra - getInitializeStateResult: oid=1 class test.entities.BasicA
> 7969  pdq1  TRACE  [main] openjpa.jdbc.SQL - <t 26882784, conn 3125250> executing prepstmnt 28008463 SELECT t0.name FROM BasicA t0 WHERE t0.id = ?  optimize for 1 row [params=(int) 1]

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (OPENJPA-1585) Additional trace to relate SQL pushdowns with entity action or JPQL query

Posted by "Catalina Wei (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-1585?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Catalina Wei resolved OPENJPA-1585.
-----------------------------------

       Resolution: Fixed
    Fix Version/s: 2.0.0

> Additional trace to relate SQL pushdowns with entity action or JPQL query
> -------------------------------------------------------------------------
>
>                 Key: OPENJPA-1585
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1585
>             Project: OpenJPA
>          Issue Type: Improvement
>    Affects Versions: 2.0.0
>            Reporter: Catalina Wei
>            Assignee: Catalina Wei
>            Priority: Trivial
>             Fix For: 2.0.0
>
>         Attachments: OPENJPA-1585.patch
>
>
> Additional trace can help users understand and relate query or entity actions with SQL pushdowns:
> 1.  why SQL pushdown has JOINs that are generated, a trace dumping out eager relations for the generated SQL is very helpful.
> 2. a JPQL or a simple em.find() generated caused more than one SQL requests.
> 3. entity instance actions (INSERT, UPDATE, DELETE) generated SQL
> Examples:
> 1. JOIN is generated because of the eager relation 'entitya':
> 4891  p1  TRACE  [main] openjpa.Query - Executing query: select s from CascadeB s
> 4906  p1  TRACE  [main] openjpa.jdbc.Extra - Eager relations: [test.entities.CascadeB.entitya]
> 5141  p1  TRACE  [main] openjpa.jdbc.SQL - <t 26882784, conn 9493> executing prepstmnt 25862088 SELECT t0.id, t1.id, t1.name, t0.name FROM CascadeB t0 LEFT OUTER JOIN CascadeA t1 ON t0.ENTITYA_ID = t1.id 
> 2. flush for new instance of entity action:
> 7250  p1  TRACE  [main] openjpa.jdbc.Extra - flush: org.apache.openjpa.kernel.PNewState for oid=1
> 7250  p1  TRACE  [main] openjpa.jdbc.SQL -: INSERT INTO BasicA (age,id,name) VALUES (?,?,?) [1,1,name1]
> 2: loading relation 'entitya':
> 7734  p1  TRACE  [main] openjpa.jdbc.Extra - load field: 'entitya' for oid=1 class test.entities.BasicB
> 7734  p1  TRACE  [main] openjpa.jdbc.Extra - find: oid=1 class test.entities.BasicA
> 7734  p1  TRACE  [main] openjpa.jdbc.Extra - getInitializeStateResult: oid=1 class test.entities.BasicA
> 7969  pdq1  TRACE  [main] openjpa.jdbc.SQL - <t 26882784, conn 3125250> executing prepstmnt 28008463 SELECT t0.name FROM BasicA t0 WHERE t0.id = ?  optimize for 1 row [params=(int) 1]

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.