Hibernate Books

All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Indexing a SQL View
PostPosted: Wed Mar 09, 2016 6:42 am 
Newbie

Joined: Wed Mar 09, 2016 6:40 am
Posts: 4
Hi All,

I have created index on an hibernate entity mapped to a database view. How Can I handle/update index when view refresh. Is there any event when view reloads


Top
 Profile  
 
 Post subject: Re: Indexing a SQL View
PostPosted: Wed Mar 09, 2016 6:55 am 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1516
Is this related to Hibernate Search or is it an index in the database and you're referring to ORM?

_________________
If you liked my answer, you are going to love my High-Performance Java Persistence book and my blog as well.


Top
 Profile  
 
 Post subject: Re: Indexing a SQL View
PostPosted: Wed Mar 09, 2016 7:02 am 
Newbie

Joined: Wed Mar 09, 2016 6:40 am
Posts: 4
mihalcea_vlad wrote:
Is this related to Hibernate Search or is it an index in the database and you're referring to ORM?


It is regarding hibernate search indexing only


Top
 Profile  
 
 Post subject: Re: Indexing a SQL View
PostPosted: Tue Mar 29, 2016 3:45 am 
Hibernate Team
Hibernate Team

Joined: Sat Jan 24, 2009 12:46 pm
Posts: 386
Hibernate Search has no way of knowing when your DB view has been refreshed.

One option would be to start the mass indexer to rebuild the index after the view has been refreshed: https://docs.jboss.org/hibernate/search ... batchindex. Or, if you can narrow down the affected entities/records, manually index these entities: https://docs.jboss.org/hibernate/search ... _the_index

Depending on which database you use, you may find a way to automatically trigger re-indexing through Hibernate Search after the view has been refreshed. For instance in Oracle DB, there is the Advanced Queueing API which allows you to enqueue messages into a persistent JMS queue from triggers/PL-SQL scripts which you then can consume in your Java application and trigger re-indexing. It may be doable similarly for other databases.

Hth,

--Gunnar

_________________
Visit my blog at http://musingsofaprogrammingaddict.blogspot.com/


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.