How (or can) I specify programmatically which validation group OpenJPA should validate against during a persist or merge operation? Is this option only available via persistence.xml?

I'm drawing a blank.

Thanks.

有帮助吗?

解决方案 2

Yes, configuration is only via persistence.xml. I guess it would be open for JPA implementations to provide implementation specific ways, but that's not standardized. I am not sure whether OpenJPa offers such a provider specific option, but I don't think so.

其他提示

The groups are configured per entity manager factory. If you obtain your entity manager factory programmatically via Persistence#createEntityManagerFactory() you can pass the groups to be validated during lifecycle validation using the properties javax.persistence.validation.group.{pre-persist|pre-update|pre-remove} but there is no (standardized) way for specifying the groups on a per-operation basis.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top