hivemind-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stephane Decleire <sdecle...@cariboo-networks.com>
Subject Re: Problem with Hivemind proxies in Hibernate
Date Thu, 12 Jul 2007 15:20:37 GMT
Hi Johan,

It's only a sample to show the problem i'm faced with.

In my real application, i've got a singleton pojo which is never 
persisted (here my parent) but this singleton is a kind of factory for 
over pojos (like the child) which are persisted using Hibernate.
By the way, i need Hivemind to generate those pojos because my children 
are themselves complex pojos which encapsulates other pojos defined in 
Hivemind.

Stephane

Johan Lindquist a écrit :
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi Stephane,
>
> My ask first what you exactly are trying to do?  What is the reason you
> would like to define the parent/child object within Hivemind and then
> persist them?
>
> Are the parent/child objects not simple beans just now which (without
> involving hivemind) can be stored/retrieved etc using the DAO service
> (which is defined in Hivemind as a service)?
>
> Cheers,
>
> Johan
>
> Stephane Decleire wrote:
>   
>> ================
>> Approach 1 :
>>
>> I have two pojos : Parent and Child with there respective interface
>> IParent and IChild.
>>
>> public Interface IParent {
>>     public void setChild(IChild child);
>>     public IChild getChild();
>> }
>>
>> In Hivemind, i have declared the services below :
>>
>>   <service-point id="Parent" interface="IParent">
>>       <invoke-factory>
>>           <construct class="Parent">
>>                 <set-object property="child" value="service:Child"/>
>>           </construct>
>>       </invoke-factory>
>>   </service-point>
>>
>>   <service-point id="Child" interface="IChild">
>>       <invoke-factory>
>>           <construct class="Child"/>
>>       </invoke-factory>
>>   </service-point>
>>
>>
>> Hivemind works with interfaces so, in my code, i get a child from its
>> parent :
>>     IChild child1 = parent.getChild();
>> Using this approach, i assume that child1 is in fact a Hivemind proxy on
>> my child1 pojo (tell me if i'm wrong). So i can't convert IChild into
>> Child ...
>>
>> And then, i would like to persist my pojo child1 using a DAO :
>>
>> public Interface IChildDao {
>>     public void persist(IChild child);
>> }
>>
>> But Hibernate doesn't know how to persist IChild because what it really
>> try to persist is a Hivemind proxy !
>>
>> ================
>> Approach 2 :
>>
>> I know that Hibernate isn't able to persist the interface so the my DAO
>> interface becomes :
>>
>> public Interface IChildDao {
>>     public void persist(Child child);
>> }
>>
>> So i need to get the instance of my pojo Child and not an interface from
>> my pojo Parent :
>>     Child child1 = parent.getChild();
>>
>> That's implies that my parent interface becomes :
>>
>> public Interface IParent {
>>     public void setChild(Child child);
>>     public Child getChild();
>> }
>>
>> And in this case Hivemind doesn't build my services !
>>
>> I can't find the architecture which satisfies both framework ...
>> Any help would be very appreciated !
>>
>> Stephane.
>>     
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.6 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iD8DBQFGlkJm1Tv8wj7aQ34RAh+yAJ40Nv8xouId2bclT0z5e/swnJJnGACbBtS2
> n+vhFnCEXUC+LHDgURkiYYU=
> =YE45
> -----END PGP SIGNATURE-----
>   

Mime
View raw message