Hi all When I run my program so that insert a new record in table in database and occur error: java.sql.SQLException: ORA-00001 unique constraint. I using method registerObject of UnitOfWork class. After that I check database and constraint and insert data by sql is OK. What happen. Why I insert data by sql command is OK but when run program not OK. You can explain for me and can fix error. I using oracle 8.1.7 for windows and oracle toplink workbench 10.1.3 Thank for help me
I am not familiar with TopLink, but let me ask you this. For your Inserted record, are there relationships to other tables, like this is a Many side in a One-To-Many? Or is it a straight single table, no FK relationships insert?
So, if it is, then what this means is that it is trying to insert a record on the many side, where there is no record (Parent record) in the one side. So you can't have a child without a parent.
This simply could be that the primary key of the object that you are trying to persist matches the primary key of an existing row. I assume you are using native sequencing? Take a look at the SQL that is generated at insert time. That should give you an indication that the sequence from which you are obtaining new primary keys has an overlap of existing primary keys.
By the way, the TopLink discussion forum (http://forums.oracle.com/forums/forum.jspa?forumID=48) has lots of answers to these, and far more complex issues. I highly recommend you peruse postings there as this forum seems primarily visited by Hibernate users. Additionally, the TopLink discussion forum is regularly visited and contributed to by both members of the TopLink product management and TopLink development teams at Oracle, and is free to post and read.