-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: Internal Class
PostPosted: Thu Jan 26, 2006 3:11 pm 
Newbie

Joined: Wed Jan 11, 2006 9:02 am
Posts: 11
Hi,

I would like to know how I can configure internal class in a mapping file. I see in the caveatemptor the mapping file of CategoryedItem.hbm.xml with the following tag:

Code:

<class name="CategorizedItem" table="CATEGORIZED_ITEM"
      lazy="true">
      <composite-id name="id" class="CategorizedItem$Id"
             access="org.hibernate.auction.persistence.DirectSetAccessor"
             unsaved-value="any">
             
             <key-property name="categoryId"
                      access="field"
                      column="CATEGORY_ID"
                      length="16"/>

             <key-property name="itemId"
                      access="field"
                      column="ITEM_ID"
                      length="16"/>
      </composite-id>



In the composite-id line has a class attribute with "CategorizedItem$Id" where Id is a static internal class of CategorizedItem class.

In NHibernate I try to do like that how you can see.

Code:

<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0">
    <class name="PersistentLayer.libraries.ProdutoFabricante, PersistentLayer"
        table="produto_fabricante" lazy="true">
       
        <composite-id name="IdProdutoFabricante" class="PersistentLayer.libraries.ProdutoFabricante$IdProdutoFabricante, PersistentLayer" unsaved-value="any">
            <key-property name="IdProduto" column="id_produto" />
            <key-property name="IdFabricante" column="id_fabricante" />
        </composite-id>


Unfortunately NHibernate returns me an error like this:

Code:

See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.Configuration.ConfigurationErrorsException: Error instantiating context. ---> Spring.Objects.FatalObjectException: Cannot instantiate Type [Spring.Context.Support.XmlApplicationContext] using ctor [Void .ctor(Boolean, System.String[])] : 'Exception has been thrown by the target of an invocation.' ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> Spring.Objects.Factory.ObjectCreationException: Error thrown by a dependency of object 'bancoDadosService' defined in 'assembly [PersistentLayer, Version=1.0.2217.29846, Culture=neutral, PublicKeyToken=null], resource [PersistentLayer.services.objetos.xml] line 26' : Initialization of object failed : Cannot instantiate Type [PersistentLayer.dao.Nhibernate.BancoDados] using ctor [Void .ctor()] : 'Exception has been thrown by the target of an invocation.'
while resolving 'bancoDados' to 'bancoDados'  defined in 'assembly [PersistentLayer, Version=1.0.2217.29846, Culture=neutral, PublicKeyToken=null], resource [PersistentLayer.services.objetos.xml] line 29' ---> Spring.Objects.FatalObjectException: Cannot instantiate Type [PersistentLayer.dao.Nhibernate.BancoDados] using ctor [Void .ctor()] : 'Exception has been thrown by the target of an invocation.' ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> NHibernate.MappingException: could not find class: PersistentLayer.libraries.ProdutoFabricante$IdProdutoFabricante, PersistentLayer ---> System.TypeLoadException: Could not load type 'PersistentLayer.libraries.ProdutoFabricante$IdProdutoFabricante' from assembly 'PersistentLayer'.



Someone knows how can I solve this problem?

Thanks in advance,
Cleiton


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 26, 2006 5:22 pm 
Expert
Expert

Joined: Thu Jan 19, 2006 4:29 pm
Posts: 348
I think that You should use "+" instead of "$".

The Type.FullName property might be helpfull in figuring out what's wrong


Top
 Profile  
 
 Post subject: Re: Internal Class
PostPosted: Thu Jan 26, 2006 9:56 pm 
Newbie

Joined: Wed Jan 11, 2006 9:02 am
Posts: 11
gert,

You was right! I changed "$" by "+" and the mapping file working fine.

Thanks,
Cleiton


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.