Records from 2 tables + hibernate
Hi frnds,
i have two tables oneid field is commen between both but not related to each other(like forignkey-primary key)..
the condition like this...
Table 1: Master(id,name)
Table 2: Detail(id,class)
(No forignkey-primary key relation) but records are like follows
One record in Master and id is generated
For that id more than one record for Detail table...
the query is like this:
String sql = select Detail.id from Detail,Master where Detail.id = Master.id;
i try to write like this:
String sql = "from Detail detail,Master master where detail.id=master.id";
Query q = session.createQuery(sql);
Iterator itr = q.iterate();
Detail d = new Detail();
while(itr.hasNext())
{
d = (Detail)itr.next();
}
it gives exception likeClassCastException at line d = (Detail)itr.next();
so any one have solution for this please told me.
thanks and regards,
PANDEV84

