Create and deliver personalized experiences across digital properties at scale
Build engaging websites with intuitive web content management
Leverage a complete UI toolbox for web, mobile and desktop development
Build, protect and deploy apps across any platform and mobile device
Build mobile apps for iOS, Android and Windows Phone
Rapidly develop, manage and deploy business apps, delivered as SaaS in the cloud
Automate UI, load and performance testing for web, desktop and mobile
Optimize data integration with high-performance connectivity
Automate decision processes with a no-code business rules engine
Globally scale websites with innovative content management and infrastructure approaches
Content-focused web and mobile solution for empowering marketers
Faster, tailored mobile experiences for any device and data source
UX and app modernization to powerfully navigate today's digital landscape
Fuel agility with ever-ready applications, built in the cloud
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 or appropriate markings.