I have a mapping issue that makes no sense to me. I have two entities, RoomRes and ReportReservation, that have a one-to-many to a GuestInfo. When I start up my app, the RoomRes loads without a problem. However the ReportReservation mapping fails to load saying:
Caused by: org.hibernate.MappingException: Repeated column in mapping for entity: com.traveltripper.stargazer.common.dto.GuestInfo column: roomResId (should be mapped with insert="false" update="false")
The mappings are identical and in separate .hbm.xml files. This makes no sense to me. The backing guest_info table has foreign keys to the proper keys on RoomRes and ReportRes. I know, I know, we should be using auditing tables. We are headed in that direction. We have a lot of ####ed up code to un#### here where development was moved back onshore to do things right. What I am trying to do seems really straightforward. Is this error a red-herring caused by something else?
For what it is worth, my app context loads when I comment out the ReportReservation->GuestInfo mapping. So that seems to be the point of failure. Any help to get me back on a productive path would be appreciated.
The RoomRes->GuestInfo mapping, (abbreviated), is:
<?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> <class name="com.traveltripper.stargazer.common.dto.res.RoomRes" table="roomres" lazy="false"> <id name="roomResId" column="roomResId"> <generator class="native"/> </id> ... ... ...
<bag name="guests" table="guest_info" lazy="false" cascade="all"> <key column="roomResId" not-null="true"/> <one-to-many class="com.traveltripper.stargazer.common.dto.GuestInfo"/> </bag> ... ... </hibernate-mapping>
THE REPORT RES MAPPING IS:
<?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> <class name="com.traveltripper.stargazer.common.dto.ReportReservation" table="reportReservation" lazy="false"> <id name="roomResId" column="roomResId"/> ... ... ... <bag name="guests" table="guest_info" lazy="false" cascade="all"> <key column="roomResId" not-null="true"/> <one-to-many class="com.traveltripper.stargazer.common.dto.GuestInfo"/> </bag> ... ...
</hibernate-mapping>
|