Objectify error “You cannot create a Key for an object with a null @Id” in JUnit

后端 未结 2 1416
悲&欢浪女
悲&欢浪女 2021-01-16 02:31

I got the following error while testing a simple piece of code in JUnit that creates a User object (an Objectify Entity) and then tries to attach it as a Parent

2条回答
  •  伪装坚强ぢ
    2021-01-16 03:08

    What's the type of 'id' in User class? If it's 'Long', keeping id=null should work. From what you explained, looks like it's 'long' (primitive). if that's the case, change it to 'Long' and try again.

提交回复
热议问题