I am trying to compile a Java web application that I am writing and I am getting compilation errors that I am not sure what to do with them. From the googling I did, I found this SO Question, but the trickster is using EJB and my error is in the JPA entity class.
Here's the maven build error.
[INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 3.988s [INFO] Finished at: Mon Jun 24 02:39:51 UTC 2013 [INFO] Final Memory: 15M/247M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project donebox: Compilation failure: Compilation failure: [ERROR] /home/cl-server/builder/tomcat-ide-builder/temp/build-1236514164814552082/src/main/java/net/donebox/accounts/User.java:[50,4] error: annotation type not applicable to this kind of declaration [ERROR] /home/cl-server/builder/tomcat-ide-builder/temp/build-1236514164814552082/src/main/java/net/donebox/accounts/User.java:[60,4] error: annotation type not applicable to this kind of declaration [ERROR] /home/cl-server/builder/tomcat-ide-builder/temp/build-1236514164814552082/src/main/java/net/donebox/accounts/Role.java:[53,4] error: annotation type not applicable to this kind of declaration [ERROR] -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http:
And here is my user class file.
package net.donebox.accounts; import java.io.Serializable; import java.util.UUID; import java.util.HashSet; import java.util.Set; import javax.persistence.Basic; import javax.persistence.Cacheable; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.GeneratedValue; import javax.persistence.Table; import javax.persistence.Column; import javax.persistence.Index; import javax.persistence.ManyToMany; import javax.persistence.JoinTable; import org.apache.shiro.crypto.hash.Sha256Hash; import org.apache.shiro.crypto.RandomNumberGenerator; import org.apache.shiro.crypto.SecureRandomNumberGenerator; @Entity @Table(name="users") public class User { private UUID id; private String username; private String email; private String password; private Set<Role> roles = new HashSet<Role>(); @Id @GeneratedValue public UUID getId() { return id; } public void setId() { this.id = UUID.randomUUID(); } @Basic @Column(length=100) @Index(name="idx_users_username", columnList="username")
I looked at javax.persistence.Index JavaDoc and I have the correct declaration, so I'm at a dead end here. Does anyone know what I'm doing wrong? Thank you for your time and attention.
source share