I want to know how to store the hibernate update query with model class and evict method in the string.
If we set the show_sql property to true, it displays the SQL query onside console, but my requirements like to store the insert query inside the DB. I want to store the query in string with parameter.
Following is the code.
final SessionFactory factoryNew = configHibernate.configure().buildSessionFactory();
hibernateSession = factoryNew.openSession();
final Transaction insertSerialIdTransaction = hibernateSession.beginTransaction();
final GroupDevice addGroupDevice = new GroupDevice();
addGroupDevice.setDeviceId(0);
addGroupDevice.setSerialId(cut[0]);
addGroupDevice.setOldMsata_password(oldMsataPassword);
addGroupDevice.setIsNew(0);
addGroupDevice.setDeviceStatus("staging");
hibernateSession.save(addGroupDevice);
hibernateSession.flush();
insertSerialIdTransaction.commit();
Show the query on console like this: INSERT Into GroupDevice (DeviceId,SerialId,OldMsata_password, IsNew, DeviceStatus) values(0,"kdjhg65",0,"staging");
I want to store the above query in the string, how to store in the string.?
Thanks in advance.