Note that there are some explanatory texts on larger screens.

plurals
  1. POEmbeddable with custom UserType used twice in entity
    primarykey
    data
    text
    <p>I'm using <code>@Embeddable</code> <code>REmbeddedReference</code> twice in my entity <code>RTask</code>. This embeddable contains QName property which type is defined as <code>org.hibernate.usertype.UserType</code>. </p> <pre><code>@Embeddable public class REmbeddedReference implements Serializable { private String targetOid; private String description; private String filter; private RContainerType type; private QName relation; @Columns(columns = { @Column(name = "relation_namespace"), @Column(name = "relation_localPart") }) public QName getRelation() { return relation; } @Column(length = 36, insertable = true, updatable = true, nullable = true) public String getTargetOid() { return targetOid; } @Type(type = "org.hibernate.type.TextType") public String getDescription() { return description; } @Enumerated(EnumType.ORDINAL) public RContainerType getType() { return type; } @Type(type = "org.hibernate.type.TextType") public String getFilter() { return filter; } ...setters... } </code></pre> <p><code>RTask</code> looks like this:</p> <pre><code>@Entity @ForeignKey(name = "fk_task") public class RTask extends RObject { private REmbeddedReference objectRef; private REmbeddedReference ownerRef; ...other fields... @Embedded public REmbeddedReference getObjectRef() { return objectRef; } @Embedded public REmbeddedReference getOwnerRef() { return ownerRef; } ...other methods... } </code></pre> <p>During startup I get: <code>Caused by: org.hibernate.MappingException: Repeated column in mapping for entity: com.evolveum.midpoint.repo.sql.data.common.RTask column: relation_namespace (should be mapped with insert="false" update="false")</code></p> <p>I tried to update my NamingStrategy, method logicalColumnName which generated objectRef_relation_namespace and ownerRef_relation_namespace. But then I get: <code>Caused by: org.hibernate.DuplicateMappingException: Table [m_task] contains phyical column name [relation_namespace] represented by different logical column names: [objectRef_relation_namespace], [ownerRef_relation_namespace]</code></p> <p>Do you have any idea how to map property <code>relation</code> in <code>REmbeddedReference</code> properly?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload