You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-dev@db.apache.org by Jakob Braeuchi <jb...@hotmail.com> on 2004/05/12 21:46:08 UTC
[OJB] Issue #OJB242 modified
You can view the issue detail at the following URL:
http://nagoya.apache.org/scarab/issues/id/OJB242
Type
Defect
Issue ID
OJB242 (Cannot resolve multiple attributes in a single criteria or column)
Modified by
Jakob Braeuchi
brj (jbraeuchi@hotmail.com)
The following modifications were made to this issue:
---------------------------------------------------------------------
Resolution set to "Later"
Reason:
should be fixed with OJB244
---------------------------------------------------------------------
This message is automatically generated by the Scarab
issue tracking system. For more information:
http://scarab.tigris.org/
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org
Re: How do you map a reference to an interface-backed class? (non-trivial)
Posted by Thomas Dudziak <to...@first.fhg.de>.
Andrew Clute wrote:
> I have looked at all of the examples, I can't seem to make heads or
> tails of how to handle my situation. I want to map a class that has a
> reference to an object, that can one of many different objects, that all
> implement the same interface.
>
> Example
>
> Interface A{
>
> }
>
> class B implements A
> {}
>
> class C implements A
> {}
>
> class Z
> {
> private A myA;
> }
>
> So, in this case, how do I map class Z since it's member variable is of
> Type A, but I want the concrete object, either of Type B or C to be
> filled in.
>
> Seems like there is no known strategy to do this: "Using Interfaces With
> OJB" talks about a similar situation, but assumes that there is only one
> concrete class that can be instantiated for the reference (the
> factory-method assumes that it will only return one concrete class type).
>
> Seems like I need a combination of the Interface mapping, and the
> 'ojbConcreteClass' property to have the appropriate concrete class
> instantiated.
Yes, that should work. You define all common fields in the interface
including ojbConcreteClass using getter/setter methods, and you need the
PersistentFieldIntrospectorImpl or PersistentFieldAutoProxyImpl for the
field access (OJB.properties) as there are no fields only bean methods.
You also should not need factory-class/factory-method now because OJB
shouldn't try to instantiate the interface if ojbConcreteClass does not
refer to it.
Tom
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
How do you map a reference to an interface-backed class? (non-trivial)
Posted by Andrew Clute <an...@osn.state.oh.us>.
I have looked at all of the examples, I can't seem to make heads or
tails of how to handle my situation. I want to map a class that has a
reference to an object, that can one of many different objects, that
all implement the same interface.
Example
Interface A{
}
class B implements A
{}
class C implements A
{}
class Z
{
private A myA;
}
So, in this case, how do I map class Z since it's member variable is of
Type A, but I want the concrete object, either of Type B or C to be
filled in.
Seems like there is no known strategy to do this: "Using Interfaces
With OJB" talks about a similar situation, but assumes that there is
only one concrete class that can be instantiated for the reference (the
factory-method assumes that it will only return one concrete class
type).
Seems like I need a combination of the Interface mapping, and the
'ojbConcreteClass' property to have the appropriate concrete class
instantiated.
Thoughts? What am I missing?
-Andrew
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org