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