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
- Create a backup of your teiid-odata-184.108.40.206_2-redhat-6.war (version might differ)
cp teiid-odata-220.127.116.11_2-redhat-6.war ~/
- Unpack the war file with the following command
jar -xvf teiid-odata-18.104.22.168_2-redhat-6.war
- Edit the WEB-INF/web.xml file with vi or gedit
- 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.
- 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-22.214.171.124_2-redhat-6.war WEB-INF/
- Start the JBoss Datavirtualization service and check your logs for any errors.
sudo systemctl start jboss-as-standalone
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.