Hi,
I wasnt able to find a solution to my problem (maybe i was looking wrong places or searching wrong things dont know).
I have 2 tables = newsletter_templates and newsletter_template_settings. i am trying to map template settings several times to be able to use them by names i define.
I can actually just take all of settings using 1 list then separate them in JAVA but i'm trying to retrieve the data separately and be able to insert/update the settings table directly. when i try the mapping below i get an exception:
......
Caused by: org.hibernate.MappingException: Repeated column in mapping for entity: com.overteam.framework.persistent.NewsletterTemplateSettingsData column: template_id (should be mapped with insert="false" update="false")
......
i already mapped template_id column as it says but still get the exception. so i cant even try if i am able to do this. any help would be great.
Thanks..
my xmls are as follows:
-newsletterTemplateSettings
Code:
<class name="com.overteam.framework.persistent.NewsletterTemplateSettingsData" table="newsletter_template_settings">
<id name="id" column="id" type="long" >
<generator class="sequence" >
<param name="sequence">newsletter_template_settings_id_sequence</param>
</generator>
</id>
<property name="created" column="created" type="timestamp" not-null="true"/>
<property name="modified" column="modified" type="timestamp" not-null="true"/>
<property name="creatorId" column="creator_id" type="long" not-null="true"/>
<property name="modifierId" column="modifier_id" type="long" not-null="true"/>
<property name="status" column="status" type="string" length="1"/>
<property name="templateId" column="template_id" type="long" not-null="true" insert="false" update="false"/>
<property name="type" column="typ" type="int" not-null="true"/>
<property name="objectId" column="object_id" type="long" not-null="false"/>
<property name="body" column="body" type="string" length="65535"/>
<property name="active" column="active" type="boolean" not-null="true"/>
</class>
-newsletterTemplate
Code:
<class name="com.overteam.framework.persistent.NewsletterTemplateData" table="newsletter_templates">
<id name="id" column="id" type="long" >
<generator class="sequence" >
<param name="sequence">newsletter_templates_id_sequence</param>
</generator>
</id>
<property name="created" column="created" type="timestamp" not-null="true"/>
<property name="modified" column="modified" type="timestamp" not-null="true"/>
<property name="creatorId" column="creator_id" type="long" not-null="true"/>
<property name="modifierId" column="modifier_id" type="long" not-null="true"/>
<property name="status" column="status" type="string" length="1"/>
<property name="type" column="typ" type="int" not-null="true"/>
<property name="title" column="title" type="string" not-null="true" length="511" />
<property name="headerArticle" column="header_article" type="long" not-null="true"/>
<property name="headerImage" column="header_image" type="string"/>
<property name="sent" column="sent" type="boolean" not-null="true" />
<property name="toWho" column="to_who" type="int" not-null="true"/>
<bag name="siteRestrictions" cascade="all" lazy="false" where="typ = 1" order-by="id">
<key column="template_id" not-null="true"/>
<one-to-many class="com.overteam.framework.persistent.NewsletterTemplateSettingsData" not-found="ignore"/>
</bag>
<bag name="displayHeader" cascade="all" lazy="false" where="typ = 2 and object_id = 1">
<key column="template_id" not-null="true" />
<one-to-many class="com.overteam.framework.persistent.NewsletterTemplateSettingsData" not-found="ignore" />
</bag>
<bag name="displayHeaderCustomize" cascade="all" lazy="false" where="typ = 2 and object_id = 2">
<key column="template_id" not-null="true" />
<one-to-many class="com.overteam.framework.persistent.NewsletterTemplateSettingsData" not-found="ignore" />
</bag>
........................... and keeps going for other settings
</class>