-->
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: Contextualizing IndexEmbedded
PostPosted: Tue May 11, 2010 7:37 am 
Newbie

Joined: Wed Feb 10, 2010 5:07 am
Posts: 11
I want to index a collection in a bean only if the top level bean being indexed is of a certain type.

For instance, if I have House, Room, Box and Toy beans (House contains Rooms, Room contains Boxes, Box contains Toys).

I want to index everything when I index on House, but I don't want to index Toys when I index on Room. The "depth" attribute in @IndexEmbedded will not help me in this situation.


Top
 Profile  
 
 Post subject: Re: Contextualizing IndexEmbedded
PostPosted: Tue May 11, 2010 12:05 pm 
Hibernate Team
Hibernate Team

Joined: Thu Apr 05, 2007 5:52 am
Posts: 1689
Location: Sweden
Can you elaborate on your usecase and why you don't want to index toys when you are indexing the room? Which entities are you actually querying?


Top
 Profile  
 
 Post subject: Re: Contextualizing IndexEmbedded
PostPosted: Wed May 12, 2010 7:40 am 
Newbie

Joined: Wed Feb 10, 2010 5:07 am
Posts: 11
The reasons why I want to do this are not so relevant I think, but mostly because of time generation of indexes.

I want to index a subset of the top level entity (House, in this example), and all of the lower level entity (Room). There is a bug in Hibernate using FetchMode.JOIN in scroll mode before indexing collections (http://opensource.atlassian.com/projects/hibernate/browse/HHH-1283) so it takes forever if I want to index collections on Room, for instance, but not on my subset of House, as I am indexing very few.

Again, as to what entities I am actually indexing, I'm not sure how this can provide any extra information. My example provides enough information I think.

In pseudocode it is like this:
Code:
@Indexed
class House {

private Set<Room> rooms;

@IndexEmbedded
public Set<Room> getRooms() {
return rooms;
}

}

@Indexed
class Room {

private Set<Box> boxes;

@IndexEmbedded
public Set<Box> getBoxes() {
return rooms;
}

}


... and so on to Box & Toy

What I want to know is, can I index Boxes collection in Room only when I am indexing House, but not when I index Room.

Thanks for your time,

Steve


Top
 Profile  
 
 Post subject: Re: Contextualizing IndexEmbedded
PostPosted: Wed May 12, 2010 8:09 am 
Hibernate Team
Hibernate Team

Joined: Thu Apr 05, 2007 5:52 am
Posts: 1689
Location: Sweden
Just with @IndexedEmbedded you can really not achieve what you want. In case you are only querying the House index you can just remove the @Indexed annotation on Room. Then you would have the behavior you want.

Alternatively skip @IndexedEmbedded in House and Room and use a custom bridge instead where you control yourself what and how to add to the index.

--Hardy


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.