-->
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: Help with setting up hibernate mapping files
PostPosted: Fri Mar 09, 2012 3:48 pm 
Newbie

Joined: Fri Mar 09, 2012 3:24 pm
Posts: 1
I have two tables: company and employees. I am trying to read a company object and the set of employees associated with it. However, I would only like for the employees set associated with the company to contain employee objects that have not been flagged as deleted. Is there a way to set up the mapping files for company or for employees such that employee entries that are flagged as deleted do not get read?

So far I have been able to set up a one-to-many relationship where I read in a company and it gets all the employees associated with the company. I just need to know how to restrict it to only employees that have not been flagged as deleted.

This is the property that is located in the Company.hbm.xml file
<set name="employeesSet" table="employees">
<key column="companyID"/>
<one-to-many class="Employee" not-found="ignore"/>
</set>

In SQL it would be SELECT * FROM employees WHERE isDeleted = 0

I am using a delete flag isDeleted for auditing purposes rather than just delete entries completely out of the database.

Also, I am wondering if it is easier to use HQL for this sort of request versus configuring the mapping file or using criteria query and if anyone has any information on using many-to-many mappings in blazeDS.


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.