Sorry, I sent the last email using the wrong mail address. Matthias -----Original Message----- From: Matthias Bohlen [mailto:[EMAIL PROTECTED] Sent: Saturday, March 27, 2004 3:25 PM To: '[EMAIL PROTECTED]' Subject: Mapping subclasses in separate tables - how?
Hi, all, with the Hibernate cartridge for AndroMDA (see www.andromda.org), we generate POJOs which are mapped to a DB using Hibernate (no wonder). The interesting thing is that we generate XDoclet tags and let XDoclet generate the *.hbm.xml files. We now have a sample program ("animal quiz" game) that guesses an animal the user has in mind by asking questions to the user. Inside the business tier, we build a decision tree made of three classes: DecisionItem (the base class), Animal and Question (both subclasses of DecisionItem). AndroMDA generates @hibernate.subclass tags in Animal.java and Question.java. Now, at the end of the generation process when XDoclet runs, it generates *only one* file called DecisionItem.hbm.xml! There are no Animal.hbm.xml and no Question.hbm.xml because those classes are mapped as subclasses inside DecisionItem.hbm.xml. As a result, the database contains *only one* table called DECISION_ITEM with *all* the columns from DecisionItem, Animal, and Question. This is not what we want. We want three tables DECISION_ITEM, ANIMAL and QUESTION that have the columns from DecisionItem, (DecisionItem+Animal) and (DecisionItem+Question), the latter two tables connected to the first using a foreign key or using key identity. Which XDoclet tags do we have to generate in order to get these three tables? Cheers... Matthias --- Matthias Bohlen "Consulting that helps project teams to succeed..." http://www.mbohlen.de/ ------------------------------------------------------- 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 _______________________________________________ hibernate-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/hibernate-devel