You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hivemind.apache.org by Vinicius Carvalho <ja...@gmail.com> on 2005/07/17 00:55:13 UTC

Couple of questions regarding services

Hello there!
Well one thing I found quite unusual if I may say so. is that almost
every example from hivemind is based on constructor injection. How
does hivemind resolves the setter injection? I saw on the examples
that it does auto-wire (which I just don't like on spring) by default.
I think that a simple example of how to use with setter and
constructor would be really nice

Second, how does it deals with inheritance? With spring beans I used
the "parent" attribute. So I could inject a property in the base class
and all dependents would get that property.

Regards

Vinicius

---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-user-help@jakarta.apache.org


Re: Couple of questions regarding services

Posted by Vinicius Carvalho <ja...@gmail.com>.
I've seen it, now I read it (excellent article :D )
Well but I'm getting a problem here that you did not described:
" Note, however, that the dependencies can only be "autowired" if
there is no ambiguity about which service point to use (outside the
scope of this article). " I'm getting the error:
Error building service TCRUD.produtoDAO: Unable to find constructor
applicable for autowiring. Use explicit constructor parameters.

<service-point id="MySession" interface="org.hibernate.Session">
    <invoke-factory
service-id="hivetranse.hibernate3.AnnotationSessionFactory"
model="singleton">
        <config file="hibernate.cfg.xml">
        </config>
    </invoke-factory>
</service-point>	

	
<service-point id="produto" interface="com.cs.model.persistence.BaseEntity">
	<create-instance class="com.cs.model.persistence.Produto" model="threaded"/>
</service-point>
	
<service-point id="produtoDAO" interface="com.cs.eai.dao.DAO">
	<invoke-factory model="singleton">
		<construct class="com.cs.eai.dao.HibernateGenericDAO">
			<service>produto</service>
			<service>MySession</service>
		</construct>
	</invoke-factory>
</service-point>

Could you give me a hint on this?

Thanks

---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-user-help@jakarta.apache.org


Re: Couple of questions regarding services

Posted by James Carman <ja...@carmanconsulting.com>.
1.  Did you check out my article
(http://www.theserverside.com/articles/article.tss?l=HivemindBuzz)?  It
uses setter injection only.

2 and 3.  If your properties are writable (public setter methods), then
HiveMind can inject them, regardless of whether the setters were declared
in an abstract base class or not.


> Hello there!
> Well one thing I found quite unusual if I may say so. is that almost
> every example from hivemind is based on constructor injection. How
> does hivemind resolves the setter injection? I saw on the examples
> that it does auto-wire (which I just don't like on spring) by default.
> I think that a simple example of how to use with setter and
> constructor would be really nice
>
> Second, how does it deals with inheritance? With spring beans I used
> the "parent" attribute. So I could inject a property in the base class
> and all dependents would get that property.
>
> Regards
>
> Vinicius
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: hivemind-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: hivemind-user-help@jakarta.apache.org
>
>


James Carman, President
Carman Consulting, Inc.


---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-user-help@jakarta.apache.org


Re: Couple of questions regarding services

Posted by Vinicius Carvalho <ja...@gmail.com>.
just adding another question:

what if my superclass is abstract???

---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-user-help@jakarta.apache.org