Article about the so-called The SAY2K10 bug [LWN.net] in SpamAssassin.
This bug shows that if you don’t do things right in the first time then you will not do it later. When have you count the last time the “TODO” comments in your code?
“If anything, today’s computer users are less well adapted to dealing with applications that behave differently when the network is unexpectedly absent because both the user and the programmer assume that the network will be there because it always is. They would never set up a situation where the network would be missing and the programs they use/write are unlikely to handle the situation. Lazy kids.”
Casey Schaufler.
This article helped me by fixing this exception. The following code gave this exception
... from a import A class B (A): ...
but this was wrong because my class had the same name as the file it was in. This meant that my class had the same name as the module. To make it right it should be:
... from a import A class B (A.A): ...
Nice short film about the last biker on earth. Filmed in Halle.
Sehr schöne Fotoserie in Schwarzweiß verschiedenster Häuser in Halle. digi images – mam-foto – Serie: Stadt-Schatten
Today I had to change a hibernate query constructed with the criteria API to a SQL query. The result looked like:
String sqlQuery = "select count(*) ...";
Session dbSession = getSession();
SQLQuery crit = dbSession.createSQLQuery(sqlQuery);
crit.setCacheable(true);
return (Integer) crit.uniqueResult();
The former query was cached and the new one should be too. But I got the following exception:
java.lang.ClassCastException: java.math.BigDecimal
at org.hibernate.cache.StandardQueryCache.put(StandardQueryCache.java:83)
The following post from hibernate forum helped me to find a solution. The exception is gone after adding the result as a scalar. And the working query looks like:
String sqlQuery = "select count(*) as result ...";
Session dbSession = getSession();
SQLQuery crit = dbSession.createSQLQuery(sqlQuery);
crit.addScalar("result", Hibernate.INTEGER);
crit.setCacheable(true);
return (Integer) crit.uniqueResult();
|