The hibernate tools shipped with Middlegen 2.1 generates equals/hashcode based on the ID of the object. This is a well-known issue that makes it impossible to add multiple new objects in a Set. I haven't had this problem up to now.
I tried adding all of the following to the
- equalsHashcode="true"
- columnsIncEquals="true"
- columnsIncToString="true"
<update>
</update>
I figured I'd try to move to hibernate 3 tools.
Finding Hibernate 3 tools
I went to the Hibernate Tools page and clicked Download. The version listed there is for Hibernate 3.1. (I tried it with hibernate 3, but it doesn't work; a particular class is missing a method). I'm not prepared to upgrade to Hibernate 3.1 yet as it is not officially released.
I tried the All Downloads for Hibernate page. It seems the latest Hibernate 3.0.x based tools is hibernate-tools-3.0.0.alpha4a.zip. It looks like the they're only going to release hibernate tools on 3.1 so the alpha4a is the last one for hibernate 3.0.
I had to switch out the
Problems Encountered
- Classes no longer have full constructors. This mainly caused problems in unit tests; I often populate composite keys using the constructor. All this code needs fixed.
- boolean types in the hbm file seem to get mapped to Boolean objects instead of primitives. This probably makes sense, but it is code that needs fixed and tested. The getter signatures have changed from boolean isSomething() to Boolean getSomething().
No comments:
Post a Comment