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.  [ 3 posts ] 
Author Message
 Post subject: Where named query are declared ?
PostPosted: Sat Aug 12, 2006 7:20 am 
Newbie

Joined: Sat Aug 12, 2006 7:11 am
Posts: 2
Where named query are declared ? In application.xml of Spring ?

Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:

Mapping documents:

Code between sessionFactory.openSession() and session.close():

Full stack trace of any exception that occurs:

Name and version of the database you are using:

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:


Top
 Profile  
 
 Post subject: Re: Where named query are declared ?
PostPosted: Sun Aug 13, 2006 2:45 am 
Newbie

Joined: Wed Aug 25, 2004 5:10 am
Posts: 2
alessandrocma wrote:
Where named query are declared ? In application.xml of Spring ?


if i get you right you are using spring + hibernate to develope your app. in application.xml file of spring you declare your app's beans and how they service their client not a named quiries.
you can define your named queries in two simple ways:

1. by using xdoclet and declaring your named query in ur pojo class like this
Code:
/**
* @hibernate.class table="tbl_acc_account"
* @hibernate.query name="accountByCode" value="FROM Account a WHERE a.accountCode=?"
*/
public class Account ...


2. declaring named query in .hbm.xml file of a related pojo
Code:
    <query name="accountByCode">
            <![CDATA[FROM Account a WHERE a.accountCode=?]]>
    </query>


Top
 Profile  
 
 Post subject:
PostPosted: Sat Aug 19, 2006 8:05 am 
Newbie

Joined: Sat Aug 12, 2006 7:11 am
Posts: 2
Thanks,

Debtor, but my nominated consultation is a stored procedure that nao if directly relates with none pojo.

But my named queries is a call to stored procedure that not relates to anyone pojo directly.

I can only have one pojo for this stored procedure ?

As i do a stored procedure to call a insert stored procedure but not using a <sql-insert>, i want to use named queries (the insert is very particular e not call in save moment) to create insertXXX method.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.