Introduction
With JBoss Datavirtualization it is possible to expose your virtual databases as a REST service. By default when an exposed table has a primary key; Teiid Designer (the development tool used to create virtual databases) is able to generate a REST service conform the OData protocol. However, the default OData configuration comes with a small limitation. Users are only allowed to do batch operations on your REST service with a limit of 256 rows a time.
In some cases it might be necessary that a user connecting to your OData REST service be able to access more than 256 rows per query. This blog will give a detailed explanation on how to achieve this.
Changing the OData war
This guide assumes you have access to the server that hosts your JBoss Datavirtualization service and that this server is running CentOS or RedHat.
-
-
- ssh to your server and go to the following folder
cd $JBOSS_HOME/dataVirtualization/vdb/
- Create a backup of your teiid-odata-8.7.1.6_2-redhat-6.war (version might differ)
cp teiid-odata-8.7.1.6_2-redhat-6.war ~/
- Unpack the war file with the following command
jar -xvf teiid-odata-8.7.1.6_2-redhat-6.war
- Edit the WEB-INF/web.xml file with vi or gedit
vi WEB-INF/web.xml
- Change the following line from 256 to your preferred amount. Note: A value of -1 is for unlimited. However, this is not recommended since not every application may be able to handle that.
<param-name>batch-size</param-name> <param-value>512</param-value>
- Save the file stop your JBoss Datavirtualization service in order to update the war file. Depending on your installation it might resemble to the following command.
sudo systemctl stop jboss-as-standalone
- Update the war file with the following command. Note: repacking the war is not recommended, updating it is easier and less prone to errors.
jar -uvf teiid-odata-8.7.1.6_2-redhat-6.war WEB-INF/
- Start the JBoss Datavirtualization service and check your logs for any errors.
sudo systemctl start jboss-as-standalone
- ssh to your server and go to the following folder
-
Conclusion
This concludes this guide, right now you should be able to freely change the row limit on an OData query of a vdb hosted on your JBoss Datavirtualization instance.