db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robert S. Sfeir" <rob...@codepuccino.com>
Subject Re: Bug when using extent classes?
Date Sun, 18 Jul 2004 18:05:30 GMT
Sorry just spoke to Brian, I missed the issue with extent and 1 table  
with 2 extents.

Is there anything we can do to get extents working the way they're  
supposed to?  I need to persist the same object, always, but I need to  
retrieve objects one with references to other objects the other one  
without.  Brian suggested Proxy but it seems there is some flakiness on  
persisting.

So it seems like a double edged sword.

R

On Jul 18, 2004, at 1:42 PM, Robert S. Sfeir wrote:

> Did I just find a bug?
> The following line of code is from a test case:
>
>         Ticket t = (TicketDetailBean)  
> omd.retrieveObjectDetail(TrackerBeanFactory.getInstance("com.codepuccin 
> o.tracker.beans.ojb.TrackerOJBBeanFactory").createTicketDetail(), new  
> Integer(9999), "ID");
>
> createTicketDetail() returns a new TicketDetailBean()
>
> Ticket is an interface which is implemented by TicketBean and  
> TicketDetailBean.  Difference between the two is that one holds  
> reference objects to other tables the other one doesn't.
>
> My repository is setup as follows:
>
> <class-descriptor class="com.codepuccino.tracker.beans.Ticket">
>     <extent-class  
> class-ref="com.codepuccino.tracker.beans.ojb.TicketDetailBean"/>
>     <extent-class  
> class-ref="com.codepuccino.tracker.beans.ojb.TicketBean"/>
> </class-descriptor>
>
> with each appropriate class descriptor for each:
>
> <class-descriptor  
> class="com.codepuccino.tracker.beans.ojb.TicketDetailBean"  
> table="CDPCNO_TICKETS">
> ...
> </class-descriptor>
>
> <class-descriptor class="com.codepuccino.tracker.beans.ojb.TicketBean"  
> table="CDPCNO_TICKETS">
> ...
> </class-descriptor>
>
> I've setup a unit test to test persisting and retrieving the object.
>
> When I run the test the information is passed in correctly as evident  
> by my debugger's info:
>
> retriveObjectDetail(Object, Integer, String)
> Object is what I am looking for, in this case: TicketDetailBean
> Integer:  the ID of the Object
> String: The primary key col I am matching by: "ID" in this case.
>
> The debugger shows all 3 values as being correct including the Object  
> being TicketDetailBean with null values.
>
> When I call the method, the following info is processed:
>
> 	Criteria crit = new Criteria();
>             crit.addEqualTo(theColumn, theID);
>             Query query = QueryFactory.newQuery(bean.getClass(), crit);
>             object = broker.getObjectByQuery(query);
>
> bean.getClass() returns the proper object, TicketDeailBean
> when broker.getObjectByQuery(query) is executed it returns...   
> TicketBean... This of course causes a ClassCastException.
>
> HUH?
>
> Am I doing something unsupported here?
>
> R
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-dev-help@db.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Mime
View raw message