Solved

how to call view in hibernate

Posted on 2007-04-03
6
1,918 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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 our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

Question has a verified solution.

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

Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
Suggested Courses

739 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