Setting default allocation size for all entities?

眉间皱痕 提交于 2019-12-13 16:14:02

问题


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)

回答1:


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.




回答2:


You can configure this using a SessinCustomizer in EclipseLink by setting the preallocationSize in the DefaultSequence.



来源:https://stackoverflow.com/questions/9667638/setting-default-allocation-size-for-all-entities

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!