Ever run a program written by someone else, before even the data of someone else's machine, then I import the data into the local database to run, error, as follows:
Hibernate:select sum (rdb_alert_0_. Event_count) as col_0_0_ from ASICDB. Rdb_alert_security_view rdb_alert_0_
–sql error:942, sqlstate:42000
–ora-00942: Table or view does not exist
It is also an error to run the SQL statement in Plsql develop, putting "asicdb." in the above statement. Deleted, the operation is successful;
Analyzing the SQL statements in Oracle can reveal:
1). Select SUM (rdb_alert_0_. Event_count) as col_0_0_ from ASICDB. Rdb_alert_security_view rdb_alert_0_
The statement queries the data owned by the user "asicdb", the prefix represents a user, and in my local, I did not create a user named "Asicdb", of course, it does not have the relevant data, so it failed to query.
2). Why does hibernate add the "asicdb" prefix to this statement?
Analysis found: In the file named RDB_ALERT_VIEW.hbm.xml, there are the following statements:
<class name= "Rdb_alert_view" table= "Rdb_alert_security_view" lazy= "false" Schema= "ASICDB" >
..............
</class>
The writer of the file adds the attribute schema= "asicdb" to the <class>, which is represented by a user in Oracle;
3). This concludes the problem, and the main problem is the use of Hibernate and Oracle in conjunction with schema properties.
Original: http://blog.csdn.net/wwbmyos/article/details/21334341
Table or view does not exist Hibernate Oracle