Le jeudi 2006 juillet 13 18:12, Thomas Dudziak a écrit : > Hi Vincent, > > the main problem that you have is that you cannot define a foreign key > that references TableA OR TableB.
That's my problem. It doesn't seem very exotic.. > Basically if you want to have database foreign keys (and if your OJB > app is the only user of the database, then you don't need to, OJB > handles the referencial integrity itself), Mostly.. My OJB app is the only "user" app using the database, but sometimes admins use database directly with phpPgAdmin so I really want to keep database referential integrity because admins can do bad things. ;) > then you basically have to > define a common base class for your two classes which is mapped to a > specific table, say TableAB. > From there you now have two options as to how to map the inheritance > onto tables. You can either map both classes completely to this table > or let OJB use joins. > If the two classes have a lot of database-mapped attributes in common, > the first solution makes most sense, esp. performance-wise. > If they are however quite different, you probably want the second > option, which is explained in more detail here: > > http://db.apache.org/ojb/docu/guides/advanced-technique.html#Mapping+Each+S >ubclass+to+a+Distinct+Table+%28table+per+subclass%29 I have already read this usefull guide but only the 2 first solutions: - Mapping Each Class of a Hierarchy to a Distinct Table - Mapping Class Hierarchy on the Same Table" The third way (ie. Mapping Each Subclass to a Distinct Table) should be the best to keep my database FK up. I'm going to try it. Thanks a lot Thomas. Regards, Vincent. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]