Data Nucleus-MySql 不正确的 table 定义; auto 列只能有一个并且必须定义为键错误

Data Nucleus-MySql Incorrect table definition; there can be only one auto column and it must be defined as a key error

我正在为我的项目使用带有 MySQL 的 datanucleus。当我尝试保留一个对象时,我收到异常

Incorrect table definition; there can be only one auto column and it must be defined as a key error

我的对象设计如下

Plan.class

public class Plan implements Serializable {


private static final long serialVersionUID = 6653821147113556490L;

@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
@Column(name = "ID")
private Long id;

@Persistent(column = "NAME")
private String planName;

@Persistent(defaultFetchGroup = "true")
@Element(column = "FEATURES")
@Unowned
private Set<PlanFeature> planFeatures;

@Persistent(column = "CURRENCY_TYPE")
private String currency = "USD";

@Persistent(defaultFetchGroup = "true")
@Element(column = "CURRENCIES")
@Unowned
private Set<Currency> currencies;

@Persistent(column = "COST")
private BigDecimal cost = new BigDecimal(0);

@Persistent(column = "COST_INR")
private BigDecimal costINR = new BigDecimal(0);

@Persistent(column = "DISCOUNT")
private BigDecimal discount = new BigDecimal(0);

@Persistent(column = "TEST_TAKERS_ALLOWED")
private Integer testTakersAllowed;

// How many clients have opted for this plan
@Persistent(column = "OPTED_OWNERS")
private Long planOwners = 0L;

@Persistent(column = "PLAN_LEVEL")
private Integer level;
    ......//Getters and setters
}

PlanFeature.class

public class PlanFeature {

    @Persistent(column = "NAME")
    private String name;

    @Persistent(column = "VALUE")
    private String value;
    //Getters and setters    
}

Currency.class

public class Currency implements Serializable {

    private static final long serialVersionUID = 8814737520234672816L;

    @Persistent(column = "ID", valueStrategy = IdGeneratorStrategy.IDENTITY)
    private Long id;

    @Persistent(column = "COUNTRY")
    private String country;

    @Persistent(column = "CURRENCY")
    private String currency;
//Getters and setters
}

我在 class 中没有使用多个 ID。请帮助我。

货币中的 ID 造成了问题。我添加了 @primarykey 注释,它开始工作了。谢谢大家的回复..