java - mappedBy reference an unknown target entity property -
i having issue in setting 1 many relationship in annotated object.
i have following:
@mappedsuperclass public abstract class mappedmodel { @id @generatedvalue(strategy=generationtype.auto) @column(name="id",nullable=false,unique=true) private long mid; then this
@entity @table(name="customer") public class customer extends mappedmodel implements serializable { /** * */ private static final long serialversionuid = -2543425088717298236l; /** collection of stores. */ @onetomany(mappedby = "customer", cascade = cascadetype.all, fetch = fetchtype.lazy) private collection<store> stores; and this
@entity @table(name="store") public class store extends mappedmodel implements serializable { /** * */ private static final long serialversionuid = -9017650847571487336l; /** many stores have single customer **/ @manytoone(fetch = fetchtype.lazy) @joincolumn (name="customer_id",referencedcolumnname="id",nullable=false,unique=true) private customer mcustomer; what doing incorrect here
the mappedby attribute referencing customer while property mcustomer, hence error message. either change mapping into:
/** collection of stores. */ @onetomany(mappedby = "mcustomer", cascade = cascadetype.all, fetch = fetchtype.lazy) private collection<store> stores; or change entity property customer (which do).
the mappedby reference indicates "go on over bean property named 'customer' on thing have collection of find configuration."
Comments
Post a Comment