Hi Sanne,
Sorry for the late reply. I was trying to collect enough information whether an upgrade will work but it is not (A strange error).
Environment: Hibernate Search 3.1.1 Hibernate 3.3.1
File List Space.java package com.fiesta.ws.portal.bean;
@Entity @Indexed(index = "Space") @Boost(value = PortalConstants.BOOST_SPACE) public class Space extends BaseDAOBean implements Serializable, Cloneable { private static final long serialVersionUID = 1L; @DocumentId(name = "spaceId") private Long id; @Field(name = "spaceName", index = Index.TOKENIZED, store = Store.NO) @Boost(value = PortalConstants.BOOST_TITLE) private String name; @Field(name = "spaceStatus", index = Index.UN_TOKENIZED, store = Store.NO) private String status;
@ContainedIn @OneToOne(cascade = { CascadeType.PERSIST, CascadeType.REMOVE }) @Field(name = "spaceLastUpdatedDate", index = Index.UN_TOKENIZED, store = Store.NO) @DateBridge(resolution = Resolution.MILLISECOND) private Date updatedAt; @ContainedIn @OneToMany(mappedBy = "spaceLastUpdatedDate", cascade = { CascadeType.PERSIST, CascadeType.REMOVE }) @IndexedEmbedded(depth = 1, prefix = "folder_") private Space parent; @Field(name = "spaceType", index = Index.UN_TOKENIZED, store = Store.NO) private String type; @ContainedIn @OneToMany(mappedBy = "spaceLastUpdatedDate", cascade = { CascadeType.PERSIST, CascadeType.REMOVE }) @IndexedEmbedded(depth = 1, prefix = "folder_") @Boost(value = PortalConstants.BOOST_FOLDERS) private Set<Space> folders; }
Space.hbm.xml <hibernate-mapping> <class name="com.fiesta.ws.portal.bean.Space" table="space"> <id name="id" type="java.lang.Long"> <column name="id" /> <generator class="identity" /> </id> <property name="name" type="string"> <column name="name" length="255"/> </property> <property name="description" type="string"> <column name="description" length="1024"/> </property> <property name="createdAt" type="java.util.Date"> <column name="created_at" /> </property> <property name="updatedAt" type="java.util.Date"> <column name="updated_at" /> </property> <property name="status" type="string"> <column name="status" length="1" /> </property> <property name="parentId" type="java.lang.Long" update="false" insert="false"> <column name="parent_id" /> </property> <many-to-one name="parent" class="com.fiesta.ws.portal.bean.Space" lazy="proxy"> <column name="parent_id" /> </many-to-one> <property name="type" type="string"> <column name="type"/> </property> <many-to-one name="createdBy" class="com.fiesta.ws.portal.bean.User" lazy="proxy"> <column name="creator_id" /> </many-to-one> <set name="folders" inverse="true" lazy="true" fetch="subselect" where="type = 'F'"> <key> <column name="parent_id" /> </key> <one-to-many class="com.fiesta.ws.portal.bean.Space" /> </set> </class> </hibernate-mapping>
SpaceAction.java Space folder = spaceDao.getSpaceById(folderId); folder.setName(folderName); folder.setUpdatedAt(new Date(System.currentTimeMillis())); Space parent = folder.getParent(); log.info("Updating folder..."); parent.getFolders().add(folder); parent.setUpdateAt(new Date(System.currentTimeMillis())); spaceDao.update(parent);
Please let me know if you need further information. It worked well when eager loading of folders were used, but we turned lazy="proxy"/lazy="true" for performance reasons. After the change, when we edit folder name it is not updating indices.
NOTE: I am seeing these logs.
[DEBUG] 04 Nov 2010 16:11:24,129 [TP-Processor8] [org.hibernate.search.backend.impl.EventSourceTransactionContext.getIndexWorkFlushEventListener():84] : No FullTextIndexEventListener was registered [DEBUG] 04 Nov 2010 16:11:24,129 [TP-Processor8] [org.hibernate.search.backend.impl.EventSourceTransactionContext.getIndexWorkFlushEventListener():84] : No FullTextIndexEventListener was registered [DEBUG] 04 Nov 2010 16:11:24,211 [pool-1-thread-1] [org.hibernate.search.backend.impl.lucene.PerDPQueueProcessor.useWriterOnly():154] : Skipping usage of an IndexReader for updates [DEBUG] 04 Nov 2010 16:11:24,211 [pool-1-thread-1] [org.hibernate.search.backend.impl.lucene.PerDPQueueProcessor.performWriterWorks():103] : Opening an IndexWriter for update
|