Solution to paip. hibernate save failure

Source: Internet
Author: User

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...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.