java - Foreign key relationship in nested one-to-many -
i have these classes, unidirectional one-to-many relationship mappings below:
@entity public class databasedetailsvo { @id // primary key databasedetailsvo private string databasename; @onetomany private list<tabledetailsvo>; } @entity public class tabledetailsvo { @id // primary key of tabledetailsvo must database name // , tablename databasename foriegn key databasedetailsvo private string tablename; @onetomany private list<columndetailsvo>; } public class columndetailsvo { @id // primary key of columndetailsvo must columnname // databasename , tablename foriegn key tabledetailsvo private string columnname; private string columndatatype; ... }
how address using hibernate annotations? using hibernate 3.3.1 version.
@onetomany(fetch = fetchtype.lazy, mappedby = "databasedetailsvo") public set<tabledetailsvo> gettabledetailsvos() { return this.stocktabledetailsvos; }
this link should - mkyong
Comments
Post a Comment