hivemind-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stephane Decleire <sdecle...@cariboo-networks.com>
Subject Problem with Hivemind proxies in Hibernate
Date Thu, 12 Jul 2007 14:14:12 GMT
================
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.

Mime
View raw message