java - Hibernate uuid generator relational insertion -
let's have following entities:
@entity public class { @id @type(type = "pg-uuid") @generatedvalue(generator = "uuid") @genericgenerator(name = "uuid", strategy = "uuid2") private uuid id; @onetomany private list<b> bs; // other fields + getter , setter }
and:
@entity public class b { @type(type = "pg-uuid") private uuid aid; // other fields + getter , setter }
during creation of entity a
(save jpa) contains list of b
, there way use a's uuid generator
populate aid
field in b
? or need generate uuid using uuid.randomuuid()
in java , create a/b
entities ?
Comments
Post a Comment