Hello,
I am using h3, with h3 tools. I have created a db schema, and run artifact generation successfully, however when I tried to run schema export I got the error:
org.hibernate.MappingException: Repeated column in mapping for entity: graph.base.Edgestore column: GID (should be mapped with insert="false" update="false")
the table in question has the following structure:
columns: GID,SID,SOURCE,TARGET
primary_key: GID,SID,SOURCE,TARGET
fk_1: GID,SID to graphstore table, columns GID,SID
fk_2: GID,SID,SOURCE to vertextore table, columns GID,SID,VID
fk_3: GID,SID.TARGET to vertextore table, columns GID,SID,VID
now the corresponding mapping file looks like:
<composite-id
name="id"
class="graph.base.EdgestoreId"
>
<key-many-to-one name="Graphstore" class="graph.base.Graphstore">
<column name="GID" length="22" not-null="false" />
<column name="SID" length="22" not-null="false" />
</key-many-to-one>
<key-many-to-one name="source" class="graph.base.Vertexstore">
<column name="GID" length="22" not-null="false" />
<column name="SID" length="22" not-null="false" />
<column name="SOURCE" length="22" not-null="false" />
</key-many-to-one>
<key-many-to-one name="target" class="graph.base.Vertexstore">
<column name="GID" length="22" not-null="false" />
<column name="SID" length="22" not-null="false" />
<column name="TARGET" length="22" not-null="false" />
</key-many-to-one>
</composite-id>
I understand (and it works, tested) a plain <many-to-one> with
insert="false" update="false" works. however, I get a mapping error
when I put insert="false" update="false" to a <key-many-to-one>
I get: Caused by: org.xml.sax.SAXParseException: Attribute "insert" is not declared for element "key-many-to-one".
I am trying to map a graph-theory object (vertices linked by edges) into hibernate, and I spend quite sometime doing this project. The reason I used the artifact generator was to see how close it would generate code (that I had previously written) it came quite close actually, except the update,insert error, which was a problem that I could not overcome with my handwritten code.
the underlying schema is one I can not really change, because it is accessed by another c++ program. this schema and mapping came very, very close to working, with exception of this error.
please help,
best regards,
-O.B.
|