HQLgen: deep learning based HQL query generation from program context
作者:Ziyi Zhou, Huiqun Yu, Guisheng Fan, Zijie Huang, Kang Yang, Jiayin Zhang
摘要
To facilitate Object-Oriented Programming (OOP) in data persistence, practitioners use Object Relational-Mapping (ORM) framework to map data bidirectionally between data classes and tables of Relational Database Management System (RDBMS). In terms of Java applications, the most trending ORM solution is Hibernate, where Hibernate Query Language (HQL) is proposed to perform customizable queries in an OOP style. However, HQL queries are hard to implement and maintain due to their flexibility and complexity. To address these issues, we propose a model called HQLgen that combines deep learning and template to automatically generate HQL queries from program context. It employs recurrent neural network to learn the contextual information of Java program, and predicts the key elements within HQL clauses via attention mechanism. To construct the dataset for model training and evaluation, we locate and extract projects containing HQL queries on GitHub followed by extensive cleaning and preprocessing, and finally obtain 24,118 HQL queries from 3,481 projects. Experimental results show that the proposed approach achieves an accuracy of 34.52% on predicting simple HQL queries. In addition, we release the collected dataset for future research interest.
论文关键词:Object relational mapping, HQL query generation, Deep learning, Program comprehension
论文评审过程:
论文官网地址:https://doi.org/10.1007/s10515-022-00359-5