Rebuild Package Name
Org.hibernate.type.descriptor.sql
Rebuilding class Basicbinder
The code is as follows
Package Org.hibernate.type.descriptor.sql;import Java.sql.preparedstatement;import Java.sql.sqlexception;import Org.hibernate.internal.corelogging;import Org.hibernate.type.descriptor.jdbctypenamemapper;import Org.hibernate.type.descriptor.valuebinder;import Org.hibernate.type.descriptor.wrapperoptions;import Org.hibernate.type.descriptor.java.javatypedescriptor;import Org.jboss.logging.logger;public Abstract class Basicbinder<j> implements valuebinder<j>{private static final Logger log = Corelogging.logger (basicbinder . Class); private static final String bind_msg_template = "binding parameter [%s] as [%s]-[%s]"; private static final String null_bind_msg_template = "binding parameter [%s] as [%s]-[NULL]";p rivate final JAVATYPEDESCR Iptor<j> javadescriptor;private final Sqltypedescriptor sqldescriptor;public javatypedescriptor<j> Getjavadescriptor () {return javadescriptor;} Public Sqltypedescriptor Getsqldescriptor () {return sqldescriptor;} Public BasIcbinder (javatypedescriptor<j> javadescriptor, Sqltypedescriptor sqldescriptor) {this.javaDescriptor = Javadescriptor;this.sqldescriptor = Sqldescriptor;} @Overridepublic final void bind (PreparedStatement st, J value, int index, wrapperoptions options) throws SQLException { Final Boolean traceenabled = log.istraceenabled (); if (value = = null) {if (traceenabled) {log.trace (String.Format (Null_bind_msg_template,inde X,jdbctypenamemapper.gettypename (Getsqldescriptor (). Getsqltype ())); } st.setnull (Index, Sqldescriptor.getsqltype ()); } else {if (traceenabled) {log.trace (String.Format (Bind_msg_template,index,jdbctypena Memapper.gettypename (Sqldescriptor.getsqltype ()), Getjavadescriptor (). Extractloggablerepresentation (value)); } dobind (St, value, index, options); } System.out.println (St.tostring ());} /** * PerfORM the binding. Safe to assume this value is not NULL. * * @param st The prepared statement * @param value the value to bind (not null). * @param index the index at which to bind * @param options The binding options * * @throws SQLException indicates a proble M binding to the prepared statement. */protected abstract void Dobind (PreparedStatement st, J value, int index, wrapperoptions options) throws SQLException;}
Because in the hibernate mechanism, this class is the class that executes the update INSERT SQL statement, which is overridden here to overwrite
Use hibernate to intercept execution of SQL statements and output SQL statements to get SQL statements