Solved

how to call view in hibernate

Posted on 2007-04-03
6
1,840 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
  • 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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…

706 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now