Thursday, November 3, 2011

queryparameterexception: could not locate named parameter

While testing my hibernate query I got a strange exception;
"nested exception is org.hibernate.QueryParameterException: could not locate named parameter".
I checked that the said parameter is in the hibernate model. Furthermore I checked there's a corresponding column in the database. So the problem was not about these. Later I saw that there's a problem while I was trying to set my named parameter. My hql query was like "from TableName t where t.field=:field1" and I was trying to set the value in "field1" with
query.setBoolean("field_", value);
As "field_" does not exist I got this error.
The correct form was;
query.setBoolean("field1", value);

Wednesday, November 2, 2011

comparing dates in flex

Let's see how we can compare dates in flex.

ObjectUtil.dateCompare(firstDate, secondDate);

This call above will return you -1 if secondDate is later than the first date, 1 if it's the contrary case and 0 if they match.

Tuesday, September 6, 2011

anti-patterns

I recommend Chris Kelly's anti-patterns article. A good read imo.

Wednesday, August 17, 2011

fix for the performance problem of mysql memory tables

In our project, a very high database performance is needed. Thus we create our critical tables as memory engine tables but although our queries are using corresponding indices we still can't achieve the needed performance. After few research in google I see that tables of memory type are having "hash" indices by default. After we drop the "hash" indices and replace them with "b-tree" ones, we had a much better performance in our project. So for those of you with performance problems using memory tables, I recommend trying b-tree indices.

Friday, July 15, 2011

mockito tutorial video

I recently find a very good screencast about mockito, a great mocking framework. There it is in three parts: