Apparently a lot of water has flown under Thames, since the David Jordan first looked at Castor and the writing of the above article.
CASTOR does not support Sun's JDO standard and that probably saved it from obscurity.Castor like Hibernate,OJB( which proposes to implement the Sun's JDO) use Runtime Reflection very effectively to provide Object Relational mapping and it works perfectly.Infact, OJB uses a persistence broker layer which uses Runtime Reflection to support Sun's JDO and ODMG standards.Source and Bytecode enhancements are not ideas that the developer community will like very much
I don't know ODMG standard , but Castors XML to Java Data binding is pretty cool and works like a peach. Can't say the same about their Object Relational Bridge ( I don't want to associate the JDO name with any one other than Sun).That can be improved. But I hope they do not implement the Sun's JDO spec.Rather, they should look at memory management issues and try to make their implementation leaner.
One advice to all there looking for a tool that will map java objects to database table(s).If you want one, go ahead and build one yourself. It is not that tough. I have a version that I developed, which works pretty well. If you can keep your Attribute name and database column names the same( case does not matter), for most part you won't need any XML mapping as well.If you do, then you may use Castor XML( no kidding, this is a cool tool)
Finally, why is it that Sun and their partners believe that SQL is difficult and we developers find it difficult to use? Why do they thrust languages such as OQL and EJB-QL on us when most of us are perfectly comfortable with SQL? In fact SQL syntax is very simple and as close to a natural language as it can get.The whole stuff is really a lot of hype and only makes things more difficult to an already hapless developer fighting obsolescense.
Therefore, if you must use an Object to Relational Mapping tool, here is my preference, in theorder of greatest importnace
1. Build one yourself and use good old SQL
2. OJB(jakarta.apache.org/ojb/) - Use the
Persistence Broker API
3. Hibernate
4. Castor - tread warily. Memory issues and
problems with nested objects
I am open to comments . My mail id is tksrajan@yahoo.com. You may also find what you see at this site interesting http://www.geocities.com/sundar_rajan_in/
|
If you think that building an ORM yourself is easy, then you probably don't understand all the things which a JDO implementation can do for you:
- transparency, due to persistence by reachability you don't need to explicitly make instances persistent.
- support for inheritence.
- management of relationships between instances, again transparently.
- caching.
I too have written a simple ORM, but I now use JDO extensively, and find that it saves a lot of effort.
Tom