Because each device collects GPS data, it is decided to implement the sub-table. The original thought is to use JDBC to achieve, but there will always be unexpected things happen, it is depressed (such as the summary of the problem). So after thinking still put this SQL operation thing to the stored procedure to do it.
There are two ways to implement a stored procedure call using Hibernate:
1. JDBC Call:
Session session =hibernatesessionfactory.getsession (); Connection conn = Session.connection (); ResultSet RS =null; CallableStatement call = Conn.preparecall ("{Call proc (?)}"); Call.setstring (1, parameter); rs = Call.executequery (); Rs.close (); Session.close ();
2. Hibernate sqlquery:
Session session =hibernatesessionfactory.getsession (); SQLQuery query = Session.createsqlquery ("{Call Tj (?)}"); This calls the stored procedure query.setstring (0, "ddd"); List List =query.list (); Session.close ();
Hibernate calls to Oracle stored procedures