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


i using datanucleus mysql project. when try persist object receiving exception

incorrect table definition; there can 1 auto column , must defined key error

my object design follows

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 plan @persistent(column = "opted_owners") private long planowners = 0l;  @persistent(column = "plan_level") private integer level;     ......//getters , setters } 

planfeature.class

public class planfeature {      @persistent(column = "name")     private string name;      @persistent(column = "value")     private string value;     //getters , 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 , setters } 

i not using more 1 id in of class. please me.

the id in currency creating problem. added @primarykey annotation , started working. thank replies..


Comments

Popular posts from this blog

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

java - Android – MapFragment overlay button shadow, just like MyLocation button -