benerator は使用するツールであり、非常に柔軟ですが、かなり早く習得する必要があります。私の上記の状況では、benerator の xml ファイル (それが使用するもの) で、次のように書くだけで準備完了です。実際、、、および日付の範囲を設定できるようmade
にstart
なりend
ました。これは、これらの日付を持つエンティティ (MY_ENTITY と呼びましょう) の 30 レコードの生成タグのセクションです。
<import class="org.databene.commons.TimeUtil"/>
<generate name="MY_ENTITY" count="30" consumer="ENTITY_OUT">
<attribute name="MADE_DATE" type="date" script ="TimeUtil.today()" />
<variable name= "for_startDate" type="int" min="0" max="10" />
<attribute name="START_DATE" type="date" script="TimeUtil.addDays(this.MADE_DATE,
for_startDate)" nullable="false"/>
<variable name="for_endDate" type="int" min="1" max="10" />
<attribute name="END_DATE" type = "date" script="TimeUtil.addDays(this.START_DATE,
for_endDate)" nullable="false"/>
</generate>
benerator は JDBC を介して多くのデータベースをサポートし、いくつかの JDBC ドライバーがロードされています。ここで試してみてくださいhttp://bergmann-it.de/test-software/index.php?lang=en . それはオープンソースです