• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

Hibernate filter in join

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using Spring with Hibernate.
I have implemented hibernate filter.For simple cases it is working fine.But I am facing problem in some particular cases like for joining.
I have defined the filter defination in application-context.xml.
..........
<property name="filterDefinitions">
<list>
<bean class="org.springframework.orm.hibernate3.FilterDefinitionFactoryBean">
<property name="filterName" value="tanencyFilter" />
<property name="parameterTypes">
<props>
<prop key="tanentId">long</prop>
</props>
</property>
</bean>
</list>
</property>
.........
I have added the filter in my hbm.xml also.'

<filter name="tanencyFilter" condition=":tanentId = TANENT_ID" />

This Tanent_id is common for all the tables.

This is the query:
"select .................................................... from BedAssignment as bedAssignment right outer join bedAssignment.bed as bed "
.....................where .................";

Now if I enable the filter ,it filters the data based on bed assignment table,but I wantt to filter the data based on Bed table.Means I want to enable the filter for the Bed table not for Bed Assignment.

if any one have any idea then please help me.
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
your code looks ok. did you use any IDE?? If not, use Eclipse or NetBeans, they will automatically configure your problem as well as xml file.
 
Baisakhi Roy
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Suddha for your reply.
I am using Eclipse.
But I think you did not get my problem.
Say I have a Bed assignment table and Bed table as follows:
Bed:

BED_ID,STATUS_ID,.......,TANENT_ID

Bed_assignment:

BED_ASSIGNMENT_ID
BED_ID
PATIENT_ADMIT_ID

Now I this is the query:
select bed.bedId,bed.bedStatus...................bedAssignment.estimatedDischargeTime,................................ from BedAssignment as bedAssignment right outer join bedAssignment.bed as bed "
.....................where .................";

This is the BedAssignment class:
public class BedAssignment implements Serializable {

private static final long serialVersionUID = 1L;

private long bedAssignmentId;
private String bedId;
...........
private Bed bed;

..................
}
This is the Bed class
public class Bed implements Serializable {

private static final long serialVersionUID = 1L;
private Long tanentId;
private String bedId;
private BedStatus bedStatus;
............
}
I want that when I enable tanencyFilter ,it should enable on the Bed class not on bed_assignment.
How can I do that.Please write the code.
 
Suddha Satwa Roy
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
please go to the http://docs.jboss.org/hibernate/core/3.3/reference/en/html/filters.html if you send me your mail address I can send a demo that can help you.
 
Baisakhi Roy
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you again for your reply.
I have already checked the link you send,but still I could not solve my problem.My mail id is emailbaisakhi@yahoo.com.You can send the demo in my mail address.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you get any solution to this problem? I am facing the same issue.
 
Saloon Keeper
Posts: 21133
134
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome the the Ranch, Nisha!

After 9 years, I think probably everyone has moved on. Plus, this question is about legacy Hibernate, and unless you are stuck doing maintenance, I recommend using Hibernate JPA these days.

Rather than ask people who aren't listening anymore, why don't you ask the question as a new topic in this forum and show us what you're working with?
 
Evil is afoot. But this tiny ad is just an ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!