-->
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.  [ 1 post ] 
Author Message
 Post subject: Junk characters appended at the end of HQL query
PostPosted: Mon Oct 07, 2013 6:27 am 
Newbie

Joined: Mon Oct 07, 2013 5:43 am
Posts: 1
Hi All,

In our application, we are using Hibernate 3 with JBoss server 4.2.3 GA.
We are constructing a HQL query and using the list() to get the results of query.
Every time the query was used, a new query plan was generated.
In SQL Server profiler trace, we found a number of blank space characters at the end.
We approached Microsoft regarding this and they told that every time some new junk characters are being appended at the end of query and they were not blank spaces.

The SQL Server trace from profiler and DMVS is as below.
Note: The junk character at the end.

Code:
(@P0 smallint,@P1 smallint,@P2 int,@P3 datetime2,@P4 smallint)select account0_.ACNT_NO as col_0_0_, accountacc1_.AXCS_ID as col_1_0_ from ECASH.ACCOUNT account0_ cross join ECASH.ACCOUNT_ACCESS accountacc1_ where account0_.ACNT_NO=accountacc1_.AXCS_ACNT_NO and (account0_.ACNT_STATE_ID in (@P0 , @P1)) and account0_.ACNT_SITE_ID=@P2 and account0_.ACNT_EXPIRY_DATE<=@P3 and account0_.ACNT_TYPE_ID<>@P4                                       


The HQL query from code is as below.

Code:
String GET_FIXED_EXPIRY_ACNTS   =   "select   a.acntNo, axcs.axcsId "+
               "from   com.ballydev.sds.ecash.db.account.Account a, com.ballydev.sds.ecash.db.account.AccountAccess axcs " +
               "where   a.acntNo            = axcs.axcsAcntNo " +
               "and   a.acntStateId             in (:acntStateIdList) "+
               "and   a.acntSiteId             = :siteId " +
               "and   a.acntExpiryDate             <= :expiryDate " +
               "and     a.acntTypeId            <> :acntTypeId ";


The above query is used in code as below.
Code:
Query query =  session.createQuery(IQueryConstants.GET_FIXED_EXPIRY_ACNTS)
            .setCalendar("expiryDate", cal)
            .setInteger("siteId", siteId)
            .setParameterList("acntStateIdList", acntStateIdList)
            .setShort("acntTypeId", AccountTypeEnum.SPECIAL.getAccountType());

List<?> list = query.list();


We have verified from application code that the query has only one leading space at the end by debugging it.
We tried removing the leading space and experienced the same issue.

Can someone please help us in knowing the root cause of this issue.

Thanks in advance.

Thanks,
Karthik


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

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.