Hello.
I've a problem with Hibernate mapping.
I've three tables:
============
VendorAccount:
id bigint(identity) primary key
name varchar(50)
============
BiddingSettings:
accountId bigint references VendorAccount.id
distributionType char(1) references DistributionType.code
bidSunday bit
bitMonday bit
bidXXX bit etc.
============
DistributionType:
code char(1) primary key
description varchar(50)
========================================
So BiddingSettings has composite primary key (accountID+distributionType) and it's immutable. I want to access it unidirectionally from VendorAccount as 
Code:
    settings = vendorAccount.getBiddingSettings().get(distributionType);
so <map> is ideal for me.
Problem is that when Factory is initializing hibernate it gives error:
Quote:
org.hibernate.MappingException: Repeated column in mapping for entity: com.business.sem.BiddingSchedule column: accountId (should be mapped with insert="false" update="false")
Why duplicate column? Has anyone been able to create a map pointing to a table with composite key? My compsite key is immutable, that's why I didn't want to create an identity column in the BiddingSettings table.
Hibernate version: 3.0.5
Mapping documents:<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="com.business.sem" default-cascade="save-update" default-lazy="true">
    <class name="VendorAccount" lazy="true" select-before-update="false" table="VendorAccount">
        <meta attribute="implements">com.business.sem.IEntityState</meta>
        <id name="id" type="java.lang.Long" column="id">
    		<meta attribute="use-in-tostring">true</meta>
        	<generator class="identity" />
        </id>
        <property name="name" column="name" length="50" type="java.lang.String" not-null="true">
    		<meta attribute="use-in-tostring">true</meta>
        	<meta attribute="field-description">Name of the account</meta>
        </property>
        <property name="quickCode" column="quickCode" length="9" type="java.lang.String" not-null="true">
    		<meta attribute="use-in-tostring">true</meta>
        	<meta attribute="field-description">1-5 character code of the account for faster SQL</meta>
        </property>
        <property name="logonURL" column="logonURL" type="java.lang.String" length="1024" not-null="false">
        	<meta attribute="field-description">[Maybe] URL of the logon page</meta>
        </property>
        <property name="userName" column="username" type="java.lang.String" length="50" not-null="false">
        	<meta attribute="field-description">[Maybe] user's logon</meta>
        </property>
        <property name="password" column="password" type="java.lang.String" length="40" not-null="false">
        	<meta attribute="field-description">[Maybe] user's account password</meta>
        </property>
        <property name="key1" column="key1" type="java.lang.String" length="128" not-null="false">
        	<meta attribute="field-description">[Maybe] Additional information to get into account, e.g. account key</meta>
        </property>
        <property name="key2" column="key2" type="java.lang.String" length="128" not-null="false">
            <meta attribute="field-description">[Maybe] Additional information to get into account, e.g. account key</meta>
        </property>
        <property name="minBid" column="minBid" type="java.math.BigDecimal" scale="2" not-null="false">
        	<meta attribute="field-description">[Maybe] Minimum bid for a keyword allowed in this account</meta>
        </property>        
        <map name="biddingSchedule" outer-join="true" table="BiddingSchedule">
        	<key column="accountId" not-null="true" unique="false" update="false" />
        	<map-key-many-to-many class="com.business.sem.DistributionType" column="distributionType" />
        	<one-to-many class="BiddingSchedule" />
	 		<!--composite-element class="SEMBEEBiddingSchedule">
	 			<many-to-one name="account" column="accountId" class="VendorAccount" not-null="true" />
	 			<many-to-one name="distribType" column="distributionType" class="DistributionType" not-null="true" />
		       	<property name="bidSunday" column="bidSun" type="java.lang.Boolean" not-null="true" />
		       	<property name="bidMonday" column="bidMon" type="java.lang.Boolean" not-null="true" />
		       	<property name="bidTuesday" column="bidTue" type="java.lang.Boolean" not-null="true" />
		       	<property name="bidWednesday" column="bidWed" type="java.lang.Boolean" not-null="true" />
		       	<property name="bidThursday" column="bidThu" type="java.lang.Boolean" not-null="true" />
		       	<property name="bidFriday" column="bidFri" type="java.lang.Boolean" not-null="true" />
		       	<property name="bidSaturday" column="bidSat" type="java.lang.Boolean" not-null="true" />
			</composite-element>-->
        </map>
        <property name="lastUpdate" column="lastUpdate" type="java.sql.Timestamp" not-null="false" update="false" insert="false" />
