Dale, thanks - I did not really understand that payment reference was just a field.
> From: Dale Newfield <[EMAIL PROTECTED]> > Reply-To: <users@appfuse.dev.java.net> > Date: Tue, 20 May 2008 12:31:10 -0400 > To: <users@appfuse.dev.java.net> > Subject: Re: [appfuse-user] Hibernate hql join on tables with no relationship > > Richard Mixon wrote: >> How can this be? To have a many-to-many relationship the join table >> must already exist [...] and have references to both class A and B - >> through either an object id key or a natural key. > > What the OP described isn't quite a many-to-many relationship: > >>>>> I need to run some read only reports by joining the following two tables: >>>>> >>>>> 1) payments >>>>> 2) subscriptions >>>>> >>>>> The join will be on a column in both called paymentreference. >>>>> I do not have control over the underlying database and the two tables and >>>>> the two tables do not have a relationship i.e. no foreign keys exist. > > But rather pair of many-to-one relationships with a phantom third item > known as a paymentreference. > > It's not truly many-to-many because any given payment or subscription > can be related to at most one paymentreference. > > HQL is simply a variant on SQL. If you can form your queries in SQL you > can likely form those queries in HQL, as it has almost all the join > capabilities as SQL. > > -Dale > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]