-->
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.  [ 3 posts ] 
Author Message
 Post subject: Hibernate Seach of a VIEW of the actual indexed entity
PostPosted: Thu Jun 19, 2008 1:20 pm 
Newbie

Joined: Thu Jun 19, 2008 1:03 pm
Posts: 4
Hi. This is my first post here. I am evaluating the use of Hibernate Search to optimize an existing Hibernate query that searches a database VIEW, call it MyItemView, over the entity being searched, call it MyItem. In other words, the entity being searched (the view class) is never updated. MyItem is the entity I want to index. But I don't search for objects of MyItem because it is a heavyweight class with a lot of ManyToOne mappings. MyItemView joins the tables needed and presents a flat Java bean.

Is there a solution to this sort of problem? Thanks.

_________________
Richard Brewster
Senior Associate
Perrin Quarles Associates


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jun 22, 2008 1:30 pm 
Hibernate Team
Hibernate Team

Joined: Thu Apr 05, 2007 5:52 am
Posts: 1689
Location: Sweden
Hi,

Hibernate Search could be just the thing for you :)
At indexing time you can index just whatever properties you need. You can use @indexEmbedded to include properties from associated objects into your Lucene document. In case it is to expensive to load the full object at search time you might even use Hibernate Search projections. Effectively you are storing all the information you need in the Lucene index so that when it comes to data retrieval you can bypass the database access completely. Note though that you won't get managed objects back in this case, but Object arrays. However, implementing your own ResultTransformer will allow you to map your custom bean with just the information you need.

Overall it seems to me that Hibernate Search fulfills your requirements, but I recommend you to start reading the online documentation in order to get full understanding on what Hibernate Search can do and what not.

--Hardy


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 24, 2008 12:24 pm 
Newbie

Joined: Thu Jun 19, 2008 1:03 pm
Posts: 4
This didn't help. Perhaps I did not state the problem well enough. The search presently goes against a database VIEW, not the table corresponding to the Hibernate entity I want to search. The VIEW is mapped to a different Hibernate Entity that is read-only. The VIEW mapping class has:

@org.hibernate.annotations.Entity(mutable = false)

Using projections when searching the primary entity wouldn't help, because the ManyToOne fields are from code tables. Those always have to be loaded anyway. The VIEW optimizes this by joining them in a precompiled SQL query, which is one of the benefits of using a VIEW. And Hibernate does not have to join anything to the VIEW object.

From the number of reads of this post, compared to the number of answers, I am concluding that this simply is impossible with Hibernate Search. It can only be used to search for the same Entities that are mapped into Lucene.

I would have to completely reimplement the search and ditch the VIEW approach. That would require a great deal of change to the application. Thus it appears that though Hibernate Search would yield performance gains during search, in this case it would incur significant development cost and change risk.

Thanks.

_________________
Richard Brewster
Senior Associate
Perrin Quarles Associates


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