I am a little confused about that. When I try to create an entity that without @Id, the compile-time gives me an error that I must set primary key use @Id, and I even can't deploy the application to the application server (I use payara). But the requirement for entity classes in the official Java EE 7 tutorial documentation doesn't contain the rule that an entity must have @Id. And, the definition of an entity in that documentation:
Typically, an entity represents a table in a relational database, and each entity instance corresponds to a row in that table.
But I can create a data-table that without primary key.
So my question is actually that why do we must set @Id in an entity. Are there any other considerations? For example, use the @Id to identify a specific entity in persistence context, so that we can use em.find(id)? And what should I do if I insist on creating an entity without @Id, lol.
Thanks for your help.