The method Load (Class, Serializable) in the type Session was not applicable for the arguments (class<

Source: Internet
Author: User

Transaction Transaction = Session.begintransaction ();
Load is a primary key property that gets an instance of the object
Employee employee = (employee) session.load (Employee.class, 1);
Employee.setname ("demo");
Transaction.commit ();
Session.close ();

Error The method load (Class, Serializable) in the type Session was not applicable for the arguments (CLASS<T>, int)

MyEclipse obvious error, which means that the automatic unboxing of JDK in MyEclipse is not done automatically, but my JDK uses java8.

Use

Transaction Transaction = Session.begintransaction ();
Load is a primary key property that gets an instance of the object
Employee employee = (employee) session.load (Employee.class, New Integer (1));
Employee.setname ("demo");
Transaction.commit ();
Session.close ();

On the line, the Internet to find the next, found that this should be the hibernate version of the problem, in hibernate operation, depends on whether you refer to the Hibernate version itself supports automatic disassembly.

Hibernate itself is not allowed to do so, so it has to be written as an object type in order to query, which is irrelevant to the JDK.

The method Load (Class, Serializable) in the type Session was not applicable for the arguments (class<

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.