-->
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.  [ 2 posts ] 
Author Message
 Post subject: Hibernate Lucene integration : IndexReader out of date
PostPosted: Wed Jan 31, 2007 11:49 am 
Newbie

Joined: Fri Dec 15, 2006 6:08 am
Posts: 18
Location: France
Hi,

I'm using Hibernate annotations with lucene in my program.
This simple program persists an entity then delete it just after.
The entity which is persisted is also indexed in a file using lucene.

Here is the code :
Code:
public void run() {
// create alarm
Alarm alarm = new Alarm();
alarm.setName("new");
Alarm created = service.create(alarm);

// get primary key of created alarm
Long pk = created.getOid();
            
// delete alarm
service.delete(pk);
}


Code:
@Entity
@Indexed(index="searchindexes")
public class Alarm {
    private String name;
    private Long oid;
    private Integer version;

    @Field(index=Index.TOKENIZED,store=Store.YES)
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO, generator = "SEQ_STORE")
    @DocumentId
    public Long getOid() {
        return this.oid;
    }

    public void setOid(Long oid) {
        this.oid = oid;
    }

    @Version
    public Integer getVersion() {
        return version;
    }

    public void setVersion(Integer version) {
        this.version = version;
    }
}


I would like to simulate several clients in my application, so I put this code in a Thread. Thus, all clients are executing their requests at the same time.
The problem is that if I execute my application with more than 3 threads, then I get the following exception :
Code:
java.io.IOException: IndexReader out of date and no longer valid for delete, undelete, or setNorm operations
   at org.apache.lucene.index.IndexReader.aquireWriteLock(IndexReader.java:499)
   at org.apache.lucene.index.IndexReader.deleteDocument(IndexReader.java:514)
   at org.hibernate.search.backend.impl.LuceneWorker.remove(LuceneWorker.java:100)


Bellow three simulated users, it works, but with four users or more, It fails!

Hibernate version: 3.2.0
Lucene version: 2.0.0
Name and version of the database you are using: Oracle 10


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 11, 2007 9:35 am 
Newbie

Joined: Fri Dec 15, 2006 6:08 am
Posts: 18
Location: France
The issue has disapeared with version 3.0.0.Beta1.
Thanks for the correction...


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