Got me an error for a couple of hours org.hibernate.PropertyNotFoundException

Source: Internet
Author: User

when using hibernate4.3 for Oracle data query, because it is extracted from the three tables of data, so there is no corresponding entity class object corresponding to it, so I used a dto (write an intermediate object, which contains the object I want to use the property name and property type). Such as:

Hibernate queries are as follows:

Query methods and statements are correct, can be queried from the database, if the database is MySQL, SQL Server2008 I do not want to error, but I am even Oracle, but it is the error. If Stuinfodto is a database object (there is a corresponding table in the database), Oracle will not error, but it is not a database object. Let's take a look at its error warning:

  It says I didn't give Stuid a setter method, and I'm sure everyone would go to see class stuinfodto, and found that Setstuid was provided (int STUID), but why does Oracle still have an error???? The

  after operation, error

 
  by the previous error prompt can be seen that the value of the int type is wrong, that is, our Stuid property value, You can see from the following hints that the parameter types do not match. At this time we have to be depressed, this attribute I query the Student information table in the School number column, this column I define the type of int ah, and is automatically produced by the sequence. Now that the type does not match, we will change the Stuid property type in the Stuinfodto class to string, as shown below:

When running again, the error is still reported as At this point we can only cast it using the type conversion function of Oracle. Modify the query statement as follows:


Run again can be surprised to discover, the results come out.

Got me a few hours of error org.hibernate.PropertyNotFoundException

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.