From: Gavin_King/Cirrus%<CI...@ci...> - 2002-02-14 10:07:25
|
>Your statement about such a concept being alien to idiomatic Java to me >seems to be putting the horse before the cart. While true, I think that >it loses sight of what we're building - for me at least that's the >object model. Hmmmmmmm. Perhaps. I was very keen to stay with the current approach of just adding persistence to Java, not trying to add any extra semantics, not trying to build an application framework. If you manage to convince me that its possible to do bidirectional associations with no xtra API then I'm sold on it. >There are ways to do this, and all the commercial O/R tools that I've >used support this. Basically the association is "managed" from one end >when it comes to persisting the association - and it's straightforward >to tell when things are screwy. Interesting. The thing I've used that does bi-directional associations - namely Visual Age for Java's EJB associations - uses a generated class that ensures association integrity from _both_ ends. Its arguably not a good design and is not consistent with the approach in this project. (I think they have a more difficult problem though, because the ends of the association might be remote.) >I don't see the problem. Your code (i.e. not Hibernate, the users code) >is still responsible for making sure all the persistent objects point >to the right places. This is true without persistence, and I wouldn't >expect the persistence layer to do this for you - that would be intrusive. (snip) >Yep - and that's fine. And if you wanted to you *could* do a consistency >check quite transparently. There's actually huge advantages in being >able to do that. Yeah, I was thinking about this on the way home, after firing off that last email and thinking "Well, you could just let the users manage integrity themselves, but validate the state before we persist anything" ... All we would need to implement this approach is some code to validate the association somewhere. There wouldn't need to be any other changes to the runtime engine and there wouldn't need to be any API. This would make me happy. I've been thinking of one-to-many associations while I've been writing this, but I think much the same thing goes for many-to-manys (where its a collection on each end - mapped to the one table). |