为所有实体设置默认分配大小? [英] Setting default allocation size for all entities?

查看:106
本文介绍了为所有实体设置默认分配大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将默认分配大小(默认设置为50)设置为另一个值.有没有办法做到这一点?我希望使用默认的JPA来执行此操作,但是Eclipselink也可以.我不想在我使用的每个实体中指定分配大小.

I want to set the default allocationSize that is set by default to 50 to another value. Is there a way to do that? I'd prefer to do this with default JPA, but Eclipselink would also be ok. I don't want to specify the allocationSize in each Entity I use.

@TableGenerator(name = "name", pkColumnValue = "pkColumnValue", allocationSize=1000)

推荐答案

您无法使用标准JPA做到这一点.甚至没有在orm.xml"persistence-unit-defaults"中进行设置的选项.使用DataNucleus JPA,您当然可以设置一个提供默认值的持久性属性.其他JPA实施可能会或可能不会提供这种功能.

You can't do that with standard JPA. There isn't even an option of setting it in orm.xml "persistence-unit-defaults". With DataNucleus JPA you can certainly set a single persistence property that provides a default. Other JPA implementations may or may not offer such a facility.

这篇关于为所有实体设置默认分配大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