I'm still a bit new with hivemind but it's my understanding that
everything is proxied so casting to an implementation isn't going to
work. Not sure if there's anyway around that.
On 7/20/05, Vinicius Carvalho <[EMAIL PROTECTED]> wrote:
> Hello there! I was doing some tests here and found out that even
> though hivemind no longer requires a interface I can't cast a service
> to it's implementation class. Someone please correct me here.
>
> I have this scenario:
>
> <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="categoria" interface="com.cs.model.persistence.BaseEntity">
> <create-instance class="com.cs.model.persistence.Categoria"
> model="threaded"/>
> </service-point>
>
> Well those are not "real" services, they're only persistent pojos that
> I need hivemind to control for me (inject on my DAOs)
>
> Well, So I got this test case ok:
>
> public class ProdutoServiceTest extends HiveMindTestCase {
> private Registry registry;
> @Override
> protected void setUp() throws Exception {
> registry = buildFrameworkRegistry("/conf/hivemodule.xml");
> }
>
> public void testInsert() throws Exception{
> IProduto produto = (Produto)
> registry.getService("com.cs.tcrud.produto",BaseEntity.class);
>
> }
>
> Well I get an ClassCastException at this point. Well I know program to
> interface is a good practice, but what about some implementation
> specific methods? I'm 100% sure I'm doing something wrong ;) Could
> someone give me a help on this?
>
> Thanks
>
> ---------------------------------------------------------------------
> 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]