Updation of table records having 5-6 primary key columns.
I have a table structure having 12 primary composite keys.I have created report + form on this table.My requirement is to update the table by using form items fields.I am taking help of url option on report attribute page of application to fetch data on form page when we click on edit link of report page.Now i am having two problems which are as follows:-
(i)I am unable to update data as requirement is to update 5 to 6 primary fields along with other non primary keys.I tried to create Pl/SQL process which will run update query but this process is not updating values.Is there any way that i could fetch data direct from database table in query rather then taking item values.Is there any other workaround?
(ii)One of the primary key column contains records which have ' , ' in them .For ex:- cluth,bearing.So when i get navigated to edit page i am only getting text displayed as clutch i.e. text before ',' is getting displayed in text field while comma and the text after this is not getting displayed in text field of form page.
Any solutions will be very helpful.
Thanks
Abhi
Hello Abhi,
>> I am unable to update data as requirement is to update 5 to 6 primary fields along with other non primary keys
APEX wizards support a composite PK with up to 2 segments only. For every other scenario, you’ll have to manually create your DML code.
If you have control over your data model, I would listen very carefully to Andre advices. Using a single segment PK is the best practice way. If you can’t add PK to your table, it seems that you’ll have to write your own DML code. The Object Browser option of creating a Package with methods on database table(s) can be a great help.
>> … I am taking help of url option … One of the primary key column contains records which have ' , ' in them …
Using the f?p notation, to pass a comma in an item value, you should enclose the characters with backslashes. For example,
\cluth,bearing\In your case, it should be the item/column notation.
http://download.oracle.com/docs/cd/E17556_01/doc/user.40/e15517/concept.htm#BCEDJBEH
Regards,
Arie.
♦ Please remember to mark appropriate posts as correct/helpful. For the long run, it will benefit us all.
♦ Author of Oracle Application Express 3.2 – The Essentials and More
Similar Messages
-
Update enrolled table which has 6 composite primary key
Hi Everyone,
I am trying to update a grade column in table called enrolled which has 6 composite primary key column including SID, TERMYEAR, FACCODE, DEPCODE, COURSENO, SECNO and 2 extra column including GRADE, IDD all of them are of type VARCHAR2 as describe below:
To update this table I used the command below:
UPDATE enrolled
SET grade = :COURSE_BLOCK.GRADE_TEXT
WHERE IID = :GLOBAL.logUserid
AND SID = :COURSE_BLOCK.SID_TEXT
AND FACCODE = :COURSE_BLOCK.FACULTY_TEXT
AND DEPCODE = :COURSE_BLOCK.DEPARTMENT_TEXT
AND COURSENO = :COURSE_BLOCK.COURSE_TEXT
AND SECNO = :COURSE_BLOCK.SECTION_TEXT;
Note: the :GLOBAL.logUserid is a global variable that I assigned the user id when the user log on to the application.
When I run the application and fill out the form in order to update the table this doesn't update the table and if I use SQL*PLUS as well with the values that I use for the form to update the table I get message: o rows updated
Can Someone help please?Here is the solution.
The problem:
The problem was that the enrolled table was designed in a way that a student can enrolled in the lecture(LEC type column) and Laboratory(LAB type column). When a student is given a grade, it is given a grade for the course 100 (eg: 03-60-100) this course has a lecture and lab. this course belong to the faculty code 03(science) department 60 (computer Science) so when a student register to a course, will register to a lecture and a lab but he will receive a grade for the course 100 lec in this case Oracle couldn't update the table because there was two column with course 100 for that particular student Id
The solution:
There are many solution I believe but my quickest solution is when a student register to the course by default is given a grade 'I' means Incomplete then when the instructor add the grade, he can just update a grade from incomplete to the final grade (eg A) now the code will be to get only the course 100 that has grade and discard that doesn't have grade this means that I need only to make sure that the WHERE Clause grade is not null shown below.
UPDATE enrolled
SET grade = BLOCK_NAME.FIELD_NAME
WHERE grade IS NOY NULL
AND IID = BLOCK_NAME.FIELD
AND faccode = BLOCK_NAME.FIELD
AND depcode = BLOCK_NAME.FIELD
AND courseno= BLOCK_NAME.FIELD_NAME
NAD secno = BLOCK_NAME.FIELD_NAME
AND SID = BLOCK_NAME.FIELD_NAME -
For some strange reason when I modified a form, (commented out some code in a when-window-activated trigger) I now get the following error.
CDG-01141 ERROR: Module Component Table Usage GR1130A.CUSTOMER.GR_CUSTOMER.GC: Table usage GR_CUSTOMER requires primary key column for referential integrity
I am sure this is not related to my change, but do not know what may have caused this or how to fix it.
Anyone seen this error before? been able to fix it?
Thanks!
Windows 7
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0
Designer Version 6.5.95.4.8You know that Developer/Designer 6i is not certified for Windows 7, right? Also, your version is not the latest one, so you can try to install the latest patch set first.
>Table usage GR_CUSTOMER requires primary key column for referential integrity
Check if there is a PK in the table definition (not in the database, but in Designer). -
Testing for unique records in a compound Primary Key table
I have a table with 2 fields being primary keys. I want to write a sql script to check if there are duplicates.
Here is what I have but not sure if this is working right. I have table with millions of records.
SELECT COUNT(CASE WHEN A.AUNQ >1 THEN 1 ELSE NULL END)
FROM
SELECT (List_Cd + Account_Key) PK_ListAcc, COUNT(List_Cd) AUNQ
FROM RAW_AML_LISTEDACCNTS_JUN GROUP BY List_Cd, Account_Key HAVING (COUNT(List_Cd) >1))
A;
Can someone help?
thanksYes, I agree. I am doing data profiling and testing all these tables. I am expecting that the results show me zero, however, if there were any problems with the settings, then I should get something. I think that the subquery is needed because if I used
what you suggested above I will get the following:
List_CD Account_Key
1 a
2 b
3 c
3 C
1 a
1 a
the results will be:
List_CD Account_Key CountOFAccount_Key
1 a
3
3 C
2
I now need to count that query results to get the total which should be 2
do you agree? I am just trying to confirm that the sql script I listed will give me this result correctly. -
How to update primary key column
Hi,
Can you suggest me best workaround/algorithm for below task:
(Oracle 10g, Solaris OS.)
Situation:
Table P has primary key column "Code", child tables F1, F2, ..., F15 reference with foreign key column "P_Code" column "P.Code", and we don't know which of the child tables has data for particular "P.Code" value.
Task:
Change "P.Code" value from 100 to 200. So that result would be that record P[Code = 100] should be updated as:
update P set
Code = 200
where Code = 100;And child tables column "P_Code" should be updated as:
update F1, F2, .., F15 set
P_code = 200
where P_code = 100;The best solution would be that one very easily can repeat that task.
Edited by: CharlesRoos on 28.12.2010 12:10If you are looking for reusable and repetitive solution, then may be...
SQL> CREATE TABLE p (p_code NUMBER PRIMARY KEY);
Table created.
SQL> INSERT INTO p VALUES(100);
1 row created.
SQL> INSERT INTO p VALUES(300);
1 row created.
SQL> INSERT INTO p VALUES(500);
1 row created.
SQL> commit;
Commit complete.
SQL> CREATE TABLE F1 (p_code NUMBER REFERENCES p(p_code));
Table created.
SQL> CREATE TABLE F2 (p_code NUMBER REFERENCES p(p_code));
Table created.
SQL> CREATE TABLE F3 (p_code NUMBER REFERENCES p(p_code));
Table created.
SQL> INSERT INTO F1 VALUES(100);
1 row created.
SQL> INSERT INTO F3 VALUES(100);
1 row created.
SQL> INSERT INTO F2 VALUES(500);
1 row created.
SQL> commit;
Commit complete.
SQL> CREATE OR REPLACE PROCEDURE update_child_parent(pi_p_code_old NUMBER,
2 pi_p_code_new NUMBER) IS
3 CURSOR table_to_update IS
4 SELECT table_name,
5 to_number(extractvalue(xmltype(DBMS_XMLGEN.getxml('SELECT count(*) c FROM ' ||
6 table_name ||
7 ' WHERE p_code=' ||
8 pi_p_code_old)),
9 '/ROWSET/ROW/C')) cnt
10 FROM user_tables
11 WHERE table_name IN ('F1', 'F2', 'F3');
12
13 BEGIN
14 EXECUTE IMMEDIATE 'ALTER TABLE p DISABLE PRIMARY KEY CASCADE';
15 UPDATE p SET p_code = pi_p_code_new WHERE p_code = pi_p_code_old;
16 FOR i IN table_to_update LOOP
17 IF i.cnt > 0 THEN
18 EXECUTE IMMEDIATE 'UPDATE ' || i.table_name || ' SET p_code=' ||
19 pi_p_code_new || ' WHERE p_code=' || pi_p_code_old;
20 END IF;
21 END LOOP;
22 EXECUTE IMMEDIATE 'ALTER TABLE p ENABLE VALIDATE PRIMARY KEY';
23 END update_child_parent;
24 /
Procedure created.
SQL> EXECUTE update_child_parent(100,200);
PL/SQL procedure successfully completed.
SQL> SELECT * FROM p;
P_CODE
200
300
500
SQL> SELECT * FROM F1;
P_CODE
200
SQL> SELECT * FROM F2;
P_CODE
500
SQL> SELECT * FROM F3;
P_CODE
200
SQL> INSERT INTO p VALUES(300);
INSERT INTO p VALUES(300)
ERROR at line 1:
ORA-00001: unique constraint (HR.SYS_C005931) violated
SQL> EXECUTE update_child_parent(500,900);
PL/SQL procedure successfully completed.
SQL> SELECT * FROM p;
P_CODE
200
300
900
SQL> SELECT * FROM F2;
P_CODE
900
SQL> -
Adding primary key column in populated table
Hi all,
I am trying to add a column into a table which is already populated. The column which needs to be added has to be Primary Key.
As expected, oracle popped up the error (ORA-01758) that, a NOT NULL column cannot be added unless the table is empty.
One possibe way is to create a new temp table and then transfer all the current data...renaming the temp table later.
Is there any other way to accomplish this task?
ThanksHello,
As error suggested you cannot add a not null constraint on new column to table which is already populated. What else you can do beside you got fairly simple and quick idea of creating a temp table and moving data?
You can add new column but null, update the column with the values and alter the table marking column as not null. But your idea of empty temp table is simple and quick one.
CREATE TABLE my_objects
AS
SELECT 'my_new_column' my_new, owner
FROM all_objects
WHERE ROWNUM < 1;
_Not Null_
ALTER TABLE MY_OBJECTS
MODIFY(MY_NEW NOT NULL);
_Primary key_
ALTER TABLE MY_OBJECTS
ADD CONSTRAINT MY_OBJECTS_PK
PRIMARY KEY
(MY_NEW);Regards -
How to do hibernate mapping for table or view without a primary key
Hi,
Anyone knows how to do hibernate mapping for table or view without a primary key?
thanks.
ccor you can make all column primary key .Anybody seriously considering that as a good idea should understand the implications:
1. this requires that each row be unique - that's a minor issue normally, but can be a significant problem in some cases
2. in practically all databases, a primary key constraint creates a unique index - this has many implications:
a) in most databases, the index stores a copy of the column data that is indexed - this suggestion therefore more than doubles the data storage required for the data
b) whenever an indexed column is changed, the index has to be maintained - this suggestion then more than doubles the work that each UPDATE statement has to do, since both the table and the index have to be maintained for any UPDATE at all
This might work OK for toy projects, but it doesn't scale well at all... -
Error remote table does not contain a primary key
I make replication between oracle and Microsoft sql using getway for sql but when I insert to table in oracle I get this error in apply process
information :
ASD.SUBHI.COM is database link from oracle to microsoft sql
"DBO"."REGIONS" name of the table
CREATE TABLE regions (a INTEGER primary key) command to create table
error
ORA-26711: remote table does not contain a primary key constraint ORA-26712: remote object is "DBO"."REGIONS"@"ASD.SUBHI.COM"
Note: I go to sql server and verify that primary key is creates
is this the best place to like this question ?
if you need more details please tell me I need the answerI make replication between oracle and Microsoft sql using getway for sql but when I insert to table in oracle I get this error in apply process
information :
ASD.SUBHI.COM is database link from oracle to microsoft sql
"DBO"."REGIONS" name of the table
CREATE TABLE regions (a INTEGER primary key) command to create table
error
ORA-26711: remote table does not contain a primary key constraint ORA-26712: remote object is "DBO"."REGIONS"@"ASD.SUBHI.COM"
Note: I go to sql server and verify that primary key is creates
is this the best place to like this question ?
if you need more details please tell me I need the answer -
How to know primary key column name form a table name in sql query
Suppose I only know the table name. How to get its primary key column name from the table name?
ThanksViews don't have primary keys though their underlying tables might. You'd need to pick apart the view to determine where it's columns are coming from.
You can select the text of the view in question from user_views. -
Let me just say that I posted a bug report for this here:
https://glassfish.dev.java.net/issues/show_bug.cgi?id=3937
But I'm also posting the info here, so that people who search on this forum may get some help:
TopLink (both Essentials and 11g) has a problem with flushing entities
containing a self-reference relationship. When flushing, the following exception
occurs:
Exception [TOPLINK-7251] (Oracle TopLink Essentials - 2.1 (Build b14-fcs
(12/17/2007))): oracle.toplink.essentials.exceptions.ValidationException
Exception Description: The attribute [id] of class [test.jpa.entities.Person] is
mapped to a primary key column in the database. Updates are not allowed.
No manual updates have been made to ANY primary key.
What I'm doing is:
1. I instantiate a new entity.
2. I start a transaction
3. I persist the new entity.
4. I read an existing entity from the DB.
5. I let the existing entity point to the new entity via the self-reference
relationship.
6. I flush the persistence context.
7. I issue commit(), and the exception occurs. (I have provided the stack traces for various versions of TopLink below.)
This is a clear bug.
Here are some additional observations:
1. Reproduced on the following versions of TopLink:
1.1. Oracle TopLink Essentials - 2.0 (Build b58g-fcs (09/07/2007))
1.2. Oracle TopLink Essentials - 2.1 (Build b14-fcs (12/17/2007))
1.3. Oracle TopLink - 11g Technology Preview 3 (11.1.1.0.0) (Build 071214)
2. Reproducible both on Java SE and Java EE. (I tested on Oracle Application Server)
3. Reproducible with and without class weaving
4. Reproducible regardless of whether the JPA annotations are on fields or on
methods
5. Reproducible regardless of whether "cascade={CascadeType.PERSIST}" is used or
not.
6. Reproducible regardless of the fetch type of the self-reference relationship
(EAGER or LAZY).
Also:
1. Without flushing, the bug doesn't occur. That is, if I commit without
flushing, it works.
2. Without setting the self-reference relationship, the bug doesn't occur.
This is an issue that appears when using BOTH self-reference relationship AND
flushing.
Best regards,
Bisser
The message was edited by bisser:
Added info that the exception occurs "when I issue commit()" on step 7.I'm extremely surprised that you couldn't reproduce the error. It's reproduced each time when I run the Test Scenario that I described above.
You could download a sample Eclipse project that reproduces the error from here: https://glassfish.dev.java.net/issues/show_bug.cgi?id=3937
For the log below I used TopLink, version: Oracle TopLink Essentials - 2.0 (Build b58g-fcs (09/07/2007)).
Could you, please, tell me what version you use and I will try the Test Case on it.
Here's the FINEST log:
[TopLink Finest]: 2008.01.09 07:35:58.094--ServerSession(1968077)--Thread(Thread[Main Thread,5,main])--property=toplink.weaving; value=false
[TopLink Finest]: 2008.01.09 07:35:59.312--ServerSession(1968077)--Thread(Thread[Main Thread,5,main])--property=toplink.orm.throw.exceptions; default value=true
[TopLink Finer]: 2008.01.09 07:35:59.312--ServerSession(1968077)--Thread(Thread[Main Thread,5,main])--Searching for default mapping file in file:/D:/dev/bull/jpa_pk_bug/bin/
[TopLink Config]: 2008.01.09 07:35:59.547--ServerSession(1968077)--Thread(Thread[Main Thread,5,main])--The alias name for the entity class [class test.jpa.entities.Person] is being defaulted to: Person.
[TopLink Config]: 2008.01.09 07:35:59.594--ServerSession(1968077)--Thread(Thread[Main Thread,5,main])--The column name for element [private java.lang.Long test.jpa.entities.Person.id] is being defaulted to: ID.
[TopLink Config]: 2008.01.09 07:35:59.609--ServerSession(1968077)--Thread(Thread[Main Thread,5,main])--The column name for element [private java.lang.String test.jpa.entities.Person.name] is being defaulted to: NAME.
[TopLink Config]: 2008.01.09 07:35:59.641--ServerSession(1968077)--Thread(Thread[Main Thread,5,main])--The target entity (reference) class for the many to one mapping element [test.jpa.entities.Person test.jpa.entities.Person.mgr] is being defaulted to: class test.jpa.entities.Person.
[TopLink Config]: 2008.01.09 07:35:59.703--ServerSession(1968077)--Thread(Thread[Main Thread,5,main])--The primary key column name for the mapping element [test.jpa.entities.Person test.jpa.entities.Person.mgr] is being defaulted to: ID.
[TopLink Finest]: 2008.01.09 07:35:59.703--ServerSession(1968077)--Thread(Thread[Main Thread,5,main])--end predeploying Persistence Unit Test; state Predeployed; factoryCount 0
[TopLink Finer]: 2008.01.09 07:35:59.703--Thread(Thread[Main Thread,5,main])--cmp_init_transformer_is_null
[TopLink Finest]: 2008.01.09 07:35:59.703--ServerSession(1968077)--Thread(Thread[Main Thread,5,main])--begin predeploying Persistence Unit Test; state Predeployed; factoryCount 0
[TopLink Finest]: 2008.01.09 07:35:59.703--ServerSession(1968077)--Thread(Thread[Main Thread,5,main])--end predeploying Persistence Unit Test; state Predeployed; factoryCount 1
[TopLink Finest]: 2008.01.09 07:35:59.719--ServerSession(1968077)--Thread(Thread[Main Thread,5,main])--begin deploying Persistence Unit Test; state Predeployed; factoryCount 1
[TopLink Finest]: 2008.01.09 07:35:59.734--ServerSession(1968077)--Thread(Thread[Main Thread,5,main])--property=toplink.logging.level; value=FINEST; translated value=FINEST
[TopLink Finest]: 2008.01.09 07:35:59.734--ServerSession(1968077)--Thread(Thread[Main Thread,5,main])--property=toplink.logging.level; value=FINEST; translated value=FINEST
[TopLink Finest]: 2008.01.09 07:35:59.750--ServerSession(1968077)--Thread(Thread[Main Thread,5,main])--property=toplink.jdbc.user; value=rms
[TopLink Finest]: 2008.01.09 07:35:59.750--ServerSession(1968077)--Thread(Thread[Main Thread,5,main])--property=toplink.jdbc.password; value=xxxxxx
[TopLink Finest]: 2008.01.09 07:36:00.766--ServerSession(1968077)--Thread(Thread[Main Thread,5,main])--property=toplink.target-database; value=Oracle; translated value=oracle.toplink.essentials.platform.database.oracle.OraclePlatform
[TopLink Finest]: 2008.01.09 07:36:00.781--ServerSession(1968077)--Thread(Thread[Main Thread,5,main])--property=toplink.jdbc.driver; value=oracle.jdbc.OracleDriver
[TopLink Finest]: 2008.01.09 07:36:00.781--ServerSession(1968077)--Thread(Thread[Main Thread,5,main])--property=toplink.jdbc.url; value=jdbc:oracle:thin:@//10.20.6.126:1521/region2
[TopLink Info]: 2008.01.09 07:36:00.797--ServerSession(1968077)--Thread(Thread[Main Thread,5,main])--TopLink, version: Oracle TopLink Essentials - 2.0 (Build b58g-fcs (09/07/2007))
[TopLink Config]: 2008.01.09 07:36:00.812--ServerSession(1968077)--Connection(5182312)--Thread(Thread[Main Thread,5,main])--connecting(DatabaseLogin(
platform=>OraclePlatform
user name=> "rms"
datasource URL=> "jdbc:oracle:thin:@//10.20.6.126:1521/region2"
[TopLink Config]: 2008.01.09 07:36:01.797--ServerSession(1968077)--Connection(4252099)--Thread(Thread[Main Thread,5,main])--Connected: jdbc:oracle:thin:@//10.20.6.126:1521/region2
User: RMS
Database: Oracle Version: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options
Driver: Oracle JDBC driver Version: 10.2.0.1.0
[TopLink Config]: 2008.01.09 07:36:01.797--ServerSession(1968077)--Connection(5744890)--Thread(Thread[Main Thread,5,main])--connecting(DatabaseLogin(
platform=>OraclePlatform
user name=> "rms"
datasource URL=> "jdbc:oracle:thin:@//10.20.6.126:1521/region2"
[TopLink Config]: 2008.01.09 07:36:01.875--ServerSession(1968077)--Connection(5747801)--Thread(Thread[Main Thread,5,main])--Connected: jdbc:oracle:thin:@//10.20.6.126:1521/region2
User: RMS
Database: Oracle Version: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options
Driver: Oracle JDBC driver Version: 10.2.0.1.0
[TopLink Config]: 2008.01.09 07:36:01.891--ServerSession(1968077)--Connection(5760373)--Thread(Thread[Main Thread,5,main])--connecting(DatabaseLogin(
platform=>OraclePlatform
user name=> "rms"
datasource URL=> "jdbc:oracle:thin:@//10.20.6.126:1521/region2"
[TopLink Config]: 2008.01.09 07:36:01.969--ServerSession(1968077)--Connection(5763284)--Thread(Thread[Main Thread,5,main])--Connected: jdbc:oracle:thin:@//10.20.6.126:1521/region2
User: RMS
Database: Oracle Version: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options
Driver: Oracle JDBC driver Version: 10.2.0.1.0
[TopLink Config]: 2008.01.09 07:36:01.969--ServerSession(1968077)--Connection(5497095)--Thread(Thread[Main Thread,5,main])--connecting(DatabaseLogin(
platform=>OraclePlatform
user name=> "rms"
datasource URL=> "jdbc:oracle:thin:@//10.20.6.126:1521/region2"
[TopLink Config]: 2008.01.09 07:36:02.047--ServerSession(1968077)--Connection(5500006)--Thread(Thread[Main Thread,5,main])--Connected: jdbc:oracle:thin:@//10.20.6.126:1521/region2
User: RMS
Database: Oracle Version: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options
Driver: Oracle JDBC driver Version: 10.2.0.1.0
[TopLink Config]: 2008.01.09 07:36:02.047--ServerSession(1968077)--Connection(5512041)--Thread(Thread[Main Thread,5,main])--connecting(DatabaseLogin(
platform=>OraclePlatform
user name=> "rms"
datasource URL=> "jdbc:oracle:thin:@//10.20.6.126:1521/region2"
[TopLink Config]: 2008.01.09 07:36:02.125--ServerSession(1968077)--Connection(5514977)--Thread(Thread[Main Thread,5,main])--Connected: jdbc:oracle:thin:@//10.20.6.126:1521/region2
User: RMS
Database: Oracle Version: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options
Driver: Oracle JDBC driver Version: 10.2.0.1.0
[TopLink Config]: 2008.01.09 07:36:02.125--ServerSession(1968077)--Connection(5527528)--Thread(Thread[Main Thread,5,main])--connecting(DatabaseLogin(
platform=>OraclePlatform
user name=> "rms"
datasource URL=> "jdbc:oracle:thin:@//10.20.6.126:1521/region2"
[TopLink Config]: 2008.01.09 07:36:02.203--ServerSession(1968077)--Connection(5530440)--Thread(Thread[Main Thread,5,main])--Connected: jdbc:oracle:thin:@//10.20.6.126:1521/region2
User: RMS
Database: Oracle Version: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options
Driver: Oracle JDBC driver Version: 10.2.0.1.0
[TopLink Config]: 2008.01.09 07:36:02.203--ServerSession(1968077)--Connection(5542993)--Thread(Thread[Main Thread,5,main])--connecting(DatabaseLogin(
platform=>OraclePlatform
user name=> "rms"
datasource URL=> "jdbc:oracle:thin:@//10.20.6.126:1521/region2"
[TopLink Config]: 2008.01.09 07:36:02.281--ServerSession(1968077)--Connection(5545904)--Thread(Thread[Main Thread,5,main])--Connected: jdbc:oracle:thin:@//10.20.6.126:1521/region2
User: RMS
Database: Oracle Version: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options
Driver: Oracle JDBC driver Version: 10.2.0.1.0
[TopLink Finest]: 2008.01.09 07:36:02.312--ServerSession(1968077)--Thread(Thread[Main Thread,5,main])--sequencing connected, state is Preallocation_NoTransaction_State
[TopLink Info]: 2008.01.09 07:36:02.484--ServerSession(1968077)--Thread(Thread[Main Thread,5,main])--file:/D:/dev/bull/jpa_pk_bug/bin/-Test login successful
[TopLink Finest]: 2008.01.09 07:36:02.484--ServerSession(1968077)--Thread(Thread[Main Thread,5,main])--end deploying Persistence Unit Test; state Deployed; factoryCount 1
[TopLink Finer]: 2008.01.09 07:36:02.516--ServerSession(1968077)--Thread(Thread[Main Thread,5,main])--client acquired
[TopLink Finest]: 2008.01.09 07:36:02.531--UnitOfWork(5663897)--Thread(Thread[Main Thread,5,main])--Execute query DoesExistQuery()
[TopLink Finest]: 2008.01.09 07:36:02.547--UnitOfWork(5663897)--Thread(Thread[Main Thread,5,main])--PERSIST operation called on: test.jpa.entities.Person@563c8c.
[TopLink Finest]: 2008.01.09 07:36:02.562--ClientSession(5666151)--Thread(Thread[Main Thread,5,main])--Execute query ValueReadQuery()
[TopLink Fine]: 2008.01.09 07:36:02.594--ServerSession(1968077)--Connection(5747801)--Thread(Thread[Main Thread,5,main])--SELECT PERSONS_ID_SEQ.NEXTVAL FROM DUAL
[TopLink Finest]: 2008.01.09 07:36:03.297--ServerSession(1968077)--Thread(Thread[Main Thread,5,main])--sequencing preallocation for PERSONS_ID_SEQ: objects: 1 , first: 5, last: 5
[TopLink Finest]: 2008.01.09 07:36:03.312--UnitOfWork(5663897)--Thread(Thread[Main Thread,5,main])--assign sequence to the object (5 -> test.jpa.entities.Person@563c8c)
[TopLink Finest]: 2008.01.09 07:36:03.328--UnitOfWork(5663897)--Thread(Thread[Main Thread,5,main])--Execute query ReadObjectQuery(test.jpa.entities.Person)
[TopLink Fine]: 2008.01.09 07:36:03.438--ServerSession(1968077)--Connection(4252099)--Thread(Thread[Main Thread,5,main])--SELECT ID, NAME, MGR_ID FROM Persons WHERE (ID = ?)
bind => [1]
[TopLink Finest]: 2008.01.09 07:36:03.531--UnitOfWork(5663897)--Thread(Thread[Main Thread,5,main])--Register the existing object test.jpa.entities.Person@3a4484
[TopLink Finer]: 2008.01.09 07:36:03.625--ClientSession(5666151)--Connection(5763284)--Thread(Thread[Main Thread,5,main])--begin transaction
[TopLink Finest]: 2008.01.09 07:36:03.625--UnitOfWork(5663897)--Thread(Thread[Main Thread,5,main])--Execute query UpdateObjectQuery(test.jpa.entities.Person@3a57fa)
[TopLink Finest]: 2008.01.09 07:36:03.641--UnitOfWork(5663897)--Thread(Thread[Main Thread,5,main])--Execute query WriteObjectQuery(test.jpa.entities.Person@563c8c)
[TopLink Fine]: 2008.01.09 07:36:03.656--ClientSession(5666151)--Connection(5763284)--Thread(Thread[Main Thread,5,main])--INSERT INTO Persons (ID, NAME, MGR_ID) VALUES (?, ?, ?)
bind => [5, Boss, null]
[TopLink Fine]: 2008.01.09 07:36:03.688--ClientSession(5666151)--Connection(5763284)--Thread(Thread[Main Thread,5,main])--UPDATE Persons SET MGR_ID = ? WHERE (ID = ?)
bind => [5, 1]
[TopLink Finer]: 2008.01.09 07:36:03.703--UnitOfWork(5663897)--Thread(Thread[Main Thread,5,main])--begin unit of work commit
[TopLink Finest]: 2008.01.09 07:36:03.703--UnitOfWork(5663897)--Thread(Thread[Main Thread,5,main])--Execute query UpdateObjectQuery(test.jpa.entities.Person@563c8c)
[TopLink Warning]: 2008.01.09 07:36:03.812--UnitOfWork(5663897)--Thread(Thread[Main Thread,5,main])--Local Exception Stack:
Exception [TOPLINK-7251] (Oracle TopLink Essentials - 2.0 (Build b58g-fcs (09/07/2007))): oracle.toplink.essentials.exceptions.ValidationException
Exception Description: The attribute [id] of class [test.jpa.entities.Person] is mapped to a primary key column in the database. Updates are not allowed.
at oracle.toplink.essentials.exceptions.ValidationException.primaryKeyUpdateDisallowed(ValidationException.java:2222)
at oracle.toplink.essentials.mappings.foundation.AbstractDirectMapping.writeFromObjectIntoRowWithChangeRecord(AbstractDirectMapping.java:750)
at oracle.toplink.essentials.internal.descriptors.ObjectBuilder.buildRowForUpdateWithChangeSet(ObjectBuilder.java:948)
at oracle.toplink.essentials.internal.queryframework.DatabaseQueryMechanism.updateObjectForWriteWithChangeSet(DatabaseQueryMechanism.java:1263)
at oracle.toplink.essentials.queryframework.UpdateObjectQuery.executeCommitWithChangeSet(UpdateObjectQuery.java:91)
at oracle.toplink.essentials.internal.queryframework.DatabaseQueryMechanism.executeWriteWithChangeSet(DatabaseQueryMechanism.java:390)
at oracle.toplink.essentials.queryframework.WriteObjectQuery.executeDatabaseQuery(WriteObjectQuery.java:109)
at oracle.toplink.essentials.queryframework.DatabaseQuery.execute(DatabaseQuery.java:628)
at oracle.toplink.essentials.queryframework.DatabaseQuery.executeInUnitOfWork(DatabaseQuery.java:555)
at oracle.toplink.essentials.queryframework.ObjectLevelModifyQuery.executeInUnitOfWorkObjectLevelModifyQuery(ObjectLevelModifyQuery.java:138)
at oracle.toplink.essentials.queryframework.ObjectLevelModifyQuery.executeInUnitOfWork(ObjectLevelModifyQuery.java:110)
at oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl.internalExecuteQuery(UnitOfWorkImpl.java:2233)
at oracle.toplink.essentials.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:952)
at oracle.toplink.essentials.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:909)
at oracle.toplink.essentials.internal.sessions.CommitManager.commitChangedObjectsForClassWithChangeSet(CommitManager.java:309)
at oracle.toplink.essentials.internal.sessions.CommitManager.commitAllObjectsWithChangeSet(CommitManager.java:195)
at oracle.toplink.essentials.internal.sessions.AbstractSession.writeAllObjectsWithChangeSet(AbstractSession.java:2657)
at oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl.commitToDatabase(UnitOfWorkImpl.java:1044)
at oracle.toplink.essentials.internal.ejb.cmp3.base.RepeatableWriteUnitOfWork.commitToDatabase(RepeatableWriteUnitOfWork.java:403)
at oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl.commitToDatabaseWithChangeSet(UnitOfWorkImpl.java:1126)
at oracle.toplink.essentials.internal.ejb.cmp3.base.RepeatableWriteUnitOfWork.commitRootUnitOfWork(RepeatableWriteUnitOfWork.java:107)
at oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl.commitAndResume(UnitOfWorkImpl.java:856)
at oracle.toplink.essentials.internal.ejb.cmp3.transaction.base.EntityTransactionImpl.commit(EntityTransactionImpl.java:102)
at oracle.toplink.essentials.internal.ejb.cmp3.transaction.EntityTransactionImpl.commit(EntityTransactionImpl.java:60)
at test.jpa.TestPkBug.runTest(TestPkBug.java:53)
at test.jpa.TestPkBug.main(TestPkBug.java:95)
[TopLink Finer]: 2008.01.09 07:36:03.828--ClientSession(5666151)--Connection(5763284)--Thread(Thread[Main Thread,5,main])--rollback transaction
[TopLink Finer]: 2008.01.09 07:36:03.844--UnitOfWork(5663897)--Thread(Thread[Main Thread,5,main])--release unit of work
[TopLink Finer]: 2008.01.09 07:36:03.844--UnitOfWork(5663897)--Thread(Thread[Main Thread,5,main])--initialize identitymaps
[TopLink Finer]: 2008.01.09 07:36:03.844--ClientSession(5666151)--Thread(Thread[Main Thread,5,main])--client released
[TopLink Finest]: 2008.01.09 07:36:03.844--ServerSession(1968077)--Thread(Thread[Main Thread,5,main])--begin undeploying Persistence Unit Test; state Deployed; factoryCount 1
[TopLink Finest]: 2008.01.09 07:36:03.844--ServerSession(1968077)--Thread(Thread[Main Thread,5,main])--sequencing disconnected
[TopLink Config]: 2008.01.09 07:36:03.844--ServerSession(1968077)--Connection(4252099)--Thread(Thread[Main Thread,5,main])--disconnect
[TopLink Finer]: 2008.01.09 07:36:03.859--ServerSession(1968077)--Thread(Thread[Main Thread,5,main])--initialize identitymaps
[TopLink Info]: 2008.01.09 07:36:03.859--ServerSession(1968077)--Thread(Thread[Main Thread,5,main])--file:/D:/dev/bull/jpa_pk_bug/bin/-Test logout successful
[TopLink Config]: 2008.01.09 07:36:03.859--ServerSession(1968077)--Connection(5747801)--Thread(Thread[Main Thread,5,main])--disconnect
[TopLink Config]: 2008.01.09 07:36:03.859--ServerSession(1968077)--Connection(5182312)--Thread(Thread[Main Thread,5,main])--disconnect
[TopLink Config]: 2008.01.09 07:36:03.859--ServerSession(1968077)--Connection(5500006)--Thread(Thread[Main Thread,5,main])--disconnect
[TopLink Config]: 2008.01.09 07:36:03.875--ServerSession(1968077)--Connection(5514977)--Thread(Thread[Main Thread,5,main])--disconnect
[TopLink Config]: 2008.01.09 07:36:03.875--ServerSession(1968077)--Connection(5530440)--Thread(Thread[Main Thread,5,main])--disconnect
[TopLink Config]: 2008.01.09 07:36:03.875--ServerSession(1968077)--Connection(5545904)--Thread(Thread[Main Thread,5,main])--disconnect
[TopLink Config]: 2008.01.09 07:36:03.891--ServerSession(1968077)--Connection(5763284)--Thread(Thread[Main Thread,5,main])--disconnect
[TopLink Finest]: 2008.01.09 07:36:03.891--ServerSession(1968077)--Thread(Thread[Main Thread,5,main])--end undeploying Persistence Unit Test; state Undeployed; factoryCount 0
Exception in thread "Main Thread" javax.persistence.RollbackException: Exception [TOPLINK-7251] (Oracle TopLink Essentials - 2.0 (Build b58g-fcs (09/07/2007))): oracle.toplink.essentials.exceptions.ValidationException
Exception Description: The attribute [id] of class [test.jpa.entities.Person] is mapped to a primary key column in the database. Updates are not allowed.
at oracle.toplink.essentials.internal.ejb.cmp3.transaction.base.EntityTransactionImpl.commit(EntityTransactionImpl.java:120)
at oracle.toplink.essentials.internal.ejb.cmp3.transaction.EntityTransactionImpl.commit(EntityTransactionImpl.java:60)
at test.jpa.TestPkBug.runTest(TestPkBug.java:53)
at test.jpa.TestPkBug.main(TestPkBug.java:95)
Caused by: Exception [TOPLINK-7251] (Oracle TopLink Essentials - 2.0 (Build b58g-fcs (09/07/2007))): oracle.toplink.essentials.exceptions.ValidationException
Exception Description: The attribute [id] of class [test.jpa.entities.Person] is mapped to a primary key column in the database. Updates are not allowed.
at oracle.toplink.essentials.exceptions.ValidationException.primaryKeyUpdateDisallowed(ValidationException.java:2222)
at oracle.toplink.essentials.mappings.foundation.AbstractDirectMapping.writeFromObjectIntoRowWithChangeRecord(AbstractDirectMapping.java:750)
at oracle.toplink.essentials.internal.descriptors.ObjectBuilder.buildRowForUpdateWithChangeSet(ObjectBuilder.java:948)
at oracle.toplink.essentials.internal.queryframework.DatabaseQueryMechanism.updateObjectForWriteWithChangeSet(DatabaseQueryMechanism.java:1263)
at oracle.toplink.essentials.queryframework.UpdateObjectQuery.executeCommitWithChangeSet(UpdateObjectQuery.java:91)
at oracle.toplink.essentials.internal.queryframework.DatabaseQueryMechanism.executeWriteWithChangeSet(DatabaseQueryMechanism.java:390)
at oracle.toplink.essentials.queryframework.WriteObjectQuery.executeDatabaseQuery(WriteObjectQuery.java:109)
at oracle.toplink.essentials.queryframework.DatabaseQuery.execute(DatabaseQuery.java:628)
at oracle.toplink.essentials.queryframework.DatabaseQuery.executeInUnitOfWork(DatabaseQuery.java:555)
at oracle.toplink.essentials.queryframework.ObjectLevelModifyQuery.executeInUnitOfWorkObjectLevelModifyQuery(ObjectLevelModifyQuery.java:138)
at oracle.toplink.essentials.queryframework.ObjectLevelModifyQuery.executeInUnitOfWork(ObjectLevelModifyQuery.java:110)
at oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl.internalExecuteQuery(UnitOfWorkImpl.java:2233)
at oracle.toplink.essentials.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:952)
at oracle.toplink.essentials.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:909)
at oracle.toplink.essentials.internal.sessions.CommitManager.commitChangedObjectsForClassWithChangeSet(CommitManager.java:309)
at oracle.toplink.essentials.internal.sessions.CommitManager.commitAllObjectsWithChangeSet(CommitManager.java:195)
at oracle.toplink.essentials.internal.sessions.AbstractSession.writeAllObjectsWithChangeSet(AbstractSession.java:2657)
at oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl.commitToDatabase(UnitOfWorkImpl.java:1044)
at oracle.toplink.essentials.internal.ejb.cmp3.base.RepeatableWriteUnitOfWork.commitToDatabase(RepeatableWriteUnitOfWork.java:403)
at oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl.commitToDatabaseWithChangeSet(UnitOfWorkImpl.java:1126)
at oracle.toplink.essentials.internal.ejb.cmp3.base.RepeatableWriteUnitOfWork.commitRootUnitOfWork(RepeatableWriteUnitOfWork.java:107)
at oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl.commitAndResume(UnitOfWorkImpl.java:856)
at oracle.toplink.essentials.internal.ejb.cmp3.transaction.base.EntityTransactionImpl.commit(EntityTransactionImpl.java:102)
... 3 moreEDIT: Are you using the EXACT Test Case as I have described it in the previous posts? It's important that you commit(), and not rollback(), the transaction after the flush.
EDIT: Updated the log because I found out that I had made a small change to the original Test Case while I was trying to find a workaround. The current log is produced by the EXACT Test Case I described in my previous posts.
Message was edited by:
bisser -
VLD-0201:Table has more than one primary key
hi
i'm working with OWB 9.2,I was imported the table from database,when i validating that it is giving message:
VLD-0201:Table has more than one primary key
vld-0209:Duplicate unique key i.e:cust_acc and SYS_C00435 detected.
Can i use this table and generate the mapping with out any errors?
Any help will be very generate.Hi Ashok,
I'm quite curious how you managed to get a table with 2 PK's.
I tried it myself:
=======================================================
SQL>create table x(c1 number constraint pk1 primary key,c2 number constraint pk2 primary key, c3 date);
create table x(c1 number constraint pk1 primary key,c2 number constraint pk2 primary key, c3 date)
ERROR at line 1:
ORA-02260: table can have only one primary key
SQL>ed
Wrote file afiedt.buf
1* create table x(c1 number constraint uk1 unique,c2 number constraint uk2 unique, c3 date)
SQL>/
Table created.
=====================================================
As you can see, trying to create a table with more than 1 PK is impossible. With Unique Key, that IS possible (see second example).
I don't expect mappings to function properly with such an error message.
Is it possible for you to drop the table in the database, correct the definition of the table in OWB and then deploy that corrected version to the database?
If on the other hand the table on the database is correct (i.e. has only one PK) then the import into OWB obviously did not go well and I'd suggest you drop the imported definition and try to import it again.
Cheers, Patrick -
Knowing the primary key columns of the given table
Hi,
How can I get the primary key columns of the given table?
Regards,
Sachin R.K.You can find the constraint_name from all_constraints/user_constraints for constraint_type = 'P' (which is the primary key constraint).
And then see which columns are in for the constriant_name
in all_cons_columns/user_cons_columns view.
Below is the example
select acc.column_name from
all_cons_columns acc, all_constraints ac
where acc.constraint_name = ac.constraint_name
and acc.table_name = 'DEPT' AND acc.owner = 'SCOTT'
and ac.constraint_type = 'P'
Hope this helps
Srinivasa Medam -
Is it possible to update primary key column data by using MRU, i tried using the same but i encountered "mru internal routine error: ORA 20001" everytime i update.
Or is there any workaround/suggestionIs it possible to update primary key column data by
using MRU, i tried using the same but i encountered
"mru internal routine error: ORA 20001" everytime i
update.
Or is there any workaround/suggestionTwo things.. One, what is your name, we are friendly group of folks here and would prefer to call you by name.
Secondly, it is a preferred idea NOT to touch the generated primary key. Why would you need to update that value?
Can you explain further what it is you are trying to do?
Thanks!
Tony Miller
UTMB/EHN -
OMPLUS retrieve table primary key column
I'm trying to retrieve the primary key column associated with a table via OMBPLUS.
The following command successfully returns the PK name
OMB+> OMBRETRIEVE TABLE 'ODS_REGION' GET PRIMARY_KEY
REGN_PKWhen I add the GET COLUMNS clause (as per API documentation), I'm still only getting the pk name.
OMB+> OMBRETRIEVE TABLE 'ODS_REGION' GET PRIMARY_KEY GET COLUMNS
REGN_PKAny suggestions on what I might be doing wrong?Worked it out. Syntaxt needed is:
OMBRETRIEVE TABLE 'ODS_REGION' PRIMARY_KEY 'REGN_PK' GET COLUMNS
(no GET between table name and PRIMARY_KEY clause) -
Hi All,How2 delete a pkey for std table and add 2 new primary keys
Hi All,
How2 delete a pkey for std table and add 2 new primary key fields .Please provide me the required procedure .
Thanks&Regards.
Bharat.Hi Bharat,
First thing is you need to have the access key to change any standard dictionary object/standard programs/ standard transactions.You may get this from your basis person after getting approval from your respective manager.But changing or modifying the standard object is not recommended, but if there is no alternate to meet the business requirement then we have to follow this way only.
Next, you need to check whether this table's primary key is being used in any other table as foreing key or not. If there is, then you must remove this relation and then you can delete the unncessary primary key field from that table.Finally you can add the two new fields and set them as primary key, save, check for any errors and activate.
Hope this helps.
Please reward if useful.
Thanks,
Srinivasa
Maybe you are looking for
-
Thinkpad X1 Mouse Issues with USB 3.0 Dock and WIndows 8.1
I have a new X1 (3444-CUU) that I recently upgraded to Windows 8.1. When I connected to the Thinkpad USB 3.0 Dock, there was an automatic updated of the firmware on the docking station. Everything seems to be working except issues with my Keyboard an
-
File created with Oracle PDF driver 1.1 does not open
When opening a PDF file in particular, the following error is generated: "Failed to open document. The file is damaged and can not be repaired." The file can be viewed with other viewers correctly. When you open it with a text editor, the first line
-
I am considering creating a book made with iBooks Author but have a couple of unanswered questions. What determines how Apple chooses whether my book can make it into the ranks of being a paid book? In other words, I don't want to put a whole bunch o
-
Yahoo in firefox is very tiny writing...hard to read
I was doing yahoo email yesterday 1-25-12 and suddenly the printing of it got smaller and smaller and now I can't read it at all. I deleted out firefox completely and today downloaded again and still have same problem. No other program is doing this.
-
Command-S keyboard shortcut is not working
Hi! On our (pre-iSight) 17" iMacG5 running 10.4.6 my son (logged in to his own account) can't use the keyboard shortcut Command-S to save documents (confirmed not to work in Pages and TextEdit - both made by Apple). Using the mouse he can select and