-->
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: @IndexedEmbedded on a bi-directional OneToMany indexed
PostPosted: Tue Nov 10, 2009 8:52 am 
Newbie

Joined: Thu Sep 10, 2009 9:59 am
Posts: 4
Hi, I'm having problems using @IndexedEmbedded on a bi-directional OneToMany indexed collection relationship. My entities look like this:

Code:
@Entity
@Indexed
class Item {
...
    @OneToMany(targetEntity = Bid.class)
    @IndexedEmbedded
    @IndexColumn(name = "bidIdx")
    public List<Bid> getBids() {
      return bids;
    }

}

@Entity
class Bid
...
   @ManyToOne(targetEntity = Item.class)
       @JoinColumn(insertable = false, updatable = false, nullable = false)
       @ContainedIn
       public Item getItem() {
         return item;
       }
       
   @Field(index = Index.TOKENIZED, store = Store.NO)
       public String getStringValue() {
         return stringValue;
}


Actually our problem differs a little bit, but basically it's a bidirectional indexed relationship between an item and its bids. In Hibernate the suggested way to do this is like above, namely to map this from the collection side, because of the @IndexColumn. Now, nothing about an item's bids is written to the index. I'm having the feeling that this has something to do with the fact, that this relationship isn't really bidirectional (no mappedBy).

What do you think?


Top
 Profile  
 
 Post subject: Re: @IndexedEmbedded on a bi-directional OneToMany indexed
PostPosted: Wed Nov 11, 2009 5:04 am 
Hibernate Team
Hibernate Team

Joined: Thu Apr 05, 2007 5:52 am
Posts: 1689
Location: Sweden
The code looks ok to me. How to you know that nothing is written to the index? Did you use Luke to inspect the index?
How do you index. Do you rely on automatic indexing or do you create an initial index using the indexing API?
It would help to see the indexing and search code you are trying to run.

--Hardy


Top
 Profile  
 
 Post subject: Re: @IndexedEmbedded on a bi-directional OneToMany indexed
PostPosted: Thu Nov 12, 2009 9:17 am 
Newbie

Joined: Thu Sep 10, 2009 9:59 am
Posts: 4
Hi,

all right, now we've got exactly the same situation in another project, and it works fine. Seems like we've done some strange things in this particular project. Haven't figured out what, but it's probably our fault, not a bug.

Thanks, anyway.


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.