-->
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.  [ 1 post ] 
Author Message
 Post subject: Table or view not found querying on sublcass
PostPosted: Fri Apr 15, 2011 5:07 pm 
Newbie

Joined: Wed Apr 13, 2011 12:30 pm
Posts: 2
I am using a single table inheritance straegy for a table as follows:
Code:

@Entity
@Table(name="SOURCE_VALUE_LINK")
@Inheritance(strategy=InheritanceType.SINGLE_TABLE)
@IdClass(value=SourceValueLinkPK.class)
@DiscriminatorColumn(name="LINK_TYPE", discriminatorType=DiscriminatorType.STRING)
public abstract class SourceValueLink implements Serializable {


and the subclass is
Code:
@Entity
@DiscriminatorValue("PHON")
public class PhoneValueLink extends SourceValueLink  {

private CaseHistory casehistoryphonelink;
...

@ManyToOne
@JoinColumns({
   @JoinColumn(name="CASENUM", referencedColumnName="CASENUM" insertable=false, updatable=false),
   @JoinColumn(name="VALUE_SEQ_NUM", referencedColumnName="PHON_SEQ_NUM", insertable=false, updatable=false)
})
public CaseHistory getCasehistoryphonelink() {
   return casehistoryphonelink;
}


The case History table is lmapped like this
Code:
@Table(name ="CASE_HISTORY")
public class CaseHistory{
private Set<PhoneValueLink> casehistoryphonevaluelink;
...
@OneToMany(mappedBy ="casehistoryphonelink")
public Set<PhoneValueLink> getCasehistoryphonevaluelink() {
   return casehistoryphonevaluelink;
}
public void setLocatephonevaluelink(Set<PhoneValueLink> casehistoryphonevaluelink) {
   this.casehistoryphonevaluelink = casehistoryphonevaluelink;
}


The subclass is joined to another table as given above.
Now my query is like
Code:
Select new mars.DetailsGrid(lp.psn_pin,lp.seq_num,lp.phone,count(distinct src.srcname),min(src.date_reported),max(src.date_reported),count(src.date_reported)) " +
                                              "From CaseHistory lp Join lp.casehistoryphonevaluelink src "+
                                               "Where lp.casenum = :casenum " +
                                               "Group by lp.casenum,lp.seq_num,lp.phone " +
                                               "Order by max(src.date_reported) desc"


However I get a table not found error. What is my mistake?


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

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.