Posts

Showing posts from June, 2012

Hibernate Joins Without Associations

Normally, when specifying joins in in Hibernate or NHibernate using HQL it's via the mapped associations.  For example: select {p} from Person p join p.Address a where a.AddressType = 'Mailing' The explicit join is through the mapped one-to-many association from Person to Address. We recently had a need to join two entities that didn't have associations. For that, we can resort to joins in the where clause: select {p} from Person p, Address a where p.PersonId = a.PersonId  and a.AddressType = 'Mailing'