-->
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.  [ 4 posts ] 
Author Message
 Post subject: Index Not Being Updated
PostPosted: Wed Feb 09, 2011 7:03 am 
Beginner
Beginner

Joined: Wed Feb 09, 2011 6:49 am
Posts: 22
Hi,

I am having trouble trying to figure out why my index is not being updated. so any help would be most appreciated.

the code is as follows:
Code:
@Entity
@Name("profile")
@Table(name = "PROFILE")
public class Profile implements Serializable {
   @Id
   public Long getId() {
      return id;
   }

   public void setId(Long id) {
      this.id = id;
   }

        @ContainedIn
   @OneToMany(mappedBy="profile")
   public List<Item> getItemList() {
      return itemList;
   }

        @IndexedEmbedded
   @OneToOne(cascade = {CascadeType.PERSIST, CascadeType.MERGE})
   @PrimaryKeyJoinColumn(name = "PROFILE_ID", referencedColumnName = "CONTACT_ID")
   public Contact getContact() {
      return contact;
   }
}


@Entity
@Indexed
@Name("item")
@Table(name = "ITEM")
public class Item implements Serializable {
        @DocumentId
   @Id
   public Long getId() {
      return id;
   }

   @IndexedEmbedded(depth=3)
   @ManyToOne
   @JoinColumn(name = "PROFILE_ID_FK")
   public Profile getProfile() {
      return profile;
   }
}


@Embeddable
@Entity
@Name("contact")
@Table(name="CONTACT")
public class Contact implements Serializable {

        public String email;
       
        @Id
   public Long getId() {
      return id;
   }

        @OneToOne(mappedBy="contact", cascade = {CascadeType.PERSIST, CascadeType.MERGE})
   @ContainedIn
   public Profile getProfile() {
      return profile;
   }
}



okay so the problem is when i update any fields on Contact (say the email value) they are not reflected in the Item index. Although when i view the Item index in Luke i can see the relationship (profile.contact.email) but only old values.

I am using Seam and thus JPA so the EntityManager for the project.

any ideas as what i need to change to see the updates in the Item index?

Thanks


Last edited by HibSearchUser80 on Wed Feb 09, 2011 11:21 am, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: Index Not Being Updated
PostPosted: Wed Feb 09, 2011 10:27 am 
Regular
Regular

Joined: Fri Jan 28, 2011 11:44 am
Posts: 117
Have you tried adding CascadeType.REFRESH ??


Top
 Profile  
 
 Post subject: Re: Index Not Being Updated
PostPosted: Wed Feb 09, 2011 10:41 am 
Beginner
Beginner

Joined: Wed Feb 09, 2011 6:49 am
Posts: 22
overmeulen wrote:
Have you tried adding CascadeType.REFRESH ??


yes, well actually i changed it to CascadeType.ALL and still the same result


Top
 Profile  
 
 Post subject: Re: Index Not Being Updated
PostPosted: Wed Feb 09, 2011 12:19 pm 
Beginner
Beginner

Joined: Wed Feb 09, 2011 6:49 am
Posts: 22
HibSearchUser80 wrote:
overmeulen wrote:
Have you tried adding CascadeType.REFRESH ??


yes, well actually i changed it to CascadeType.ALL and still the same result


Right, fixed it! apparently the associated object must also be indexed! hence in this instance the Profile.
thanks


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 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:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.