Hello,
im using an intermediate entity class to map additional columns to a jointable and it works fine as long as the Id will be generated from the both ids from the involved tables.
Now i need to add a third value from the entity-class to the composite-id, because i want to generate objects with new Ids out of the existing ones.
I want to add the integer-value "revision" from BacklogAufgabe to the composite-id.
With this mapping the error: "An association from the table backlogaufgabe refers to an unmapped class: int" occurs, i understand it, but i cant find a solution to properly map this correctly.
Here s the mapping + sql:
Code:
<hibernate-mapping package="app.domain">
<class mutable="false" name="app.domain.BacklogAufgabe" table="backlogaufgabe">
<composite-id class="BacklogAufgabe$Id" name="id">
<key-property access="field" column="id_backlog" name="backlogId"/>
<key-property access="field" column="id_aufgabe" name="aufgabeId"/>
<key-property access="field" column="revision" name="revisionId"/>
</composite-id>
<property column="datum" name="datum" not-null="true" type="date"/>
<property column="rang" name="rang" not-null="true" type="int"/>
<property column="revision" name="revision" not-null="true" type="int"/>
<property column="aufw_schaetzung" name="aufwSchaetzung" not-null="true" type="int"/>
<property column="aufw_messung" name="aufwMessung" not-null="true" type="int"/>
<many-to-one cascade="save-update" column="id_aufgabe" insert="false" lazy="false" name="aufgabe" not-null="true" update="false"/>
<many-to-one cascade="save-update" column="id_backlog" insert="false" lazy="false" name="backlog" not-null="true" update="false"/>
<many-to-one cascade="save-update" column="revision" insert="false" lazy="false" name="revision" not-null="true" update="false"/>
</class>
</hibernate-mapping>
Code:
CREATE TABLE backlogaufgabe
(
id serial NOT NULL,
id_backlog integer NOT NULL,
id_aufgabe integer NOT NULL,
revision integer NOT NULL,
datum date NOT NULL,
rang integer NOT NULL,
aufw_schaetzung integer,
aufw_messung integer,
CONSTRAINT backlogaufgabe_pkey PRIMARY KEY (id),
CONSTRAINT backlogaufgabe_id_aufgabe_fkey FOREIGN KEY (id_aufgabe)
REFERENCES aufgabe (id) MATCH SIMPLE
ON UPDATE CASCADE ON DELETE RESTRICT,
CONSTRAINT backlogaufgabe_id_backlog_fkey FOREIGN KEY (id_backlog)
REFERENCES backlog (id) MATCH SIMPLE
ON UPDATE CASCADE ON DELETE RESTRICT
)
WITH (
OIDS=FALSE
);
I would be gratefull for informations about how to map this, thx.