-->
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: Inner-join in mapping
PostPosted: Thu Nov 26, 2009 4:58 am 
Newbie

Joined: Wed Nov 25, 2009 6:52 am
Posts: 1
Hi, I'm new to hibernate.

I need to retrieve only jobs with company that is not a testcompany (Company.isTestCompany = false)

Question:
Is it possible to make an inner join on company from Job where Company.isTestCompany = false, without doing it in hql ?

Tried to put a @Where(clause="a_isTestCompany = false") in Company, but that fails on ObjectNotFoundException (no row with the given identifier...)


Classes:
@Entity
@Table(name = "a_job")
public class JobOpening implements
{
@Id
@Column(name = "a_jobid", unique = true, nullable = false)
private int jobid;

@ManyToOne
@JoinColumn(name = "a_company")
private Company company;
...
}

@Entity
@Table(name = "a_company")
public class Company implements
{
@Id
@Column(name = "a_companyId")
private short companyId;

@Column(name = "a_isTestCompany")
private boolean isTestCompany;
...
}


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.