Hibernate version: 3.2.0 GA
Name and version of the database you are using: Oracle9
The background: application uses JPA with Hibernate underneath it for persistence. Now we dropped in JBPM with its pure Hibernate persistence. The goal is to query a tasklist (TaskInstance is a JBPM entity) and join our JPA entities inside that query, something like this:
Code:
<query name="theQuery">
<![CDATA[
select ti
from the.package.TaskInstance as ti,
the.domain.Customer as cust
where ti.isSuspended != true
and ti.isOpen = true
and ti.entityId = cust.id
and cust.customerNumber = '700061'
]]>
</query>
the.package.TaskInstance is an entity managed by Hibernate, described in mapping files, all that kind of stuff. This is basically an extension of the JBPM TaskInstance.
Now the.domain.Customer is our own home grown domain entity persisted with JPA (Hibernate underneath). All its metadata is decribed in annotations, like this:
Code:
@Entity
@Table(uniqueConstraints = @UniqueConstraint(columnNames="customerNumber"))
public class Customer extends BaseEntity implements Identifiable {
...
So what we do is we want to have both Hibernate and JPA entities in the same query. However as SessionFactoryImpl.checkNamedQueries() processes the query above it ends up with an exception complaining that 'the.domain.Customer is not mapped'. Customer class is there in the class path so in theory the metadata is available in the runtime. The question is: is it possible to make that metadata somehow available to the session factory parsing such a heterogeneous query? Is there an alternative way to make a cross query without duplicating Customer metadata (the one described in annotations) in the mapping files?
Thanks.