From: Anton v. S. <an...@ap...> - 2002-04-15 02:36:49
|
> > i agree that writing bean-style property methods is tedious, but it is a > > task than can be fairly easily automated. > > Im using eclipse so its trivial. I'm using Eclipse too, but it doesn't automate the creation of a large number of beans from an existing database schema - does it? > I really like the whole idea of decoupling > the persistent representation from the internal implementation. Me too. > But I guess its a matter of preference Don't give up your principles so easily! ;) > so since theres no difficulty implemention > instance variable access, why not allow it? My question would be: why allow it? The issue for me isn't Hibernate's reliance on setters/getters - it's really a more general concern, which is that if schema and mapping information is stored in three different places, then synchronizing them could become tedious, and error prone. I'm speaking theoretically because I haven't used Hibernate enough to know how important this might be in practice. I realize that if you rely on the beans as the central source for schema info, and can rely on MappingByReflection to get the mapping you want, then the problem I'm thinking of wouldn't exist. However, with an existing database, it looks to me as though it may not be that easy. So I'm looking at dealing with manual edits to the mapping XML, then synchronizing the beans with that, and synchronizing changes in the database too. Supporting instance variable access slightly reduces the number of places that are affected by schema changes, but as has been mentioned, property methods are easily automated, but the basic synchronization issue still exists. Besides, instance variable access would allow users to use non-bean classes, but that only seems to encourage the writing of bad code - what's the real advantage? So I'm saying that the requirement raised by Donnie - which I think I share - doesn't seem to really be solved by adding instance variable support. It seems to me that we haven't heard any really good arguments for doing that. (Course, I've only been subscribed to the list for 6 messages, so add salt to taste... ;) Anton |