How to resolve No identifier specified for entity?

Hi experts,

After a long break trying to deal with debug Eclipse debugging issue, I am back with another Hibernate problem which needs assistance.

I have trawled the net for an answer but to no avail.

Here’s the error. Please see attachedto%20post%20to%20Hibernate%20forum

Here’s what I have put my @Id in my model User:(I have attempted several times to copy more code but this is what your system allows only)

@Id
@Column(name="userId", nullable=false)
@GeneratedValue(strategy = javax.persistence.GenerationType.IDENTITY)
private static User userId; 

public static User getUserId() {
	return userId;
}

public void setUserId(User userId) {
	User.userId = userId;
}

Hope someone can tell me how to resolve the error

Why are you using static? That’s probably your issue.

Well, I did not use static (and I read it’s bad to use static because of difficulty to test later and bad coding practice etc).

However, Eclipse keeps wanting me to add in static since I am using User Type instead of this.

Erm…do you know how to get rid of Eclipse error message not to change to static ?

The id should be a Long or an Integer not a User. And remove static too.

Hi both,

Thank you. I have removed static and it has no more error.

Also, I blamed Eclipse wrongly.

I was so blind to the error - cos what happened was that I created a new 'instance ‘variable’ User user and then I use the type User.getUserId and no wonder Eclipse is telling me error…so I am the stupid one.

Thanks again you guys for spotting my error.