Hi,
The relationships among IDT_TRANSACTION and IDT_ENC_BIOGRAPHIC to be as follows:
a) There is a 1:1 relations between IDT_ENC_BIOGRAPIC.ENC_BIOGRAPHIC_ID and IDT_TRANSACTION.ENC_BIOGRAPHIC_ID
b) There is 1:m relations between IDT_TRANSACTION.EID and IDT_ENC_BIOGRAPIC.EID
But these relations are not defined in the database. In other words, there are no foreign key relations among the tables.
The relationships are defined in EncBiographic.java and Transaction.java are as follows
in EncBiographic.java
...
@ManyToOne(fetch = FetchType.LAZY, optional=false)
@JoinColumn(name = "EID", updatable=false, insertable=false)
private Transaction txEid;
...
@OneToOne(fetch = FetchType.LAZY, cascade = CascadeType.PERSIST, mappedBy = "applicant")
private Transaction transaction;
...
in Transaction.java
...
@OneToOne(fetch = FetchType.LAZY, cascade = CascadeType.PERSIST)
@JoinColumn(name = "ENC_BIOGRAPHIC_ID")
private EncBiographic applicant;
...
Now when we insert a record, we are seeing the following stack trace. If you notice, it produces a INSERT statement that has several "_VH" column names. But obviously our table, IDT_ENC_BIOGRAPHIC, does contain those columns.
I know that given that there is a 1:m relation between IDT_TRANSACTION.EID and IDT_ENC_BIOGRAPIC.EID, there cannot be a 1:1 relation between IDT_ENC_BIOGRAPIC.ENC_BIOGRAPHIC_ID and IDT_TRANSACTION.ENC_BIOGRAPHIC_ID but there can be 1:m relation.
In what conditions does the following error occur? Can incorrectly defined relationship annotation cause this problem? Or is this a bug in TopLink Essentials - 2006.8 (Build 060829)?
Thanks,
Mustafa
> [TOPLINK-4002] (Oracle TopLink Essentials - 2006.8 (Build
> 060829)): oracle.toplink.essentials.exceptions.DatabaseException
> Internal Exception: java.sql.SQLException: Invalid column
> typeError Code: 17004
> Call:INSERT INTO IDT_ENC_BIOGRAPHIC (ENC_BIOGRAPHIC_ID,
> NATIONALITY_LEGACY_CD, RACE_CD, FIRST_NAME, SUFFIX, GENDER_CD,
> EID, RECEIPT_DATE, _TOPLINK_TRANSACTION_VH, HAIR_CD,
> _TOPLINK_DOCUMENT_VH, BIRTH_DATE, _TOPLINK_TXEID_VH,
> PLACE_OF_BIRTH_LEGACY_CD, WGT, LAST_NAME, EYES_CD, HEIGHT,
> PLACE_OF_BIRTH, MIDDLE_NAME, NATIONALITY_CD) VALUES (?, ?, ?,
> ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
> bind => [1279, null, null, Joe, null, F, 1100190370,
> 2007-08-16 11:43:24.828,
[Message sent by forum member 'mcayci' (mcayci)]
http://forums.java.net/jive/thread.jspa?messageID=231987