Hi,

I'm not sure what the answer is, but I don't think you can ... you might need to have a separate join class and two one-to-many maps.

You could try the users group http://groups.google.com/group/nhusers (the correct place for questions) ... this is the developers group.

Cheers,
   Richard

--------------------------------------------------
From: "seenu" <[email protected]>
Sent: Tuesday, May 25, 2010 9:32 PM
To: "nhibernate-development" <[email protected]>
Subject: [nhibernate-development] schema export -- collection mapping to Views.

I am trying to map my objects to Views (Read only objects). I set
schema-action to none and Validate to avoid creating any new tables.

My issue here is Schema export is trying to create Join table
Station__rooms for the list object which i want to map to an existing
View and not to create a table.

What do i need to specify on the collection mappings for schema export
not to generate those tables.

Here is how mapping looks like
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
                  assembly="ObjectModel"
                  namespace="ServiceLayer" auto-import="false">

   <class name="com.temp.objects.Station" table="Stations_V"
lazy="true" mutable="false"
    dynamic-insert="false" dynamic-update="false" schema-
action="none,validate">
<composite-id>
     <key-property name="Id" column="Id" type="string"/>
</composite-id>
     <property name="Name" column="Name" type="string" />


<list name="Rooms" table="Station__rooms" cascade="none"
inverse="false" mutable="false">
     <key>
  <column name="Id" />
     </key>
     <list-index column="idx" />
     <many-to-many class="com.temp.objects.Room" column="Room" />
</list>
   </class>
</hibernate-mapping>



Reply via email to