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.

      1. ssh to your server and go to the following folder
        cd $JBOSS_HOME/dataVirtualization/vdb/
        
      2. 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 ~/
        
      3. Unpack the war file with the following command
        jar -xvf teiid-odata-8.7.1.6_2-redhat-6.war
        
      4. Edit the WEB-INF/web.xml file with vi or gedit
        vi WEB-INF/web.xml
        
      5. 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>
        
      6. 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
        
      7. 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/
        
      8. Start the JBoss Datavirtualization service and check your logs for any errors.
        sudo systemctl start jboss-as-standalone
        

 

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.

Houd jij je kennis graag up to date?

Mis niets meer van onze kennisdocumenten, events, blogs en cases: ontvang als eerste het laatste nieuws in je inbox!

Fijn dat we je op de hoogte mogen houden!