|
3
|
| Brandon Yarbrough · 技术社区 · 16 年前 |
|
|
1
5
对于数据库,请使用
For the 2nd level cache, get access to the underlying cache regions from the
For the 1st level cache, well, simply get a new
|
|
|
2
1
采用上面的Pascal方法,我在Spring中寻找创建SchemaUpdate对象的正确方法,并意识到我不需要这样做。相反,我只需要为Hibernate获取一个Spring的sessionFactory对象,并要求它删除/创建模式。结合帕斯卡的其他解决方案,我们得到:
这是相当有效的。唯一的缺点是(至少对我来说)它比在每个表名上调用“delete from obj1”、“delete from obj2”慢得多。不过,我还是喜欢不必重复自己的话。 |
|
|
3
1
看一看 Unitils . It has great support for database testing (使用dbunit)我们已经使用了很长一段时间。It's really flexible, so you can use it if you ever find the need to pre-load data into the database for particular unit tests.
With Unitils, you'll create a dataset file (
在需要配置数据集的类或测试上
对于所有持久性测试,我们都有一个公共的基类,因此我们能够将注释放在一个地方。 缺点是,每次将实体添加到休眠时,都必须向该文件添加行。您必须获得正确的顺序才能与外键约束保持一致。我们最后添加了一个单元测试来对照hibernate配置检查这个文件,以保持对它的检查。 The up side, especially for a large schema, is that it's way faster than rebuilding the schema. |
|
|
user29759326 · 如何返回递归函数中的最后一个值? 1 年前 |
|
|
malife89 · 将java中的字符串读取为正确的日期格式 1 年前 |
|
|
Tim · 在java中,有没有更快的方法将字节数组写入文件? 1 年前 |
|
|
rudraraj · java中未声明最终变量 1 年前 |
|
|
Bala Ji · 以下BFS的实施效率如何? 1 年前 |