From: Anton v. S. <an...@ap...> - 2002-04-15 00:35:47
|
Donnie Hale wrote: > Another point is that writing bean-style property methods on a > class is excruciatingly tedious. What I'm getting at is that > I'd like to see a generator facility to go from the schema to > the .xml and from the .xml to the skeleton of the bean classes. > It wouldn't need to be a required capability to use Hibernate, > more of an optional facility like the current schema generator. I'll second that. I've just begun using Hibernate (I'm very impressed with it, BTW!) and this is one of the first requirements I ran into. In the first project I'm using it on, what I'm doing to deal with the above issue is a little perverse, but it's working for my purposes so far: I wrote some code to generate the bean skeletons from my database schema. This was pretty simple to do given that I was able to make assumptions about this particular system and database, and even naming conventions, in order to come up with a decent set of bean skeletons. I then used Hibernate's MappingByReflection class to generate a Hibernate XML mapping. This has worked pretty well for me as a starting point, but it's by no means general or complete. A full set round-trip tools that can propagate changes from the classes to the mapping to the database (in arbitrary sequence :) would be great. The easiest to implement is probably the one which goes from Hibernate's XML to bean skeletons - that's pretty trivial. If such a tool doesn't already exist and no-one gets to it before me, I'll probably implement that. > I tend to think that the DB should be the authority when it comes to the schema I'm guessing most Hibernate users are using their Java classes as the master source of schema information, otherwise the tools we're looking for would already exist... ;) Anton |