Refresh Your Java - Before Java Interview
We are Agile, believe in less Documentation - Only Quick notes (Java Interview Questions) of Java/J2ee Read more....
Hibernate3 provides support for queries via stored
procedures and functions.
Most of the following
documentation is equivalent for both.
The stored procedure/function must return a resultset as the
first
out-parameter to be able to work with
Hibernate.
An example of
such a stored function in Oracle 9 and higher is as
follows:
CREATE OR REPLACE FUNCTION
selectAllEmployments
RETURN SYS_REFCURSOR
AS
st_cursor SYS_REFCURSOR;
BEGIN
OPEN st_cursor
FOR
SELECT EMPLOYEE, EMPLOYER,
STARTDATE, ENDDATE,
REGIONCODE, EID,
VALUE, CURRENCY
FROM EMPLOYMENT;
RETURN st_cursor;
END;
To
use this query in Hibernate you need to map it via a named
query.
<sql-query
name="selectAllEmployees_SP"
callable="true">
<return
alias="emp"
class="Employment">
<return-property name="employee"
column="EMPLOYEE"/>
<return-property name="employer"
column="EMPLOYER"/>
<return-property name="startDate"
column="STARTDATE"/>
<return-property name="endDate"
column="ENDDATE"/>
<return-property name="regionCode"
column="REGIONCODE"/>
<return-property name="id"
column="EID"/>
<return-property
name="salary">
<return-column
name="VALUE"/>
<return-column
name="CURRENCY"/>
</return-property>
</return>
{ ? = call selectAllEmployments()
}
</sql-query>
This Portal is intended to put all Java/J2ee related topics at one single place for quick referance, not only Technical , but also the Project Management Related thing such as Development Process methodoogies build process, unit testing etc.,
This Portal has More than 500 Java Interview Questions (also could be Considered as Quick Notes) very neatly separated topic by topic with simple diagrams which makes you easily understandable. Importantly these are from our Realtime expericance.