Data validation is a common task that occurs in all layers
of an application, including persistence. The Feature Pack for OSGi
Applications and JPA 2.0 does not include the Bean Validation API,
therefore you need to enable Bean Validation functions in the Java Persistence API (JPA) application.
About this task
Because the feature pack does not ship any Bean Validation
API or implementation, the following steps need to be applied:
Procedure
- Obtain a compliant Bean Validation API and implementation
JAR files, for example, obtain these artifacts from Hibernate.
- Incorporate these JAR files into WebSphere® Application Server and make the
JAR files accessible to the application by setting the appropriate
classpath in the application server or application's manifest.
- Add the com.ibm.websphere.validation.api.jar.path Java Virtual Machine custom property to the application server JVM
settings.
The value you specify for this property is
the fully-qualified path to the location of the Bean Validation API
JAR file. The fully-qualified path includes the name of the JAR file.
For example, if SomeBeanValAPI.jar is the name
of the Bean Validation API JAR file you want to use, and this file
is located in the E:/mydir/mybeanval/ directory,
specify E:/mydir/mybeanval/SomeBeanValAPI.jar as the value of the com.ibm.websphere.validation.api.jar.path JVM custom property.
- Refresh the WebSphere Application Server OSGI cache using the following command:
$WAS_USR_HOME/bin/osgiCfgInit.[bat|sh] -all