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

[1008 byte] By [pandev84a] at [2007-11-27 7:53:17]
# 1
If you can't be bothered to answer my questions, I can't be bothered to help. http://forum.java.sun.com/thread.jspa?threadID=5183896
dcmintera at 2007-7-12 19:34:34 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 2
Since you can't read a class cast exception and interpret it, I believe you are unwise to use a library like Hibernate.Master Java first and foremost, and then master JDBC. Evidently you have achieved neither of these and they are both prerequisites for using Hibernate.
dcmintera at 2007-7-12 19:34:34 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 3
thanks for u r advice...Regards,PanDev84
pandev84a at 2007-7-12 19:34:35 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...