I have this **Instrument** entity:

    <class name="Instrument" table="Instruments" mutable="false">
        <id name="ID" column="INSTRUMENT_ID" unsaved-value="0">
            <generator class="assigned" />
        </id>
        <property name="....." />
        <property name="....." />
    </class>

This entity is used in many-to-one relationship in other entity 
(**InstrumentSelection**). This is many-to-one mapping info:

    <many-to-one name="Instrument" access="field.camelcase" 
column="Instrument_ID" update="false" class="Instrument" not-null="true" 
fetch="join" lazy="false" />

The issue I've it that when I save **InstrumentSelection** entity with 
**Save**:

    Transact(() => session.Save(entity));

I get error in logs:

> 2012-12-20 14:09:54,607 WARN 12 NHibernate.Engine.ForeignKeys - Unable
> to determine if Instrument with assigned
> identifier 11457 is transient or detached; querying the database. Use
> explicit Save() or Update() in session to prevent this.

*A few facts about Instrument entity:*

 - It's just a reference entity
 - It's immutable entity
 - It can not be added / inserted via application. I get rows in database 
from external feed.

A my question is: is there a way to instruct NHibernate to always consider 
Instrument entity as detached? I mean - if an instance of Instrument exists 
in application it means that it's present in database. So there is no too 
much sense in quering the database - I want parent InstrumentSelection 
entity to only persist foreign key.

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/nhusers/-/XudRKVaLiWUJ.
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