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