From: Gavin K. <ga...@ap...> - 2002-09-12 09:17:50
|
Hi everyone. I've created an experimental ODMG3 API for Hibernate. Unfortunately I don't own a copy of the ODMG spec (you have to *buy* it, unfortunately) so I'm not 100% sure of some semantics. Also, some concepts don't map perfectly to an O/R tool. The main missing thing is an ODMG-style OQL. I don't think Hibernate's query language is very far removed from OQL but there are some differences (particularly collections). I would need some proper OQL documentation before we could start to support the ODMG style syntax because the ODMG implementations I've investigated don't seem agree on some of these points. Another issue is persistence by reachability. Mapping all associations with cascade="save/update" (also a new feature) would come close to the ODMG programming model but perhaps we should allow some setting which forces cascade to *default* to "save/update". Hibernate collection wrappers now implement the ODMG interfaces, ie DCollection, DMap, DList, DSet, etc. To do this, I needed collection-filtering functionality. I saw that this was useful for Hibernate itself, since it lets you take a large, uninitialized collection and load up only the elements you are interested in. Accordingly Ive added filtering methods to the Session interface like: filteredCollection = session.filter(collection, query) A filter is just a query where you can refer to "this", the collection element. So, for example: blackCats = session.filter( cat.getKittens(), "where this.color='black' order by this.name" ); rivals = session.filter( cat.getPotentialMates(), "select this.mate" ); Now, I certainly don't propose to make the ODMG API the recommended way to use Hibernate. Hibernate's own API is much more expressive. It would be nice, though, if we could find someone here with a better knowledge of the ODMG spec to take ownership of this feature and develop it towards fuller compliance. Gavin |