Solution to paip. hibernate save failure
Open log debug level, and you cannot see the insert code...
Hibernate select max(ID).txt
It is worth noting that the save () method does not immediately execute the SQL insert statement. The SQL insert statement is executed only when the Session clears the cache. If the attributes of the Persistent object are modified after the save () method, the Session will execute the SQL update statement when clearing the cache. Although the following two pieces of code can achieve the same function, the code on the left executes only one SQL insert statement, while the code on the right executes one SQL insert and one SQL update statement.
Author old wow's paw Attilax iron, EMAIL: 1466519819@qq.com
Source: http://blog.csdn.net/attilax
TProbeCustom o = new TProbeCustom ();
O. setName ("namexx ");
TProbeCustomDAO d = new TProbeCustomDAO ();
Session session = d. getSession ();
Session session2 = d. getSession ();
// Lyag session address yyeo. sh yg obj.
Core. log ("---" + session. hashCode () + "---" + session2.hashCode ());
Transaction tx = session. beginTransaction ();
D. save (o );
Tx. commit ();
System. out. println ("f ");
OK... you can also see insert SQL...