-->
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.  [ 2 posts ] 
Author Message
 Post subject: [Resolved] Update object applying a filter
PostPosted: Wed Oct 17, 2012 6:57 am 
Newbie

Joined: Wed Oct 17, 2012 6:39 am
Posts: 3
Hello all!
I hope I am posting to the right section!
In one of my classes I have a OneToMany relationship:

Code:
    @OneToMany(cascade = CascadeType.ALL)
    @MapKeyColumn(name="keyfield")
    @FilterJoinTable(name = "Class.filterName, condition="field = :val)
    @JoinTable(name = "child_table",
            joinColumns = {@JoinColumn(name = "columnA")},
            inverseJoinColumns = {@JoinColumn(name = "columnB")}
    )   
    private Map<Integer,childTable> children;

The class containing what above mentioned is loaded and then "detached" from the session and passed to another method that has to do stuff with it. In the other method, obviously, children is not initialized (which is the expected behaviour for a lazy loading of course, I never accessed it) so I thought that:

Code:
session.enableFilter('filterName').setParameter('param', 'value');
session.update(myObject);

would load the children applying the filter since in that point the query has still to be ran but I was wrong: the collection holds all children, regardless of the filter. To correctly apply the filter I have to get a new object from the session.

Is there a way to update myObject without the need to load a new object from the session?

Thanks in advance!

Stefano


Top
 Profile  
 
 Post subject: Re: [Resolved] Update object applying a filter
PostPosted: Thu Oct 18, 2012 2:35 am 
Newbie

Joined: Wed Oct 17, 2012 6:39 am
Posts: 3
There was something odd with my Hibernate installation. Now I have a different issue but this one disappeared.


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