GSONを使用して、 ProfileというJPAエンティティをサーバーからクライアントに渡しています
@Entity
public class Profile implements Serializable
{
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
.
.
.
}
GSON コード:
Gson gson = new Gson();
Profile profile = gson.fromJson(json, Profile.class);
しかし、私は得ています:
java.lang.NoClassDefFoundError: javax.persistence.Id
java.lang.reflect.Field.getDeclaredAnnotations(Native Method)
java.lang.reflect.Field.getDeclaredAnnotations(Field.java:188)
java.lang.reflect.AccessibleObject.getAnnotations(AccessibleObject.java:188)
java.lang.reflect.AccessibleObject.getAnnotation(AccessibleObject.java:196)
com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getFieldName(ReflectiveTypeAdapt erFactory.java:60)
com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:118)
com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:72)
com.google.gson.Gson.getAdapter(Gson.java:353)
com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.<init>(ReflectiveTypeAdapterFactory.java:82)
com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.createBoundField(ReflectiveTypeAdapterFactory.java:81)
com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:118)
com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:72)
com.google.gson.Gson.getAdapter(Gson.java:353)
com.google.gson.Gson.fromJson(Gson.java:754)
com.google.gson.Gson.fromJson(Gson.java:721)
com.google.gson.Gson.fromJson(Gson.java:670)
com.google.gson.Gson.fromJson(Gson.java:642)
これを修正するにはどうすればよいですか?