Every entity object in the database is uniquely identified.
An alternate way to represent a table without a primary key is to use a composite primary key using all its columns, or some of them representing a candidate key:
@Entity
public class TableWithoutId {
@EmbeddedId EmbeddableTableWithoutId id;
/* Getters an Setters... */
//Here you can implement @Transient delegates to the Getters an Setters of "id".
}
@Embeddable
Class EmbeddableTableWithoutId {
int columnA;
long columnB;
/* Getters an Setters... */
}
Maybe you will have problems with [Select By Id]:
entityManager.find(TableWithoutId.class, id);//it can throws NonUniqueResultException or anything like that...
Take care and be happy!!!