Solved

how to call view in hibernate

Posted on 2007-04-03
6
1,946 Views
Last Modified: 2013-11-24
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  
0
Comment
Question by:chaitu chaitu
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 11

Expert Comment

by:Manish
ID: 18843987
view behave like normal table.
0
 
LVL 20

Author Comment

by:chaitu chaitu
ID: 18848492
i know that i want to know what is the syntax in hibernate to call view
0
 
LVL 12

Expert Comment

by:Gibu George
ID: 18848675
You need to have a mapping XML file for the  view and a corresponding .java files also
0
Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

 
LVL 12

Accepted Solution

by:
Gibu George earned 500 total points
ID: 18848683
<?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
 
LVL 20

Author Comment

by:chaitu chaitu
ID: 18848864
what is  table="emp_dept"
do we need to create above table consists all fields mentioned below.
0
 
LVL 12

Expert Comment

by:Gibu George
ID: 18849519
table is the name of the view, and I created the mapping based on the view posted
0

Featured Post

More Than Just A Video Library

Train for your certification. Learn the latest DevOps tools. Grow your skillset to do better work.

At Linux Academy, we release new training modules every week so you'll always be up to date on the latest tech.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses

630 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question