Hi,
I've just tried to execute a complete SQL Query and to convert the result to
the
target Class (which is defined in the repository). Tabledefinition is as
follows:
CREATE TABLE rel_sel_vb_partner (
`id` INT NOT NULL PRIMARY KEY auto_increment,
`sel_id` INT NOT NULL,
`vb_partner` VARCHAR(100) NOT NULL # one of the tab_comp.land_neu
) TYPE=MyISAM;
repository.xml:
<class-descriptor
class="de.virtualsolution.ojb.RelationSelVbPartner"
table="rel_sel_vb_partner">
<field-descriptor
id="1"
name="id"
column="id"
jdbc-type="INTEGER"
nullable="false"
primarykey="true"
autoincrement="true"
/>
<field-descriptor
id="2"
name="selectionId"
column="sel_id"
jdbc-type="INTEGER"
nullable="false"
primarykey="false"
/>
<field-descriptor
id="3"
name="vbPartner"
column="vb_partner"
jdbc-type="VARCHAR"
length="100"
nullable="false"
primarykey="false"
/>
</class-descriptor>
I define a very simple SQL statement:
String sql = "sel_id, vb_partner from rel_sel_vb_partner";
query = new QueryBySQL(RelationSelVbPartner.class, sql);
Iterator result = m_broker.getReportQueryIteratorByQuery(query);
while (iter.hasNext()) {
RelationSelVbPartner partner = (RelationSelVbPartner)iter.next();
System.out.println("partner = " + partner);
}
I get a ClassCastException while stepping through the Iterator. The Result
is just an Object[] with all the column values from the row.
What exactly (I took a very long look into the mail archieve, but couldn't
find the right mailing) is the right way to execute a complicated SQL
Statement (build up by myself, no with a Criteria) and Cast the result to
the target class which is known ?
Thanx for you help.
Thomas
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>