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

Popular posts from this blog

'hasOwnProperty' in javascript -

How to put a lock and transaction on table using spring 4 or above using jdbcTemplate and annotations like @Transactional? -

How to understand 2 main() functions after using uftrace to profile the C++ program? -