Reputation:
I've been trying to figure out how to solved this issue:
There must be an @Id field (String, Long, or long)
Although there is a @Id
annoation in the class. I tried doing mvn clean, Eclipse project clean, there is no compile time errors. However when I run my application and try to persist a registered entity, I get this error.
I am using Objectify-4 and using the OfyLoader pattern.
CODE:
import java.util.List;
import com.googlecode.objectify.annotation.Entity;
import com.googlecode.objectify.annotation.Id;
@Entity
public class TestEntity {
@Id
private Long id;
private List<String> strList;
public TestEntity() {}
public TestEntity(List<String> strList){
this.setStrList(strList);
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public List<String> getStrList() {
return strList;
}
public void setStrList(List<String> strList) {
this.strList = strList;
}
}
Upvotes: 2
Views: 753
Reputation: 25450
Make sure on objectify 4 is on your classpath and the only id import is :
import com.googlecode.objectify.annotation.Id;
Upvotes: 2
Reputation: 1458
You should firstly package then run your project. Because if you jetty run, for example, run operation cannot see annotations
Upvotes: 0