can't find sign error
My JDK version is 1.6.0-rc,my code is following:
package org.annotationmvc.vo;
import java.io.*;
import javax.persistence.*;
@Table (name="myobject")
publicclass MyObjectVOimplements Serializable{
privateint id;
private String name;
public MyObjectVO(){
}
publicvoid setId(int id){
this.id = id;
}
publicvoid setName(String name){
this.name = name;
}
@Id (generate = GeneratorType.AUTO)
publicint getId(){
return id;
}
@Column (length=100)
public String getName(){
return name;
}
}
when I compile it,it raise follow error:
can't find sign
[javac] sign:method generate()
[javac] location: @interface javax.persistence.Id
[javac]@Id (generate = GeneratorType.AUTO)
[javac] ^
[javac]
[javac] sing: variable GeneratorType
[javac] location: class org.annotationmvc.vo.MyObjectVO
[javac]@Id (generate = GeneratorType.AUTO)
[javac] ^
[javac] 2 errors:
Why raise above error?
Thanks
Whoops! posted before I finished my message.......
Here is a link that may help:
http://www.developer.com/java/ent/print.php/10933_3577101_1
I used hibernate, but not annotations (@Id (generate = GeneratorType.AUTO). So I'm guessing here.
I assume with annotations, you still need this in your person.hbm.xml file (or whatever you call it):
<id name="personID"
type="int"
column="PERSON_ID"
><generator class="native" />
</id>
If the above is missing, that may cause your error. If that doesnt solve it, then I suggest going to your database table, make sure the id field is a defined as a primary unique key. Then, remove any autogeneration trigger on the database side that increaments the primary key when a new record is inserted (hibernate doesnt use it). If that still doesnt work, try MAKING an autogeneration trigger on the database side to increament the primary key when a record is inserted. If that still doesn't work, I suggest researching how autogeneration works with annotation becuase I'm out of ideas.