-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: Unknown table in where clause
PostPosted: Tue Oct 04, 2005 11:14 am 
Newbie

Joined: Fri Sep 30, 2005 10:58 am
Posts: 4
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>


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 04, 2005 12:57 pm 
Regular
Regular

Joined: Mon Aug 29, 2005 9:46 am
Posts: 102
Have you seen that the path is diferent?
In the HQL is document.issue.issueSchedule and in the mapping is test.domain.IssueSchedule.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 04, 2005 1:30 pm 
Newbie

Joined: Fri Sep 30, 2005 10:58 am
Posts: 4
moonlight wrote:
Have you seen that the path is diferent?
In the HQL is document.issue.issueSchedule and in the mapping is test.domain.IssueSchedule.


test.domain.IssueSchedule is the class. document.issue.issueSchedule is the path.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.