-->
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: mapping associations with hibernate search
PostPosted: Mon Jul 02, 2012 9:27 am 
Regular
Regular

Joined: Thu Jun 16, 2011 12:03 pm
Posts: 94
hi all,

I am facing a problem with my hibernate search application. I have two entities: Author, Item. I have a third one called Rol meaning that an author has some rol in the item.

_ _ ROL(Item,Author,Rol) _ _
| |
| |
| |
Author Item

I have been checking in internet and Hibernate Search in action book, but i didnt find something similar. In page 136 there is an example but not with Rol entity.

My problem is that i want to create an author index and an item index. If i modify the author name, i would like to update automatically my Item index. I have been playing a little bit with @IndexedEmbbeded and @ContainedIn but i couldn't make it. It tooks a lot time to index all instances...

I would like to know how should i annotate my entities.

Code:
public class AuthorItemRolEntity implements Serializable
{
..........
   @ContainedIn
   private ItemEntity item;
   
   @IndexedEmbedded
   //@ContainedIn
   private AuthorEntity author;
   
   /** The rol. */
   private Rol rol;
..........
}

@Indexed
public class AuthorEntity implements Serializable
{
..........
   /** The nombre. */
   @Field(name = "name_normalized", index = Index.UN_TOKENIZED, indexNullAs = "NULL")
   protected String name;

   @ContainedIn
   protected List<AuthorItemRolEntity> authorItemRol;

   @IndexedEmbedded
   protected List<NameAutoridadEntity> authorName;
..........
}

public class ItemlEntity implements Serializable
{
    @IndexedEmbedded(depth=2)
   protected List<AuthorItemRolEntity> authorItemRol;


Thanks in advance,


Top
 Profile  
 
 Post subject: Re: mapping associations with hibernate search
PostPosted: Mon Jul 02, 2012 10:16 am 
Regular
Regular

Joined: Thu Jun 16, 2011 12:03 pm
Posts: 94
maybe the easiest thing is to index manually all the items related with the author when i change the author name....

or indexing all data every night (i saw that in the hibernate search in action book).....

any ideas?


Top
 Profile  
 
 Post subject: Re: mapping associations with hibernate search
PostPosted: Tue Jul 03, 2012 3:35 am 
Regular
Regular

Joined: Thu Jun 16, 2011 12:03 pm
Posts: 94
Hi all,

i am thinking about creating a process to index all related data. If i change an author name, i index all items with a process...

is there any way of doing this with an event like a trigger on a database or should i just call my process like other java function?

thanks!


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.