Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hibernate generate random entity

It istrong texts possible to easily generate random entity using hibernate. For example, I have got a simple entity User with 2 fields (name and surname) and I need to create 100 different entities.

Is it possible using Hibernate to create different entities with random fields? And when I have a table Phones with relation ManyToOne with User can I also create 10 different random phones?

Does Hibernate have a class or function to do this?

like image 428
Łukasz Woźniczka Avatar asked Jan 25 '26 15:01

Łukasz Woźniczka


1 Answers

This is not a problem that Hibernate has attempted to solve since it is an ORM.

This is an entirely different problem and for the simple case you describe should be fairly easy to do yourself.

However, when you start talking lots of tables and validation etc. this is not a very easy problem at all.

like image 165
Alex Barnes Avatar answered Jan 28 '26 07:01

Alex Barnes



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!