how to call view in hibernate

I have a view like this;i have 2 doubts;

1.how to call this view in hibernate;

2.how to add condition to this view like( AND E.EMPNO='123') in hibernate.


create or replace view emp_dept as
select
        E.EMPNO,
        E.ENAME,
        E.JOB,
        E.MGR,
        D.DNAME
    from
        "XXXX"."EMP" E, "XXXX"."DEPT" D
WHERE E.DEPTNO = D.DEPTNO  
LVL 20
chaitu chaituAsked:
Who is Participating?
 
Gibu GeorgeConnect With a Mentor CTOCommented:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >

<hibernate-mapping package="com.view">
<class name="DeptView" table="emp_dept">


<property name="empNo" column="empno"/>
<property name="empName" column="ename"/>
<property name="Job" column="job"/>
<property name="Manger" column="mgr"/>
<property name="Dept" column="dname"/>

</class>
</hibernate-mapping>
0
 
ManishLeadCommented:
view behave like normal table.
0
 
chaitu chaituAuthor Commented:
i know that i want to know what is the syntax in hibernate to call view
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
Gibu GeorgeCTOCommented:
You need to have a mapping XML file for the  view and a corresponding .java files also
0
 
chaitu chaituAuthor Commented:
what is  table="emp_dept"
do we need to create above table consists all fields mentioned below.
0
 
Gibu GeorgeCTOCommented:
table is the name of the view, and I created the mapping based on the view posted
0
All Courses

From novice to tech pro — start learning today.