-->
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: Indexing of an 'enum' type
PostPosted: Fri May 07, 2010 7:33 pm 
Newbie

Joined: Fri Mar 19, 2010 7:00 pm
Posts: 14
Hi OK so I tried the normal annotation syntax to index a class property but it's not working on enum type variables. With a String variable I use this for example:

Code:
@Field(index = Index.UN_TOKENIZED, store = Store.YES)
@Column(name = "first_name")
protected String firstName;


But when I applied the same syntax to an enum variable it doesn't work:

Code:
@Field(index = Index.UN_TOKENIZED, store = Store.YES)
@Column(name = "type")
public enum Type{
    AMATEUR,
    ROOKIE
}


NetBeans says 'annotation type not applicable to this type of declaration'. Can anyone help me on this? I'm very new to Hibernate and Lucene. Thank you!


Top
 Profile  
 
 Post subject: Re: Indexing of an 'enum' type
PostPosted: Sat May 08, 2010 2:20 am 
Pro
Pro

Joined: Wed Oct 03, 2007 2:31 pm
Posts: 205
Firstly @Field cannot be applied at type level it can only be applied at field or method level. You should just be able to do:

Code:
   @Field(name = "author.type")
    @Column(name = "author")
    private AuthorType type;
....

public enum AuthorType {
  BRILLIANT, AVERAGE, POOR
}


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.