views:

84

answers:

3

This error is driving me nuts!!!

Caused by: java.lang.NoSuchMethodException: com.mksoft.fbautomate.domain.Account$Type.values()

The same exact class works fine in a separate Groovy file.

Any ideas/help much appreciated.

Most confusing...

http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Enum.html

has no values() method!

Here is my class:

@Entity class Account {
  @Id @GeneratedValue(strategy=GenerationType.AUTO)
  public Long id
  enum Type {MYVALUE}
  @Enumerated(EnumType.STRING)
  public Type type
  public String email
  //  @org.hibernate.annotations.Type(type="encryptedString")
  public String pass
  public String fullName
  String toString() { "type:\""+type+"\",email:\""+email+"\""+",fullName=\""+fullName+"\"" }
}

Thank you! Misha

+1  A: 

Ok for the record, if I move the enum declaration outside the entity it works.

Very very odd...

Misha

Misha Koshelev
A: 

Are you using maven? I am getting similar problem with maven and Enum classes. It seems maven has some problem in dealing with annotations. Apparantely mavn-compiler-plugin is supposed to fix the annotation related problem but I am still getting this problem.

saurabh
I am using gradle.
Misha Koshelev
A: 

declare your enum as public

public enum Type {MYVALUE}

inside your entity

Renaud