From: Jon M. <jo...@te...> - 2006-06-16 13:53:09
|
> Thanks Matthew, Jon, yes this is what I wanted to know i.e.=20 > events.event_id =3D objects.id > > ...there you go Naomi, pure sql will do it! > > SELECT classes.java_class, events.* > FROM events, objects, classes > WHERE java_class like 'org.bodington.server.events.SomeEvent' and=20 > events.event_id =3D objects.id and objects.type =3D classes.type; > =20 This assumes that you arent interested in the data that is specific to=20 certain types of event. You could also run a query like this: SELECT * FROM objects, events, messaging_events WHERE events.event_id =3D objects.id and messaging_events.messaging_event= _id =3D objects.id and resource_id =3D 123456; In this particular case you=B4d gain information about the message that=20 was posted or read or whatever. You could construct a similar query for=20 each sub-type of event. The type of join of these tables means that=20 there has to be a linking record in each of the three tables and so you=20 will only get messaging events. If you want your code to cope with upgrades to Bodington which add more=20 event sub classes then you will start your work by examining the classes=20 table so you can enumerate all the type of event and find out which=20 tables are needed for each type and the names of the fields that you=20 need to make the joins in your queries. Jon |