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