I'm using Hibernate for Database connection. My user has the right to get the open_mode (select open_mode from v$database). I wanted to execute the query in hibernate using the existing hibernate DB configuration Also I do not want to create a JDBC connection codes in my java file like the below
String url = "jdbc:oracle:thin:@192.179.9.31:1521:db1";
Connection conn = DriverManager.getConnection(url,"user","password");
Statement stmt = conn.createStatement();
ResultSet rs;
rs = stmt.executeQuery("select openmode from v$database");
while ( rs.next() ) {
String lastName = rs.getString("openmode");
Since this v$database is not a real table in our schema, I am thinking we cannot create a entity class for v$database and execute the query using hql.
Anyone how I can execute the above query and get a result using my existing config.
Here is my hibernate configuration detail.
<property name="dialect"> org.hibernate.dialect.Oracle9Dialect</property>
<property name="connection.url"> jdbc:oracle:thin:@192.179.9.31:1521:db1
</property>
<property name="connection.username">user</property>
<property name="connection.password">passsword</property>
<property name="connection.driver_class"> oracle.jdbc.driver.OracleDriver
</property>
<property name="myeclipse.connection.profile"> Oracle 9i Connector
</property>