-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: Is it possible to insert comment in the generated query ...?
PostPosted: Mon Jan 22, 2007 10:15 am 
Newbie

Joined: Wed Jul 26, 2006 4:18 pm
Posts: 8
Location: Brussels, Belgium
Dear,

Our projects uses mainly spring.
We have request from the developpers to TAG their queries with the name of the DAO.
Code:
  public static final String EXIST_EMPLOYEE_ID =
      "SELECT /* EmployeeDAO S.3 */ FIRST_NAME, LAST_NAME FROM USER WHERE KEY = ?";


The point is to quickly find the DAO where the query "spotted" by Oracle performance tools are. It has proove itself usefull (and very usefull to inform third party that we were monitoring what they were doing in our application).

We also allow third party to query our schema & one of those is written with Hibernate. Is there some mean to do something similar with the query generated by hibernate .... ?

Tia,

\T,

Quote:
-- CONFIG --
Hibernate version: 3.2 (or later the one included in JBoss 4.0.3)
Mapping documents: N/A
Code between sessionFactory.openSession() and session.close(): N/A
Name and version of the database you are using: Oracle 9g
-- CONFIG --


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 22, 2007 10:28 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
don't use the spring interfaces; then you will see that Hibernate API (especially) Query and Criteria has a setComment method.

also look at the use_sql_comments property.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 22, 2007 10:29 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
be warned though that oracles driver can have issues with sql comments.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject: s it possible to insert comment in the generated query ...?
PostPosted: Mon Jan 22, 2007 12:46 pm 
Newbie

Joined: Wed Jul 26, 2006 4:18 pm
Posts: 8
Location: Brussels, Belgium
Max,

There is however one detail I may not have made obvious but ... which I believe is making your response unusefull (correct me if I am wrong).

As the hibernate devs do not write the query themselves but let Hibernate generate the query... I will look into the setComment(...) to see it that could help !

Tx already,

\T,

( I will rate :) )


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.