I checked the trunk version of NHibernate and found the
AbstractSaveEventListener is changed to :

protected virtual object SaveWithGeneratedId(object entity, string
entityName, object anything, IEventSource source, bool
requiresImmediateIdAccess)
 {
            IEntityPersister persister =
source.GetEntityPersister(entityName, entity);
            ...
}

great :-)


On Mon, Apr 13, 2009 at 4:08 PM, Yaojian <[email protected]> wrote:

> In the hibernate 
> document<http://www.hibernate.org/hib_docs/reference/en/html/mapping.html>:
>
>
> entity-name (optional, defaults to the class name): Hibernate3 allows a
> class to be mapped multiple times (to different tables, potentially), and
> allows entity mappings that are represented by Maps or XML at the Java
> level. In these cases, you should provide an explicit arbitrary name for the
> entity. See Section 4.4, “Dynamic 
> models”<http://www.hibernate.org/hib_docs/reference/en/html/persistent-classes-dynamicmodels.html>and
>  Chapter 18,
> *XML 
> Mapping*<http://www.hibernate.org/hib_docs/reference/en/html/xml.html>for 
> more information.
>
> In the NHibernate-2.0.1GA documentation, the entity-name attribute is not
> documented.
> So the NHibernate guys decided to ignore this feature?
>
>
> On Mon, Apr 13, 2009 at 2:30 PM, Yaojian <[email protected]> wrote:
>
>> Hi,
>>
>> I am a newby to NHibernate.
>>
>> I am wonderring wether the ISession.Save(String entityName, Object obj)
>> should use the EntityPersister for the given entityName instead of the
>> EntityPersister for obj.GetType()?
>>
>> I checked the NHibernate source code in AbstractSaveEventListener.cs :
>> public class AbstractSaveEventListener {
>>
>>         protected virtual object SaveWithGeneratedId(object entity, string
>> entityName, object anything, IEventSource source, bool
>> requiresImmediateIdAccess)
>>         {
>>             IEntityPersister persister =
>> source.GetEntityPersister(entity);
>>             ...
>>         }
>> }
>>
>> I think that NHibernate should not assume the entityName is always the
>> same as obj.GetType().
>>
>> By the way, could anybody kindly explain what the "entityName" really is?
>>
>> Yaojian
>>
>
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to