Hi, newbie still reversing. Got a Set (for free:) in one of my java classes! Using a hacked up version of the build file in the 2.0 vo. I understand that this is a two (2) step process: 1) run middlegen, and 2) run hbm2java.
I am a little confused about which things can be done where. I my case I will be reversing data from a mysql 3.0 database that has no relational info in it (it's in some kind of fast dumb table or db type). So I have to grab someone who knows the databases, have him make a new db that can have this relational info, duplicated the data and write the appropriate incantation into the database. Then all works sorta well (except the guy is busy). He has to hack the .hbm.xml files when we get funny stuff like "net.sf.hibernate.MappingException: Foreign key (po_item_ordered [ordered_by_id,deliver_to_id])) must have same number of columns as the referenced primary key (entity [db_id])". The sample appears to do everything but eat. Does anyone have any simple samples of ant build files that just middlegen (reverse), and 2) hbm2java? Just from one database to *.java files? (although the html is sorta nice, but that can wait). I have been hacking at the sample (throw something away and see if it still works), but I really don't grok which flavous of what options apply to which stages (middlegen or hbm2java) and I guess I am going the wrong way (from most people) and we have dozens of these similar db's. A more advanced question is whether or not you can have some logic in the .hbm.xml files to compensate for differences between databases (we have many flavours of each). I would need statements like: if database=db1 then column c_7 in table t maps to field c in object t (instead of column c which is the default) or this db is missing this field, (I notices a query in on of the mapping files?) or if boolean then use this column from this database as a different column type. Will I end up writing a bunch of xslt like stuff? Or will we *always* need a separate .hbm.xml file for each slightly different flavour of some db? Also, the db guy had to do "build indexes" or something when he made the incantation to create the tables (for the new copy of the db which had the relational info in it). There is something in the manual about this near in doc\reference\html\or-mapping.html there is maybe some stuff about: "5.4. Customizing the DDL. The Hibernate mapping document also contains information used only for DDL generation using the SchemaExport commandline tool. For example, you can override a column type using the sql-type attribute of a <column> element. to ... Finally, it is also possible to have the SchemaExport commandline tool generated required indexes automatically. For this, use the index attribute on <column> elements". Is this relevant? Would this help us not have to muck with the old database? Or is this something you do after middlegen and before hbm2java or is it done before you run hibernate? Any pointers will be appreciated. thanks ------------------------------------------------------- This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id70&alloc_id638&op=click _______________________________________________ middlegen-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/middlegen-user
