ceyesuma -4 Posting Pro

is this true?
hql use xml to create results that hibernate can use. Simialar to the SQL?
here is what I need in a table

SELECT i.instr_lname,b.book_num,s.stu_lname,b.book_start_date,b.book_start_time,b.book_end_time FROM instructor AS i,booking AS b,student AS s where i.instr_num=b.instr_num AND b.stu_num=s.stu_num;

here is the mapping classes to the (obj)entity classes.

the booking class is searched based on the join between Instructor and student tables

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
  <class dynamic-insert="false" dynamic-update="false" mutable="true" name="lesson.Booking" optimistic-lock="version" polymorphism="implicit" select-before-update="false" table="Booking">
      <id column="book_num" name="bookNum">
          <generator class="increment"/>
      </id>
      <property column="book_start_date" name="bookStartDate"/>
      <property column="book_start_time" name="bookEndTime"/>
      <property column="book_end_time" name="bookEndTime"/>
      <set cascade="all-delete-orphan" inverse="true" lazy="true" name="trips" table="booking">
          <key column="book_num"/>
          <one-to-many class="lesson.booking"/>
      </set>
      
  </class>
</hibernate-mapping>

this is the instructor xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
  <class dynamic-insert="false" dynamic-update="false" mutable="true" name="lesson.Instructor" optimistic-lock="version" polymorphism="implicit" select-before-update="false" table="instructor">
      <id column="instr_num" name="instrNum">
          <generator class="increment"/>
      </id>
      <id column="instr_lname" name="instrName"/>
  </class>
</hibernate-mapping>

this is the student xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
  <class dynamic-insert="false" dynamic-update="false" mutable="true" name="lesson.Student" optimistic-lock="version" polymorphism="implicit" select-before-update="false" table="student">
      <id column="stu_num" name="stuNum">
          <generator class="increment"/>
      </id>
      <property column="stu_lname" name="stuName"/>
          
  </class>
</hibernate-mapping>

If you create a object variable to hold a table element do you have to do the same if you just need a table element to join another table?
ex WHERE i.instr_num=b.instr_num (I need i.instr_num as a key but b.instr_num is just the convention to join.Do I need the same in the xml?


If someone could clear some of this up every little bit of feed back would help.
Thanks
-Steve

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.