Today I had a problem with the project, which was not noticed before. I'm using the spring mvc+ Hibernate JPA + MySQL database. A single SELECT statement is added to the SQL execution log after inserting data:
Copy Code code as follows:
Hibernate:insert into Click_statstic (logdate, memoid, SRC, typeid) VALUES (?,?,?,?)
Hibernate:select last_insert_id ()
A primary key in a table is a self-added column. However, in the past projects, no such problems have been found. So all kinds of search on the Internet can not find the reason. I thought it might be a configuration problem.
This configuration was finally found in the Persistence.xml configuration file:
Copy Code code as follows:
<property name= "Hibernate.temp.use_jdbc_metadata_defaults" value= "false"/>
Deleting this configuration does not have an extra SELECT statement. The exact reason and the purpose of doing so are unknown. If you have friends who know, please share ~ Thank you.