on 11-18-2009 9:57 AM
Hi,
my domain snippet:
@Entity
@Table(name = "EIC_SHAREDS")
@Inheritance(strategy = InheritanceType.JOINED)
@DiscriminatorColumn(name = "DTYPE", discriminatorType = DiscriminatorType.STRING, length = 1)
public abstract class AbstractSharedDataset implements SharedDataset, Serializable {
@Id
@GeneratedValue
@Column(name = "SHARED_ID")
private long id;
@OneToOne(optional = false, cascade = CascadeType.ALL)
@PrimaryKeyJoinColumn(name = "SHARED_ID", referencedColumnName = "HOLDER_ID")
private DatasetImpl dataset;
translates correctly into a table with two columns ...
but persisting doesn't work due to this obvious error:
Caused by: com.sap.sql.log.OpenSQLException: The SQL statement "INSERT INTO "EIC_SHAREDS" ("SHARED_ID","SHARED_ID","DTYPE") VALUES (?,?,'A')" contains the semantics error[s]: - 1:40 - column ""SHARED_ID"" not unique
So I'm asking myself whether @PrimaryKeyJoinColumn is supported ...
I tried already to mark the id as not insertable, which translates in the following try:
Caused by: com.sap.sql.log.OpenSQLException: The SQL statement "INSERT INTO "EIC_SHAREDS" ("DTYPE") VALUES ( 'A') " contains the semantics error[s]: - the column "SHARED_ID" of the table "EIC_SHAREDS", which is not nullable and has no default, is missing in the insert column list
This might work, if I knew how to teach MaxDB to generate the id on its own ...
Thankyou for some information on that
Edited by: konrad.krentz on Nov 18, 2009 12:02 PM
Edited by: konrad.krentz on Nov 18, 2009 12:06 PM
i marked the referenced column as well as the original column with that:
Exception of type com.sap.sql.log.OpenSQLException caught: The SQL statement "INSERT INTO "EIC_SHAREDS" ("DTYPE") VALUES ( 'G') " contains the semantics error[s]: - the column "SHARED_ID" of the table "EIC_SHAREDS", which is not nullable and has no default, is missing in the insert column list
But these attributes are not available on @PrimaryKeyJoinColumn if you meant that
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Konrad,
please try marking the primary key join column as insertable=false, updatable=false.
-Adrian
Edited by: Adrian Goerler on Nov 18, 2009 1:07 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.