Hi,
You have to create an interface and your class implement that interface.
And then you have to cast whith that interface.
IA tA = (A)tIter.next();
Vinicius Bomfim
'>'-- Mensagem Original --
'>'Reply-To: "OJB Users List" <[EMAIL PROTECTED]>
'>'Reply-To: ??? <[EMAIL PROTECTED]>
'>'From: ??? <[EMAIL PROTECTED]>
'>'To: "OJB Users List" <[EMAIL PROTECTED]>
'>'Subject: Problem of dynamic proxy?
'>'Date: Thu, 12 Jun 2003 14:51:00 +0800
'>'
'>'
'>'Hi!
'>' I declare a class-descriptor of A. Its proxy property is set dynamic.
'>'I try to load it from DB by oql command. The return collection is DList(because
'>'the OqlCollectionClass=org.apache.ojb.odmg.collections.DListImpl is
set in
'>'OJB.properties), but the elements in DList are proxy objects not A.
How can
'>'I get A from DList except that I must not set A proxy property dynamic?
'>'
'>'A class descript:
'>' <class-descriptor class="A" table="A" proxy="dynamic">
'>' :
'>' :
'>' :
'>' </class-descriptor>
'>'
'>'oql command : "select o from A"
'>'
'>'Using ODMG:
'>'
'>'1 String pQueryString = "select o from A";
'>'2 DList tResult = null;
'>'3 try {
'>'4 Transaction tx = this.odmg.currentTransaction();
'>'5 OQLQuery tQuery = this.odmg.newOQLQuery();
'>'6 tQuery.create(pQueryString);
'>'7 tResult = (DList)tQuery.execute();
'>'8 } catch (Exception e) {
'>'9 e.printStackTrace();
'>'10 throw new DBServerException(e.getMessage());
'>'11 }
'>'12 Iterator tIter = tResult.iterator();
'>'13 while (tIter.hasNext()){
'>'14 ? tA = (A)tIter.next();
'>' :
'>' :
'>' }
'>'
'>'I got a error message :"java.lang.ClassCastException: $Proxy119" on
line
'>'14.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]