-->
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.  [ 5 posts ] 
Author Message
 Post subject: Update index when editing a referenced object
PostPosted: Thu Dec 03, 2009 10:37 am 
Newbie

Joined: Thu Dec 03, 2009 10:07 am
Posts: 5
Hello, I have some problem to update my index.

I have two classes, Customer and Person, and I would like to search Customer using Hibernate search. Here is a simple schema representing my classes:

Customer
Code:
class Customer {
    String accountNumber;
    Person person;
}


Person
Code:
class Person {
    String lastName;
    String firstName;
    ...
}


I use @IndexedEmbedded on the person property to access Person information in the Customer index. I just want to index Customer with Person information embedded, and not creating another index with Person information.

The problem is that I'd like to update the Customer index when a Person is updated.

Is it possible ?

Thanks in advance for responses.


Top
 Profile  
 
 Post subject: Re: Update index when editing a referenced object
PostPosted: Fri Dec 04, 2009 6:36 am 
Newbie

Joined: Wed Mar 08, 2006 11:12 am
Posts: 16
Hi,
try to place @ContainedIn annotation on opposite side of the customer - person relationship. This relationship must be bidirectional.

It means
Code:
class Person {
....
@ContainedIn
private Customer customer;
}


Top
 Profile  
 
 Post subject: Re: Update index when editing a referenced object
PostPosted: Fri Dec 04, 2009 6:50 am 
Newbie

Joined: Thu Dec 03, 2009 10:07 am
Posts: 5
Person class does not contain a Customer property.

Is there a way to do without adding the property ?


Top
 Profile  
 
 Post subject: Re: Update index when editing a referenced object
PostPosted: Fri Dec 04, 2009 6:57 am 
Newbie

Joined: Wed Mar 08, 2006 11:12 am
Posts: 16
no, as far as i know.

see: http://docs.jboss.org/hibernate/stable/search/reference/en/html/search-mapping.html#search-mapping-associated


Top
 Profile  
 
 Post subject: Re: Update index when editing a referenced object
PostPosted: Fri Dec 04, 2009 8:19 am 
Newbie

Joined: Thu Dec 03, 2009 10:07 am
Posts: 5
Thanks for your response.

Currently, to solve my problem, I reindex the customer programmatically and it works.

If there is a better solution, I take it :)

Thanks


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