users@glassfish.java.net

toplink essentials, insertable=false issue - does not work

From: <glassfish_at_javadesktop.org>
Date: Thu, 10 May 2007 03:51:47 PDT

Hello,

I have got two classes. One is embedded:

public class AssetHistory implements Serializable {
    
    @Id
    @Column(name = "id_asset_history", nullable = false)
    @GeneratedValue(strategy=GenerationType.IDENTITY)
    private Integer idAssetHistory;
...
    @Embedded
    @AttributeOverrides({
        @AttributeOverride(name="tempSuccessiveNumber", column= @Column(name="temp_successive_number")),
        @AttributeOverride(name="tempFullNumber", column=_at_Column(name="temp_full_number", [b]insertable=false[/b], updatable=false))
    })
    private TemporaryNumber temporaryNumber;
... }



@Embeddable
public class TemporaryNumber implements Serializable {
    
    private String tempSuccessiveNumber;
    
    private String tempFullNumber;
...
}


Annotation @AttributeOverride(name="tempFullNumber", column=_at_Column(name="temp_full_number", insertable=false, updatable=false))

does not work properly because Toplink generates insert query with temp_full_number.

Exception is:

        Exception [TOPLINK-4002] (Oracle TopLink Essentials - 2.0 (Build b46-beta3 (05/09/2007))): oracle.toplink.essentials.exceptions.DatabaseException
Internal Exception: com.microsoft.sqlserver.jdbc.SQLServerException: Update or insert of view or function 'ASSETS_HISTORY' failed because it contains a derived or constant field.
Error Code: 4406
Call: INSERT INTO ASSETS_HISTORY (added_date, description, change_date, invoice_number, room, invoice_date, inventory_number, id_changed_by, id_stand, temp_type, temp_year, temp_successive_number, [b]temp_full_number[/b], id_asset, id_building, id_added_by, id_user, id_subcategory, id_responsible_user, id_category, status, id_location) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
        bind => [2007-05-09 15:42:00.0, , 2007-05-10 12:07:24.113, , , null, 111a, 782, null, M, 01, 1, 1/M/01, 31, null, 782, null, null, 838, 5, USED, 2]
Query: InsertObjectQuery(assets.entity.AssetHistory[idAssetHistory=null])


Am I doing something wrong or there is a bug in Toplink Essentials?
As you can see I use latest build Oracle TopLink Essentials - 2.0 (Build b46-beta3 (05/09/2007);
Tomcat 5.5.17; java 1.5_06

Any ideas?

Regards
A.
[Message sent by forum member 'sejmajnejm' (sejmajnejm)]

http://forums.java.net/jive/thread.jspa?messageID=216300