Hi,
Thanks for the reply.
I created hbm file as you mail me. But the problem I found is when i select max(last_modified_ts) of a particular val_status_id whose submission_id='' and val_def_mod_res_id=''. It is showing error.
My hbm file look like this
-----------------------------------------------------------------------------------
<class name="ValStatus" table="val_status">
<id name="valStatusId" type="string" unsaved-value="null" >
<column name="val_status_id" sql-type="raw(16)" not-null="true"/>
</id>
..................
<property name="valDefModResId" >
<column name="val_def_mod_res_id" sql-type="raw(16)" not-
null="true"/>
</property>
<many-to-one name="Stage" insert="false" update="false"
class="ValStages" column="val_stage_id"/>
<many-to-one name="Session" insert="false" update="false"
class="ValSession" column="val_session_id"/>
</class>
<class name="ValSession" table="val_session">
<id name="valSessionId" type="string" unsaved-value="null" >
<column name="val_session_id" sql-type="raw(16)" not-null="true"/>
</id>
................................
<set name="status" inverse="false" cascade="all-delete-orphan">
<key column="val_session_id"/>
<one-to-many class="ValStatus"/>
</set>
<many-to-one name="Submission" insert="false" update="false"
class="Submissions" column="submission_id" />
</class>
<class name="Submissions" table="submission">
<id name="submissionId" type="string" unsaved-value="null" >
<column name="submission_id" sql-type="raw(16)" not-null="true"/>
</id>
---------------
</class>
---------------------------------------------------------------------------
I didn't create property for submission_id in ValSession.hbm file and val_session__id in valStatus.hbm file.
My sample code look like this:
SessionFactory sessionFactory=HibernateFactory.buildsessionFactory();
Session session= sessionFactory.openSession();
Criteria critLastModDate = session.createCriteria(ValStatus.class)
.setProjection(Projections.max("lastModifiedTs"))
.add(Restrictions.eq
("valDefModResId","CBD54AB05DBA4769944023B15D0ABEC9"));
Criteria prdCrit = critLastModDate.createCriteria("Session");
prdCrit.add(Restrictions.eq("Submission","831405D303064887B1AF63F55D3C3690"));
List results = critLastModDate.list();
System.out.println(results.get(0));
Error shows like this:
Hibernate: select max(this_.last_modified_ts) as y0_ from val_status this_, val_session valsession1_ where this_.val_session_id=valsession1_.val_session_id and this_.val_def_mod_res_id=? and valsession1_.submission_id=?
- IllegalArgumentException in class: hibernate.Submissions, getter method of property: submissionId
Could you please help me to tackle this issue.
Thanks and Regards,
Sreekanth
tenwit wrote:
Code:
<class name="Submission" ...>
...
<set name="sessions" inverse="false" cascade="all-delete-orphan" ...>
<key column="submission_id"/>
<one-to-many class="ValSession"/>
</set>
...
</class>
<class name="ValSession" ...>
...
<set name="stati" inverse="false" cascade="all-delete-orphan" ...>
<key column="val_session_id"/>
<one-to-many class="ValStatus"/>
</set>
<many-to-one name="Submission" insert="false" update="false" class="Submission" .../>
...
</class>
<class name="ValStatus" ...>
...
<many-to-one name="Session" insert="false" update="false" class="ValSession" .../>
...
</class>