hibernate - JPA Mapping in Master/Detail Table Structure -
i have 2 tables : uploading : uid - primary key,autogenerated
public class uploading { @id @generatedvalue(strategy=generationtype.auto) private long uid; private string user; @temporal(temporaltype.timestamp) private date utime; private string ustatus; @onetomany(cascade = cascadetype.all,fetch = fetchtype.lazy) @joincolumn(name="uid", referencedcolumnname="uid") private list<snow> snow; }
and, snow: uid + incident- composite key
@embeddable public class snowkey implements serializable { private static final long serialversionuid = 1l; private long uid; private string incident; } public class snow { @embeddedid private snowkey key; .......... }
and, there many "snow" entries single "uploading" so, have used fetchtype.lazy. definition ok, if how can insert both tables now.
also can use bidirectional mapping ?
Comments
Post a Comment