SmartGWT 1.0: A Q&A with Sanjiv Jivan (Developer of SmartGWT)
http://www.infoq.com/news/2008/11/smartgwt
SmartGWT showcase:
http://www.smartclient.com/smartgwt/showcase
Scrum followers say that often Scrum fails because it is just used to label some existing waterfallish process. Interestingly Scrum offers quite many such labels like sprint, scrum master, daily scrum, backlog etc.
If one wants to improve the current process then one should find out what are the problems and then deal with them. In some cases using "solutions" like Containment Building give good results but not necessarily because of effectiveness of the method itself but because of the positive impact such change has on the team psychology. Hence "labels" are sometimes needed to encourage people to face the real problems.
Recently we had a problem with Hibernate (version 3.2.6) mapping with subclasses that threw a ClassCastException upon casting to a concrete subclass.
The mapping file:
<class name="..." table="..."> <many-to-one name="pet" column="..." not-null="true"/> </class> <class name="Pet" table="..."> <id name="id" column="..."> <generator .../> </id> <discriminator formula="type"/> <subclass name="Cat" discriminator-value="cat"> <join table="..."> <key column="..."/> </join> </subclass> <subclass name="Dog" discriminator-value="dog"> <join table="..."> <key column="..."/> </join> </subclass> </class>
The code:
class Pet {
boolean isCat() {
return this instanceof Cat;
}
}
Pet pet = ...;
if (pet.isCat()) {
Cat cat = (Cat) pet; // throws ClassCastException!
...
}
We get the instance of pet through a many-to-one relation with Pet on its one end.
In the code snippet above, the actual type of pet is something like Pet$$EnhancerByCGLIB$$ccc3caa7 that is a direct subclass of Pet (pet.getClass().getSuperclass() returns Pet). But its only relation to Cat is that it "behaves" like one: the method boolean isCat() is proxied to return true.
Turned out that the exception is caused by loading the pet subclass object lazily. The problem is quite easy to fix with adding lazy="false" to <many-to-one/> element.
More information about such a case (including other options for fixing the problem) can be found from a Hibernate forum.