Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version:
2.1.8
Mapping documents:
Code between sessionFactory.openSession() and session.close():
Full stack trace of any exception that occurs:
Name and version of the database you are using:
oracle 9i
The generated SQL (show_sql=true):
Debug level Hibernate log excerpt:
I believe hibernate is generating invalid sql for my oracle database select statements. My unit tests work fine against a mssql and db2 database but this select statement returns no rows when it should return 32. Hand writing this select statement in a sql editor for oracle also returns the correct number of results.
Code:
getHibernateTemplate()
.findByValueBean(
"from JobQueueList jql where jql.status=:status and jql.servername=:servername and (jql.startdate <=:startdate or jql.startdate is null) and (jql.starttime <=:starttime or jql.starttime is null) order by jql.priority, jql.comp_id.jobid",jobQueueList);
if I delete the
jql.servername=:servername this query returns values, or even if I hardcode it to be
jql.servername='somevalue' it works correctly.
snippets of the hbm file
Code:
...
<class
name="dars.apis.audit.JobQueueList"
table="job_queue_list"
>
<meta attribute="generated-class" inherit="false">dars.apis.audit.BaseJobQueueList</meta>
<composite-id name="comp_id" class="dars.apis.audit.JobQueueListPK">
<meta attribute="generated-class" inherit="false">dars.apis.audit.BaseJobQueueListPK</meta>
<key-property
name="instidq"
column="instidq"
type="dars.apis.common.dao.hibernate.type.RightTrimmedStringUserType2"
length="2"
>
<meta attribute="property-type">java.lang.String</meta>
</key-property>
<key-property
name="instid"
column="instid"
type="dars.apis.common.dao.hibernate.type.RightTrimmedStringUserType8"
length="8"
>
<meta attribute="property-type">java.lang.String</meta>
</key-property>
...
<property
name="servername"
type="dars.apis.common.dao.hibernate.type.RightTrimmedStringUserType10"
column="servername"
length="10"
>
<meta attribute="property-type">java.lang.String</meta>
</property>
<property
name="status"
type="java.lang.String"
column="status"
length="1"
>
<meta attribute="use-in-equals">true</meta>
</property>
...
snippets of the calling test
Code:
...
JobQueueList jql = new JobQueueList();
jql.setStatus("D");
jql.setServername("dars1");
jql.setStartdate("2005/02/11");
jql.setStarttime("14:28");
List requestsToProcess = dao.findRequestsToProcess(jql);
...
snippets of JobQueueList object
Code:
/** nullable persistent field */
private String servername;
...
public void setServername(String servername) {
this.servername = servername;
}
public String getServername() {
return this.servername;
}
...
the data for the database is populated by dbunit, the hbm files generated by middlegen (run against the mssql server)
any help would be greatly appreciated