problem with hibernate views?

Discussions

General J2EE: problem with hibernate views?

  1. problem with hibernate views? (1 messages)

    Hi I have some problem with hibernate views.My database is mysql5.0. I have one table "students". The corresponding DTO is "Student". I have mapped this DTO in the hbm file to the students table. The following is the mapping file

     

    <class name="Student" table="students">
    <cache usage="read-only"/>
    <id name="id" column="student_id" type="string" unsaved-value="null">
    <generator class="generated" />
    </id>
    <property name="name" />
    <property name="address" />

    </class>

    In addition to this there is a named query which usses name and address.

    now I have created a view on table "students". The view name is "rstudents". it contains only 2 columns "count" and "student_ID".

    now i have created a DTO "RStudent" which extends "Student" and created the following hbm file

     

    <class name="RStudent" table="rstudents">
    <cache usage="read-only"/>
    <id name="id" column="student_id" type="string" unsaved-value="null">
    <generator class="assigned" />
    </id>
    <property name="count" />
    </class> 

    with this setup i am getting an error that says the named queries(named quires in the first hbm) are incorrect. if i remove the view hbm, everything is working fine. any ideas what actually is happening? and how to resolve this?

  2. Hi, I have seen your message and don't understand why did you extend Student. Could you please post some DTO's involved so we can figure it out what is happening?