When migrating from JDO to Objectify, It’s often the case where you need them to co-exist during the transition. Here is my case:
Suppose that you have an entity called UserProfile
defined as follows:
1 2 3 4 5 6 7 8 9 10 11 12 |
|
A pretty normal JDO-annotated entity. Now reading on-line people say that Ofy and JDO can co-exist. So I tried something like:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
|
Notice that I’m explicitly ignoring the key. However I get the following vey cryptic exception:
java.lang.NoClassDefFoundError: Could not initialize class com.x.model.OfyService
The solution I found was to leave UserProfile intact and create a new class:
1 2 3 4 5 6 7 8 9 10 |
|
Notice the name
parameter in the @Entity
annotation.