[英]create fixture using hibernate(not import.sql method)
Is there a way to use java code and those hibernate entity classes to create fixture data. 有没有一种方法可以使用Java代码和那些休眠实体类来创建夹具数据。
I find using import.sql is not good when it comes to database migration 我发现在数据库迁移方面使用import.sql不好
Since you are using hibernate, the way to create sample data is to use hibernate itself to create it. 由于您正在使用休眠方式,因此创建示例数据的方法是使用休眠本身来创建它。 You have two options:
您有两种选择:
That way your data generation is tied to your entity model, and when the model changes, your data won't become out-of-sync. 这样,您的数据生成将与实体模型联系在一起,并且当模型更改时,您的数据将不会变得不同步。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.