Ran into this at runtime when running a EJB on Glassfish using JPA Entities. The problem turned out to be a missing annotation on one of the properties in one of the JPA Entities (@GeneratedValue).
The value in question was the primary key for the table and was auto-generated.
Full corrected code:
@GeneratedValue(strategy = GenerationType.IDENTITY)
private int id;