-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Is it ok from Hibernate side?
PostPosted: Tue Jun 15, 2004 6:08 am 
Regular
Regular

Joined: Fri Nov 21, 2003 10:23 am
Posts: 81
I discovered more exactly, where the problem is.

I have code snippet:

Code:
InstrumentHistory ih = svc.query("from InstrumentHistory");

Instrument instrument = ih.getInstrument();

if (instrument instanceof InstrumentOption) {
   System.out.println("InstrumentOption");
} else if (instrument instanceof InstrumentFuture) {
   System.out.println("InstrumentFuture");
} else {
   System.out.println("Unknown type of Instrument:"+instrument.getClass().toString());
}




There are at least two scenarios:
1. When svc.query("from InstrumentHistory") is remote call (SLSBean on JBoss), program prints "InstrumentOption" string.

2. When svc.query("from InstrumentHistory") run on client, so all code run on client, program prints "Unknown type of Instrument: class com.domainmodel.Instrument$$EnhancerByCGLIB$$8dde150f"

So problem is that proxy object does not extend InstrumentOption object or InstrumentFuture object or appropriate object, but extends ancestor InstrumentStatic. When svc.query is remote call, there is serialiazation on server side and deserialization on client side, so it results to right results on client side.

My question: is it bug?
And how to fix this situation?
How to force hibernate after returning object (InstrumentHistory ih) from db to return ( ih.getInstrument() ) appropriate instance of class (InstrumentOption, InstrumentFuture) or proxy that extends from appropriate class.


Top
 Profile  
 
 Post subject: sorry
PostPosted: Tue Jun 15, 2004 6:18 am 
Regular
Regular

Joined: Fri Nov 21, 2003 10:23 am
Posts: 81
sorry, this submission is continuity from topic:
http://forum.hibernate.org/viewtopic.php?t=931010


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.