Build, protect and deploy apps across any platform and mobile device
Leverage a complete UI toolbox for web, mobile and desktop development
Automate UI, load and performance testing for web, desktop and mobile
Rapidly develop, manage and deploy business apps, delivered as SaaS in the cloud
Automate decision processes with a no-code business rules engine
Build mobile apps for iOS, Android and Windows Phone
Deploy automated machine learning to accurately predict machine failures with technology optimized for Industrial IoT.
Optimize data integration with high-performance connectivity
Connect to any cloud or on-premise data source using a standard interface
Build engaging multi-channel web and digital experiences with intuitive web content management
Suppose you’ve been tasked with tracking down the memory usage of your application you’ve written with Hibernate. You’ve traced and tuned, and you think you should be able to squeeze more out of your database drivers. For this specific example we’ll say that we need to tune parameter bindings.
In order to more accurately control the amount of memory the driver allocates for each parameter in the PreparedStatement using Oracle's Thin driver, you must use the OraclePreparedStatement.defineColumnType() method (which is not part of the JDBC specification). WARNING! Note that if you re-bind your parameters on a subsequent execute using larger data sizes then the driver will be silently truncate to the size specified – which is bad. Also, due to the fact that Hibernate abstracts the actual JDBC calls themselves, you lose the power to customize these calls unless you modify the Hibernate code itself (casting the PreparedStatement to an OraclePreparedStatement in the process – Yuck!). This is generally unacceptable as it’s costly to modify the Hibernate code and you have to duplicate the code changes every time you upgrade the version of Hibernate you’re using. So, there goes option 1.
Tuning memory on a per statement basis with the Connect for JDBC Oracle driver is much less costly; with our drivers you just set a connect option (initalColumnBufferSize) to set the initial size you want us to try for each parameter. Score! Now we don’t have to change Hibernate code to tune the app! Also, we don’t have the limitation of truncating the data on subsequent executes and binds; we will auto-adjust for the parameter’s size so there's no need to spend time analyzing every parameter binding.
So, option 2 seems to be the way to go – it’s easy to use and doesn’t require modifying Hibernate’s internals to get it done!
As Senior Director of Research & Development, Jesse is responsible for the daily operations, product development initiatives and forward looking research for Progress DataDirect. Jesse has spent nearly 20 years creating enterprise data products and has served as an expert on several industry standards including JDBC, J2EE, DRDA and OData. Jesse holds a bachelor of science degree in Computer Engineering from North Carolina State university.
Copyright © 2017 Progress Software Corporation and/or its subsidiaries or affiliates.
All Rights Reserved.
Progress, Telerik, and certain product names used herein are trademarks or registered trademarks of Progress Software Corporation and/or one of its subsidiaries or affiliates in the U.S. and/or other countries. See Trademarks for appropriate markings.