-->
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.  [ 6 posts ] 
Author Message
 Post subject: Multiple Entities mapping to single document
PostPosted: Mon Nov 15, 2010 10:43 am 
Pro
Pro

Joined: Wed Oct 03, 2007 2:31 pm
Posts: 205
This may be a strange question but is it possible to map multiple entities to a single document. For example Entity A and Entity B maps to a Combined Entity lucene document?


Top
 Profile  
 
 Post subject: Re: Multiple Entities mapping to single document
PostPosted: Mon Nov 15, 2010 6:21 pm 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
Hi Amin!
that's exactly what @IndexedEmbedded does.. having a different use case?

_________________
Sanne
http://in.relation.to/


Top
 Profile  
 
 Post subject: Re: Multiple Entities mapping to single document
PostPosted: Tue Nov 16, 2010 2:55 am 
Pro
Pro

Joined: Wed Oct 03, 2007 2:31 pm
Posts: 205
Hi Sanne

If I remember correctly @IndexEmbedded is when Entity A has a relationship with Entity B. My usecase is where Entity A and Entity B have a relationship via a common business key. What I am interested is getting the business key and passing it to another service.

I have a Category object and a TypeOfQuery object both are indexed in separate documents. They may have the same business key. I want to execute a boolean query where category and type of query must both exist. At present it's not possibel to do this because a single document does not contain both category and type of query.

Thanks
Amin


Top
 Profile  
 
 Post subject: Re: Multiple Entities mapping to single document
PostPosted: Tue Nov 16, 2010 5:55 am 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
It seems to me you're actually modelling a relation, so why don't you have a relation between the entities?

I might not have understood the example, in this case please send me a code example.

as a workaround, you can use another @Indexed pojo containing links to both of your objects - it does't need to be a persistent entity.
In alternative, would a custom ClassBridge not work for you?

_________________
Sanne
http://in.relation.to/


Top
 Profile  
 
 Post subject: Re: Multiple Entities mapping to single document
PostPosted: Tue Nov 16, 2010 1:25 pm 
Pro
Pro

Joined: Wed Oct 03, 2007 2:31 pm
Posts: 205
Hi Sanne

We have some legacy entity model which I don't want to touch at this stage. We've got a work around. What is great is that I've managed to get free text search into project using HSearch without any major effort and it works like a beauty. I do enjoy using HSearch.

Amin


Last edited by amin-mc on Tue Nov 16, 2010 1:32 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: Multiple Entities mapping to single document
PostPosted: Tue Nov 16, 2010 1:26 pm 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
that's great to hear. what was your workaround?

_________________
Sanne
http://in.relation.to/


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