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.  [ 4 posts ] 
Author Message
 Post subject: Many-to-one filtering support
PostPosted: Sat Feb 18, 2006 9:58 am 
Newbie

Joined: Wed Feb 15, 2006 11:52 am
Posts: 4
Are there plans to add many-to-one filtering?

A common use is to filter on historical data as in the effective date example in the documentation. Filters work well if you are filtering against a collection or a class. The problem is that I also have many-to-one objects that are not supported by filters.

An example, might be an Invoice with a Customer object in a many-to-one relationship. I could apply the filter to the to the Invoice to get a snapshot of the invoice at a point in time, but how can I get it to load the corresponding Customer information for the same point in time?

Is there a recommended solution to this type of problem in the current version of Hibernate? I've tried using loader in the class, but it doesn't seem to use it.

I also thought of loading the "Customer" into a collection and pulling out the object in the "Invoice" class, but that seems like a hack. For example,

private Customer customer;

public setCustomer(Customer customer)
{
this.customer = customer;
}

public Customer getCustomer()
{
return customer;
}

public void setCustomerList(List<Customer> customers) {
setCustomer(customers.get(0));
}

The customer would then be mapped as a <set> instead of a <many-to-one>.


Top
 Profile  
 
 Post subject: many-to-one filtering support
PostPosted: Thu Feb 23, 2006 3:59 pm 
Newbie

Joined: Mon Dec 05, 2005 7:40 pm
Posts: 2
I agree.

From looking through the forum archives, it seems there have been a few requests but no real feedback from the hibernate team or the community.

Is there something fundamentally preventing the implementation, or is there a more appropriate way of handling these cases.

Gavin/Christian/Max, etc. ?


Our particular case involves an application where the data is never actually removed from the table, instead it's flagged and a filter is applied for our set/one-to-many/many-to-many's. Longer term we'd obviously like to remove that deleted data into archive tables, but that's not on the agenda right now.

This process is working fairly well for all cases except for the many-to-one.


Any ideas/comments?


Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 26, 2008 8:09 am 
Newbie

Joined: Wed Mar 26, 2008 7:54 am
Posts: 1
Location: Zürich, Switzerland
I am interested in an answer as well.

There are patches floating around that add filters to many-to-one relations, but I found no explanation why they were not added to any release yet.

We do not have historical data but data that depends on the language (and some more attributes), tables look like this one:

Quote:
Id (PK) ¦ Code ¦ Name ¦ Language
1 ¦ 01 ¦ Example ¦ english
2 ¦ 01 ¦ Beispiel ¦ german


Every entity that references above entity references the non unique code, that is why a many-to-one relationship without filter throws an exception.

Is there a possible workaround? The database design is fixed, I have no influence on that.


Thanks,
Thomas


Top
 Profile  
 
 Post subject: I agree
PostPosted: Wed Apr 09, 2008 4:02 pm 
Newbie

Joined: Wed Nov 29, 2006 4:09 am
Posts: 1
Our project would need this feature as well. I think if hibernate would implement s.th. like this to support temporal datamodels it would be a nice additional feature that competitors don't have.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.