I've found another issue with 4.1.M1 through my unit tests. If you have: 1) modeled a primary key as an ObjAttribute, like customerPK 2) modeled it as an object type, like java.lang.Long 3) are using the Cayenne-Generated (Default) PK generation strategy
Then Cayenne won't generate any PKs for the entity and will just use zero over and over. This can be worked around by switching the attribute's type to a primitive (like long). The reason for this is that the entity template will generate the field as a primitive long even though it was modeled because as java.lang.Long because it knows that this attribute is mandatory. I'm ok with the template as is, but ideally the runtime would do the right thing in this case and still generate PKs instead of using zero.