I try it again, with some more details:

--> AbstractImpl implements Abstract
      (not registered in Hivemind)

--> XImpl exetends AbstractImpl implements X
      (registered service in Hivemind)
      includes method setHibernateSession(Session)


XImpl is dependent on Session but hivemind does not wire session into it.

I will try to produce a testcase tomorrow using the hivemind-article files.

Cheers,
Ron

PS - It could be that the problem is elsewhere, however removing the inheritance made it work, and I can not recall changing anything else on the way, but I look in detail tomorrow...




ציטוט James Carman:
I just changed my article example code to try to mimic what you are saying.
Check it out via SVN at
www.carmanconsulting.com/svn/public/hivemind-article.

Now, what I did was extract a superclass (AbstractHibernateRepository) from
the HibernateUserRepository class, which declares the dependency upon a
Hibernate Session object (exposes a session property writer).  After doing
that, everything autowires just fine using my example code.  Let me know if
you don't think I'm quite reproducing your environment properly and we'll
try to come up with something that does.


-----Original Message-----
From: Ron Piterman [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 10, 2005 2:11 PM
To: [email protected]
Subject: Re: Newbie question


The problem seems to be in inheritance. My RLocalPortalsImpl extends some other class, which in turn, implements an interface.

-->> AbstarctImpl implements Abstract

-->> XImpl extends AbstractImpl implements X

(Note that "Abstarct" is not registered in hivemind)

in this case, hivemind does not auto-wire the dependencies of XImpl.

is this a bug? or is it ok?

removing the inheritance solved the problem.

Cheers,
Ron


  Ron Piterman:

Hi,
I use the hibernate example from howards article in TSS, but I am not
sure I understand HiveMind correctly:

When I define a service for Interface X, and in the implementation class
of some other service, I add a setter: setBla(X x), hivemind should set
an X instance to the Service implementation automatically?

Or do I have to explicitly add <set-service... to each factory ?


In a repository implementation , the hibernate session is not being set.

Nothing on the logs (DEBUG level) - how do I get to the source of the
problem?


Here are some files...
Thanx, Ron


...
<service-point id="sessionFactory"
 interface="org.apache.hivemind.ServiceImplementationFactory"
 parameters-occurs="none"/>

<service-point id="session" interface="org.hibernate.Session"/>
...

<service-point id="localPortals" interface="RLocalPortals"/>
<implementation service-id="localPortals">
   <invoke-factory>
     <construct class="impl.RLocalPortalsImpl"/>
   </invoke-factory>
</implementation>

---

public class RLocalPortalsImpl extends AbstractRepositoryImpl implements
RLocalPortals {

 public List getRegistrationCountries() {
   Query q =
     session.getNamedQuery("registration-countries");  // *NullPExcep*
   return q.list();
 }
 public void setSession(Session session) {
   this.session = session;
 }
}

---

On the session.getNamedQuery(...) I get a null pointer exception,
meaning the session is null :-(

Wo what did I do wrong?



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to