</hibernate-mapping>
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="com.business.sem" default-cascade="save-update" default-lazy="true">
    <class name="BiddingSchedule" table="BiddingSchedule" lazy="true" select-before-update="false">
     	<composite-id name="pk" class="BiddingSchedulePK">
    		<meta attribute="use-in-tostring">true</meta>
    		<key-many-to-one name="account" column="accountId" class="VendorAccount">
	    		<meta attribute="use-in-tostring">true</meta>
    		</key-many-to-one>
    		<key-many-to-one name="distributionType" column="distributionType" class="DistributionType">
	    		<meta attribute="use-in-tostring">true</meta>
    		</key-many-to-one>
    	</composite-id>
    	<natural-id mutable="false">
    	  <many-to-one name="account" column="accountId" class="VendorAccount" />
    	  <many-to-one name="distribution" column="distributionType" class="DistributionType" />
    	</natural-id>
       	<property name="bidSunday" column="bidSun" type="java.lang.Boolean" not-null="true" />
       	<property name="bidMonday" column="bidMon" type="java.lang.Boolean" not-null="true" />
       	<property name="bidTuesday" column="bidTue" type="java.lang.Boolean" not-null="true" />
       	<property name="bidWednesday" column="bidWed" type="java.lang.Boolean" not-null="true" />
       	<property name="bidThursday" column="bidThu" type="java.lang.Boolean" not-null="true" />
       	<property name="bidFriday" column="bidFri" type="java.lang.Boolean" not-null="true" />
       	<property name="bidSaturday" column="bidSat" type="java.lang.Boolean" not-null="true" />
    </class>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():Full stack trace of any exception that occurs:Caused by: org.hibernate.MappingException: Repeated column in mapping for entity: com.business.sem.SEMBEEBiddingSchedule column: accountId (should be mapped with insert="false" update="false")
	at org.hibernate.mapping.PersistentClass.checkColumnDuplication(PersistentClass.java:504)
	at org.hibernate.mapping.PersistentClass.checkPropertyColumnDuplication(PersistentClass.java:526)
	at org.hibernate.mapping.PersistentClass.checkColumnDuplication(PersistentClass.java:544)
	at org.hibernate.mapping.PersistentClass.validate(PersistentClass.java:335)
	at org.hibernate.mapping.RootClass.validate(RootClass.java:188)
	at org.hibernate.cfg.Configuration.validate(Configuration.java:839)
	at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1000)
	at com.business.sem.base._BaseRootDAO.initialize(_BaseRootDAO.java:54)
	at com.business.sem.h3.H3DatastoreFactory.<init>(H3DatastoreFactory.java:12)
	at com.business.sem.h3.H3DatastoreFactory.getInstance(H3DatastoreFactory.java:21)
	at com.business.sem.util.Utils.<clinit>(Utils.java:19)
Name and version of the database you are using:SQLServer 2000
The generated SQL (show_sql=true):N/A
Debug level Hibernate log excerpt:14:07:30,963 INFO  [STDOUT] 14:07:30,963 INFO  [Configuration] processing collection mappings
14:07:30,963 INFO  [STDOUT] 2531 [http-0.0.0.0-8080-1] INFO org.hibernate.cfg.Configuration  - processing collection mappings
14:07:30,963 INFO  [STDOUT] 2531 [http-0.0.0.0-8080-1] DEBUG org.hibernate.cfg.HbmBinder  - Second pass for collection: com.business.sem.VendorAccount.sembeeBiddingSchedule
14:07:30,963 INFO  [STDOUT] 14:07:30,963 INFO  [HbmBinder] Mapping collection: com.business.sem.VendorAccount.sembeeBiddingSchedule -> SEMBEEBiddingSchedule
14:07:30,963 INFO  [STDOUT] 2531 [http-0.0.0.0-8080-1] INFO org.hibernate.cfg.HbmBinder  - Mapping collection: com.business.sem.VendorAccount.sembeeBiddingSchedule -> SEMBEEBiddingSchedule
14:07:30,963 INFO  [STDOUT] 2531 [http-0.0.0.0-8080-1] DEBUG org.hibernate.cfg.HbmBinder  - Mapped collection key: accountId, index: distributionType, one-to-many: com.business.sem.SEMBEEBiddingSchedule
Problems with Session and transaction handling?
Read this: 
http://hibernate.org/42.htmlCode:
[quote][/quote]