Win a copy of Pro Spring MVC with WebFlux: Web Development in Spring Framework 5 and Spring Boot 2 this week in the Spring forum!

Abhishek Ralhan

Ranch Hand
+ Follow
since Aug 01, 2010
Abhishek likes ...
Eclipse IDE Chrome Ubuntu
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Abhishek Ralhan

Thanks Karthik Shiraly,

We get a list of these codes from another application through webservice request. And we hit the dB with the same list. This functionality is very old but very recently the other application sending codes with leading 0's.
And those leading 0's were the problem and I was not at all aware of this bug in Hibernate earlier.
Thanks very much for your inputs. It solved my one incident in Production
Hello Ranchers,

I am using JPA. And in it I fire a query which comes out to be:
SELECT DISTINCT d FROM table_name d WHERE d.col1.col2.col3 in
ORDER by d.col4 DESC

Now when this query is hit it throws a below exception:
org.hibernate.hql.ast.QuerySyntaxException: unexpected token: 84 near line 1, column 126

Below is the stacktrace:

at org.hibernate.hql.ast.QuerySyntaxException.convert(
at org.hibernate.hql.ast.QuerySyntaxException.convert(
at org.hibernate.hql.ast.ErrorCounter.throwQueryException(
at org.hibernate.hql.ast.QueryTranslatorImpl.parse(
at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(
at org.hibernate.hql.ast.QueryTranslatorImpl.compile(
at org.hibernate.engine.query.HQLQueryPlan.<init>(
at org.hibernate.engine.query.HQLQueryPlan.<init>(
at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(
at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(
at org.hibernate.impl.AbstractSessionImpl.createQuery(
at org.hibernate.impl.SessionImpl.createQuery(
at org.hibernate.ejb.AbstractEntityManagerImpl.createQuery(
at org.jboss.ejb3.entity.TransactionScopedEntityManager.createQuery(

The reason for this I think is that, may be, I am fitting too many values in the IN () function and it looks like JPA has initial size for the parameters or the queries, which is may be crossed.
Please suggest if this is the case, and what should I do to counter this kind of scenario.
can you please explain what is the whole flow from request to response(before which session times out)?
what is the error message you are getting on console/logs??
are you making a database call, if yes, what is its time-out?
9 years ago
welcome Craig
9 years ago
You may be already aware, but incase you are not, unique constraint allows one null value. So you may have to handle it through code.
if you still have doubts, i think, its the right time for you to start with the design patterns. The design pattern here in discussion is Factory Design Pattern
i have never seen/tried it. But what's the big deal, just put the body script in another <script> tags and go ahead, just likeits donr in the second <script> tag of your code.
use readline for reading sex.
If you want, you can validate the input data afterwards.
Well ideally, you must find it yourself.
Hint: Check the getInstance method of Calender class
if you use eclipse or any other IDE you can search the whole workspace/project for the "". Believe me it works for me most of the times, when i am clueless, in my project
9 years ago
You can also try to use all these combinations.
Actually it depends upon the term "where no price is defined". Whatever this term means, the answer lies in that meaning only.
Do you mean either of below:
- you want to cache the previous radio button selection,
- persist it somewhere and us next time,
- repopulate it to a default value

if no, please elaborate the requirement. Also, are you using some framework like jsf etc. or simple servlets/jsps??

Never heard in a web application, static methods would access database.
Would like to know the responses though.

Anyone please respond..

You can use a hidden field like:
<input type="hidden" id="test" value="#{backBean.value}"> in your page.
And in your javascript you can getElementId("test") and read its value.

Note: I don't remember the "input type hidden" for jsf , hence i used the jsp component "input"
9 years ago
Try ArulKumaran's "Good java j2ee interview questions". I've been reading it myself too. See if you feel its helpful.
9 years ago