Solved

how to call view in hibernate

Posted on 2007-04-03
6
1,882 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
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 
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

Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
netstat -ano | find "8000" and taskkill /f /pid 2984 3 83
couple of eclipse 5 46
varialbe initialization 11 37
Adding multiple JVM environments to RedHat 6 7 47
An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

856 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