I'm stumped. It looks like one of my joined-subclasses isn't being queried properly. Any ideas on how to resolve this would be appreciated.
I've removed any bits I thought weren't needed, but if I've missed something, just give me a shout and I'll add it. Thanks.
Hibernate version: 3.0.5
Database: 4.1.12-max
Error:
Code:
java.sql.SQLException: Base table or view not found message from server: "Unknown table 'issuesched2_1_' in where clause
HQL:Code:
from Document document where document.journalId = ? and document.issue.issueSchedule.mailStartDate < ? and document.issue.issueSchedule.deadlineDate > ?
Query: (removed unrelevant bits)
Code:
select document0_.document_id as document1_, case when document0_1_.document_id is not null then 1 when document0_.document_id is not null then 0 end as clazz_ from documents document0_ left outer join afm_documents document0_1_ on document0_.document_id=document0_1_.document_id, issues issue1_, issue_schedules issuesched2_ where issue1_.issue_id=issuesched2_.issue_schedule_id and document0_.issue_id=issue1_.issue_id and document0_.journal_id=? and issuesched2_1_.mail_start_date<? and issuesched2_1_.deadline_date>?
Mappings: (removed unrelevant bits)
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="test.domain.Document" table="documents">
<id name="documentId" column="document_id">
<generator class="native" />
</id>
<!-- more properties -->
<many-to-one name="issue" class="test.domain.Issue" column="issue_id" cascade="none" />
<joined-subclass name="test.domain.AfmDocument" table="afm_documents">
<key column="document_id" />
<!-- more properties -->
</joined-subclass>
</class>
</hibernate-mapping>
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="test.domain.Issue" table="issues">
<id name="issueId" column="issue_id">
<generator class="native" />
</id>
<!-- more properties -->
<one-to-one name="issueSchedule" class="test.domain.IssueSchedule" cascade="all-delete-orphan" />
<bag name="documents" cascade="save-update" inverse="true">
<key column="issue_id" not-null="true" />
<one-to-many class="test.domain.Document" />
</bag>
</class>
</hibernate-mapping>
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="test.domain.IssueSchedule" table="issue_schedules">
<id name="issueScheduleId" column="issue_schedule_id">
<generator class="native" />
</id>
<!-- more properties -->
<one-to-one name="issue" class="test.domain.Issue" />
<joined-subclass name="test.domain.AfmIssueSchedule" table="afm_issue_schedules">
<key column="issue_schedule_id"/>
<!-- more properties -->
</joined-subclass>
</class>
</hibernate-mapping>