Invalid Keycodes on primary keys (Robot)
I have a Robot that is working quite well until I needed to use the '[' and ']' characters :
robot.keyPress(KeyEvent.VK_OPEN_BRACKET);
Which generates invalid keycode exeptions. I undestand the need to press and release shift for non-primary keys (eg. ?) and I do this with my robot a few times, but I don't understand why I am unable to get my robot to type brackets.
I had a similar problem with VK_SLASH, but VK_DIVIDE was an adequate substitute. :)
Ahh replying to oneself, how embarrassing.
Churning through the forums I found a post that said if you make a JFrame, set it visible, and dispose of it it eliminates the invalid keycode exceptions. Now I have:
JFrame frame = new JFrame();
frame.setVisible(true);
frame.dispose();
robot.keyPress(KeyEvent.VK_OPEN_BRACKET);
robot.keyPress(KeyEvent.VK_CLOSE_BRACKET);
and it works like a charm. This is one of the stranger bugs/solutions I've come across in my life, and I'm intensely curious as to why this solution works. Any ideas?
Similar Messages
-
ResultSet updateRow ,insertRow ,deleteRow APIs on table with no PRIMARY KEY
Hi,
When I use ResultSet.insertRow , updateRow ,deleteRow API's on a table which contais no primary key column I find the following Exception ,
java.sql.SQLException: Operation invalid. No primary key for the table
at com.tandem.sqlmx.Messages.createSQLException(Messages.java:69)
at com.tandem.sqlmx.SQLMXResultSet.getKeyColumns(SQLMXResultSet.java:3501)
at com.tandem.sqlmx.SQLMXResultSet.prepareInsertStmt(SQLMXResultSet.java:3652)
at com.tandem.sqlmx.SQLMXResultSet.insertRow(SQLMXResultSet.java:2073)
at testdateupdate.main(testdateupdate.java:33)
It looks like the table needs to have a primary key column to update or insert or delete rows using the ResultSret APIs.
I use a proprietary JDBC driver. I find the Explanation for this behavior like this ,
JDBC allows update stmts on tables w/out a primary key defined if the stmt is issued by the application. For updateable ResultSets, a primary key restriction is required to avoid updating more rows than desired.I dont understand this explanation and also I dont find this behavior is some other JDBC drivers that I tried with.
Some one Please Clarify the same.
Thanks in Advance.
Thanks and Regards,
JayHi,
in simple words, when a table does not have primary key you can send update and delete on it only by using a Statement object. When using ResultSet.updateRow or ResultSet.deleteRow the jdbc looks for the primary key on the metadata in order to send the correct where clause to the rdbms. I think that this could maybe work with Oracle DBMS, which has a unique id (ROWID) for each record.
Kiros -
Table creation from type - Primary key with 2 columns
Hello,
I have to create a table from a type that I created.
The thing is that I want to create a primary key using two column.
Because this table is junction table.
How can I do this ?
CREATE TABLE CONTENT OF CONTENT_T (ID_COMP primary key, ID_CHAR_J NOT NULL PRIMAR
Y KEY);
Oracle return:
CREATE TABLE CONTENT OF CONTENT_T (ID_COMP primary key,ID_CHAR_J NOT NULL PRIMARY KEY)
ERROR at line 1:
ORA-02260: table can have only one primary key
So I tried:
CREATE TABLE CONTENT OF CONTENT_T (ID_COMP,ID_CHAR_J NOT NULL PRIMARY KEY)
ERROR at line 1:
ORA-02338: missing or invalid column constraint specification
Tahnk's in advance.
Edited by: user8266437 on 29 avr. 2009 13:56
Edited by: user8266437 on 29 avr. 2009 13:56SCOTT@orcl_11g> CREATE OR REPLACE TYPE content_t AS OBJECT
2 (id_comp NUMBER,
3 id_char_j VARCHAR2 (10),
4 other_cols VARCHAR2 (10));
5 /
Type created.
SCOTT@orcl_11g> CREATE TABLE CONTENT OF CONTENT_T (PRIMARY KEY (ID_COMP, ID_CHAR_J))
2 /
Table created.
SCOTT@orcl_11g> INSERT INTO content VALUES (content_t (1, 'A', 'WHATEVER'))
2 /
1 row created.
SCOTT@orcl_11g> COMMIT
2 /
Commit complete.
SCOTT@orcl_11g> INSERT INTO content VALUES (content_t (1, 'A', 'DUPLICATE'))
2 /
INSERT INTO content VALUES (content_t (1, 'A', 'DUPLICATE'))
ERROR at line 1:
ORA-00001: unique constraint (SCOTT.SYS_C0062057) violated
SCOTT@orcl_11g> COMMIT
2 /
Commit complete.
SCOTT@orcl_11g> SELECT * FROM content
2 /
ID_COMP ID_CHAR_J OTHER_COLS
1 A WHATEVER
SCOTT@orcl_11g> -
Entity Bean with Primary Key Class
Hi
I am trying to develop an entity bean attached to a key which have a
composite key using Primary Key Class. When I use the findByPrimaryKey
method of the bean it throws an exception as follows,
java.sql.SQLException: Parameter typecheck failed: invalid parameter type:
ORA-00000: normal, successful completion
at com.netscape.server.jdbc.PreparedStatement.verifyError(Unknown Source)
at com.netscape.server.jdbc.PreparedStatement.afterVerify(Unknown Source)
at com.netscape.server.jdbc.PreparedStatement.executeQuery(Unknown Source)
at com.netscape.server.ejb.SQLPersistenceManager.find(Unknown Source)
at
com.netscape.server.ejb.EntityDelegateManagerImpl.doPersistentFind(Unknown
Source)
at com.netscape.server.ejb.EntityDelegateManagerImpl.find(Unknown Source)
at com.kivasoft.eb.EBHomeBase.findSingleByParms(Unknown Source)
at
TestBean2.ejb_home_TestBean2_EntityBean2Bean.findByPrimaryKey(ejb_home_TestB
ean2_EntityBean2Bean.java:120)
at
TestBean2.ejb_kcp_skel_EntityBean2Home.findByPrimaryKey__TestBean2_EntityBea
n2__TestBean2_TestBKey(ejb_kcp_skel_EntityBean2Home.java:258)
at com.kivasoft.ebfp.FPRequest.invokenative(Native Method)
at com.kivasoft.ebfp.FPRequest.invoke(Unknown Source)
at
TestBean2.ejb_kcp_stub_EntityBean2Home.findByPrimaryKey(ejb_kcp_stub_EntityB
ean2Home.java:341)
at
TestBean2.ejb_stub_EntityBean2Home.findByPrimaryKey(ejb_stub_EntityBean2Home
..java:88)
at TestBean2.Simple1.defaultAction(Simple1.java:115)
at TestBean2.Simple1.doGet(Simple1.java:26)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:865)
at com.netscape.server.servlet.servletrunner.ServletInfo.service(Unknown
Source)
at com.netscape.server.servlet.servletrunner.ServletRunner.execute(Unknown
Source)
at com.kivasoft.applogic.AppLogic.execute(Unknown Source)
at com.kivasoft.applogic.AppLogic.execute(Unknown Source)
at com.kivasoft.thread.ThreadBasic.run(Native Method)
at java.lang.Thread.run(Thread.java:479)
javax.ejb.FinderException
at com.netscape.server.ejb.SQLPersistenceManager.find(Unknown Source)
at
com.netscape.server.ejb.EntityDelegateManagerImpl.doPersistentFind(Unknown
Source)
at com.netscape.server.ejb.EntityDelegateManagerImpl.find(Unknown Source)
at com.kivasoft.eb.EBHomeBase.findSingleByParms(Unknown Source)
at
TestBean2.ejb_home_TestBean2_EntityBean2Bean.findByPrimaryKey(ejb_home_TestB
ean2_EntityBean2Bean.java:120)
at
TestBean2.ejb_kcp_skel_EntityBean2Home.findByPrimaryKey__TestBean2_EntityBea
n2__TestBean2_TestBKey(ejb_kcp_skel_EntityBean2Home.java:258)
at com.kivasoft.ebfp.FPRequest.invokenative(Native Method)
at com.kivasoft.ebfp.FPRequest.invoke(Unknown Source)
at
TestBean2.ejb_kcp_stub_EntityBean2Home.findByPrimaryKey(ejb_kcp_stub_EntityB
ean2Home.java:341)
at
TestBean2.ejb_stub_EntityBean2Home.findByPrimaryKey(ejb_stub_EntityBean2Home
..java:88)
at TestBean2.Simple1.defaultAction(Simple1.java:115)
at TestBean2.Simple1.doGet(Simple1.java:26)
[03/Aug/2001 15:26:41:7] error: Exception: SERVLET-execution_failed: Error
in executing servlet Simat
javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServletple1: java.lang.ClassCastException:
com.netscape.server.deployment.EntityBeanDescriptor
Exception .service(HttpServlet.java:865)
at com.netscape.server.servlet.servletrunner.ServletInfo.service(Unknown
Source)
at com.netscape.server.servlet.servletrunner.ServletRunner.execute(Unknown
Source)Stack Trace:
java.lang.ClassCastException:
com.netscape.server.deployment.EntityBeanDescriptor
a
at com.kivasoft.applogic.AppLogic.execute(Unknown Source)
at com.kivasoft.applogic.AppLogic.ext
com.netscape.server.servlet.servletrunner.AppInfo.popWebAppDescriptor(Unknow
n Source)
at com.netscape.server.servlet.servletrunner.ServletInfo.service(Unknown
Source)
at com.netscape.server.seecute(Unknown Source)
at com.kivasoft.thread.ThreadBasic.run(Native Method)
at java.lang.Threadrvlet.servletrunner.ServletRunner.execute(Unknown
Source)
at com.kivasoft.applogic.AppLogic.execu.run(Thread.java:479)
te(Unknown Source)
at com.kivasoft.applogic.AppLogic.execute(Unknown Source)
at com.kivasoft.thread.ThreadBasic.run(Native Method)
at java.lang.Thread.run(Thread.java:479)
Any kind of help is appreciated. I am using iPlanet App Builder 6.0 with iAS
6.0 SP1.
Thanks
Bhaskara Murthy
Eclipse Networks Inc"Bhamu" <[email protected]> wrote in message
news:9keuo4$[email protected]..
I am trying to develop an entity bean attached to a key which have a
composite key using Primary Key Class. When I use the findByPrimaryKey
method of the bean it throws an exception as follows,I notice that you are using the reference CMP plugin.
at com.netscape.server.ejb.SQLPersistenceManager.find(Unknown Source)I'm also willing to bet that you may have created your own primary key class
with a single field, rather than using the fields type as a primitive
primary key class. If you do this, then SQLPersistenceManager will break.
It is badly written, and has some stupid assumptions. The one I remember
the most is that if you only have one primary key field, then
SQLPersistenceManager assumes you have used a primitive type such as
java.lang.String or java.lang.Integer, to represent it, rather than creating
your own <Enity>Pk.java file.
SQLPersistenceManager works for toy examples, but in general I would say it
is broken and unusable. Either use BMP, or splash out the money for Coco
Base from Thought Inc. Currently the only CMP plugin for iPlanet App server,
other than the reference implementation, that I know of. -
Gettin error while setting column as primary key
Hi I am trying to extract data from XML file
and create one custom table
Its working fine when I try following code
CREATE TABLE xx_PER_ALL_VACANCIES
AS (SELECT x.* FROM hr_api_transactions t, xmltable('//PerAllVacanciesEORow' passing xmltype(transaction_document) columns location_id NUMBER path 'LocationId', organization_id NUMBER path 'OrganizationId', name VARCHAR2(100) path 'Name', creation_date VARCHAR2(15) path 'CreationDate',PeopleGroupId NUMBER path 'PeopleGroupId',REQUISITION_ID NUMBER(15)path 'RequisitionId',COMMENTS LONG() path 'Comments')
x
WHERE t.transaction_ref_table = 'PER_ALL_VACANCIES');but when I try to make Name column as primary key then it gives an error
following is code
CREATE TABLE xx_PER_ALL_VACANCIES
AS (SELECT x.* FROM hr_api_transactions t, xmltable('//PerAllVacanciesEORow' passing xmltype(transaction_document) columns location_id NUMBER path 'LocationId', organization_id NUMBER path 'OrganizationId', name NOT NULL VARCHAR2(100) path 'Name', creation_date VARCHAR2(15) path 'CreationDate',PeopleGroupId NUMBER path 'PeopleGroupId',REQUISITION_ID NUMBER(15)path 'RequisitionId',COMMENTS LONG() path 'Comments')
x
WHERE t.transaction_ref_table = 'PER_ALL_VACANCIES');following is error
Error at Command Line:2 Column:214
Error report:
SQL Error: ORA-00902: invalid datatype
00902. 00000 - "invalid datatype"
*Cause:
*Action:also it gives error when I takes data type as long() for column Comments
Error at Command Line:2 Column:392
Error report:
SQL Error: ORA-00907: missing right parenthesis
00907. 00000 - "missing right parenthesis"
*Cause:
*Action:LONG is not ( and never will be, so don't bother asking) supported by XMLTable. You should use CLOB or BLOB.
SQL> drop table HR_API_TRANSACTIONS
2 /
Table dropped.
SQL> drop table xx_PER_ALL_VACANCIES
2 /
Table dropped.
SQL> create table HR_API_TRANSACTIONS
2 (
3 TRANSACTION_REF_TABLE VARCHAR2(32),
4 TRANSACTION_DOCUMENT CLOB
5 )
6 /
Table created.
SQL> CREATE TABLE xx_PER_ALL_VACANCIES
2 AS
3 (
4 SELECT x.*
5 FROM hr_api_transactions t,
6 xmltable
7 (
8 '//PerAllVacanciesEORow'
9 passing xmltype(transaction_document)
10 columns location_id NUMBER path 'LocationId',
11 organization_id NUMBER path 'OrganizationId',
12 name VARCHAR2(100) path 'Name',
13 creation_date VARCHAR2(15) path 'CreationDate',
14 PeopleGroupId NUMBER path 'PeopleGroupId',
15 REQUISITION_ID NUMBER(15) path 'RequisitionId',
16 COMMENTS LONG() path 'Comments'
17 ) x
18 WHERE t.transaction_ref_table = 'PER_ALL_VACANCIES'
19 )
20 /
COMMENTS LONG() path 'Comments'
ERROR at line 16:
ORA-00907: missing right parenthesis
SQL> CREATE TABLE xx_PER_ALL_VACANCIES
2 AS
3 (
4 SELECT x.*
5 FROM hr_api_transactions t,
6 xmltable
7 (
8 '//PerAllVacanciesEORow'
9 passing xmltype(transaction_document)
10 columns location_id NUMBER path 'LocationId',
11 organization_id NUMBER path 'OrganizationId',
12 name VARCHAR2(100) path 'Name',
13 creation_date VARCHAR2(15) path 'CreationDate',
14 PeopleGroupId NUMBER path 'PeopleGroupId',
15 REQUISITION_ID NUMBER(15) path 'RequisitionId',
16 COMMENTS LONG path 'Comments'
17 ) x
18 WHERE t.transaction_ref_table = 'PER_ALL_VACANCIES'
19 )
20 /
ERROR at line 19:
ORA-00997: illegal use of LONG datatype
SQL> CREATE TABLE xx_PER_ALL_VACANCIES
2 AS
3 (
4 SELECT x.*
5 FROM hr_api_transactions t,
6 xmltable
7 (
8 '//PerAllVacanciesEORow'
9 passing xmltype(transaction_document)
10 columns location_id NUMBER path 'LocationId',
11 organization_id NUMBER path 'OrganizationId',
12 name VARCHAR2(100) path 'Name',
13 creation_date VARCHAR2(15) path 'CreationDate',
14 PeopleGroupId NUMBER path 'PeopleGroupId',
15 REQUISITION_ID NUMBER(15) path 'RequisitionId',
16 COMMENTS CLOB path 'Comments'
17 ) x
18 WHERE t.transaction_ref_table = 'PER_ALL_VACANCIES'
19 )
20 /
Table created.
SQL> -
Problem in universe while joining as the primary key is NUMBER
Hi,
I'm trying to join TEST.SUMMARY.NUMBER to TEST.RESPONSE.FOREIGN_KEY. The problem arises from the first of these, as the primary key is in a column NUMBER. Stupid? Definitely. Rename? Not an option.
I think NUMBER is seen as a magic word (type), and once parsing (for example in "edit join", I get the message "Exception: DBD, ORA-01747: invalid user.table.column, table.column, or column specification State: N/A" .
Normally putting " around the word would do the trick ("NUMBER"), but is seems universe designer removes those during the parsing (?). I come to this conclusion, because if I choose the join line from the graphical menu, and then write to the function line TEST.SUMMARY."NUMBER"=TEST.RESPONSE.FOREIGN_KEY (and press enter), the " are removed. (To get the NUMBER's to the report is good, though, by creating a variable with TEST.SUMMARY."NUMBER")
The database is oracle, and universe is on BusinessObjecs XI 3.1. I've tried to join in the edit join, create a derived table and use ANSI92. No good so far. I also tried to join the fields on report (WebI), but the result was always too many or not enough data from one of the tables. Merging dimensions leads to other problems. I was checking on JOIN_BY_SQL as well as PARSE_SELECT_IN_JOIN in universe parameters, but at glance I didn't find how to solve this with them.
Any ways to force the join, or achieve the data from the both tables in one report table otherwise?Well, I managed to sort this out somehow by using custom SQL in the Web Intelligence report, and joining the tables there with
LEFT JOIN TEST.RESPONSE
ON TEST.SUMMARY."NUMBER"=TEST.RESPONSE.FOREIGN_KEY
Smells like duck tape, but it's working at least somehow. I guess the custom SQL is passed to some lower level, and so the universe-automatic-whatever doesn't handle it in the fly.
Any other ideas? -
Setting the "primary key" possible?
We are trying to access an existing database using Kodo JDO. A part of
this database is old and not particularly well-designed.
Some tables does not have a primary key, eventhough they are entities that
need to be mapped to classes in our persistence layer. For the one table
we are looking at currently, we have changeed a unique index on a numeric
field to be the primary key, simply to make things work.
The table (x) is extremely simple:
id number
description varchar
We have defined the table as having application identity since the user
wants to control the values of the id column. In fact, he would like to be
able to update the value, as long as no other records in the system refers
to the record via a foreign key.
When updating the record we get a kodo.util.UserException saying that
changing the primary key is illegal for persisted objects.
This is of course reasonable seen from JDO, but in our old user interface,
it was possible to change this id as long as it was not referred to.
Is there any other way out of this than to add an "internalID" column with
datastore identify, make that the primary key and then have the id column
have a unique database constraint instead?? We would prefer to not change
the database schema, but are willing to if absolutely necessary.Is there any other way out of this than to add an "internalID" column with
datastore identify, make that the primary key and then have the id column
have a unique database constraint instead?? We would prefer to not change
the database schema, but are willing to if absolutely necessary.Well, I guess you could do the following:
- Set some unmanaged field to the desired new pk value.
- Use a custom class mapping (probably extending
kodo.jdbc.meta.BaseClassMapping) to change the pk column on updates based on the
value of the unmanaged field.
It's not trivial, but it at least avoids schema changes. Note that it will only
work correctly if you have very short-lived PersistenceManagers, though. Once a
transaction that changes a pk value commits, the PM cache will be invalid; Kodo
will still think the object has its old pk value. You also couldn't use the
DataCache. -
Getting Too many objects match the primary key oracle.jbo.Key...
Hi,
I am working on jDEV Version 11.1.1.2.0. In one of my page I am getting exception like "*Too many objects match the primary key oracle.jbo.Key......*".
I have a Items EO and it's Child EO. I am using view criteria in Items VO and drag and dropped this as a Query panel (search criteria). On the right side top I am displaying results in a table. Below I have a Master form and Child table where users can add / edit the Model and it's child values. When user clicks on Save button I am calling BPELprocess (WSDL) which inserts into 3 other systems and return me the message. After Clicking the Save button and displaying the message if I search for the same model (which I created) then it will throw error like above. If I search for different Model it won't throw the error.
For example I have created "TestModel" and If I type letter "T"in Input box and search then it will throw error. If I search for some other models which are not starting with letter "T" then it works fine.
Any idea what may be the reason? Instead of calling services in the Save button I drag and dropped "Commit" button and tested then it works fine.
This is really critical for my project. It would be great if someone can help me on this.
Thanks
MCJBO-27102: DeadViewRowAccessException
Reason: Trying to access a ViewRow which is part of an obsolete/invalid collection. This could happen if a reference to the ViewRow is held by some business logic while the containing view object was removed.
Solution: Find the referenced ViewRow either by re-querying or using findByKey methods to get a valid reference to the ViewRow. instead of create() can you try createInsert() or createAndInitRow() -
Please give the query to find out primary key in table in Sql plus
Dear friends,
Please give me the query to find out the primary key in Sql plus.hi
SQL> DESC user_constraints
Name
OWNER
CONSTRAINT_NAME
CONSTRAINT_TYPE
TABLE_NAME
SEARCH_CONDITION
R_OWNER
R_CONSTRAINT_NAME
DELETE_RULE
STATUS
DEFERRABLE
DEFERRED
VALIDATED
GENERATED
BAD
RELY
LAST_CHANGE
INDEX_OWNER
INDEX_NAME
INVALID
VIEW_RELATED
SQL> SELECT constraint_name,table_name,r_constraint_name,status
2 FROM user_constraints WHERE constraint_type='P';
CONSTRAINT_NAME TABLE_NAME R_CONSTRAINT_NAME STATUS
SYS_C003141 CUSTOMERS ENABLED
PK_DEPT DEPT ENABLED
SYS_C003139 SALESREPS ENABLEDKhurram -
Hi all,
Instead of running the SQL statment. Any ideas how do i know the primary key of a table? Like anywhere that i can view it from the Enterprise Manager Console?
Thanks
beckSQL> desc dba_constraints
Name Null? Type
OWNER VARCHAR2(30)
CONSTRAINT_NAME NOT NULL VARCHAR2(30)
CONSTRAINT_TYPE VARCHAR2(1)
TABLE_NAME NOT NULL VARCHAR2(30)
SEARCH_CONDITION LONG
R_OWNER VARCHAR2(30)
R_CONSTRAINT_NAME VARCHAR2(30)
DELETE_RULE VARCHAR2(9)
STATUS VARCHAR2(8)
DEFERRABLE VARCHAR2(14)
DEFERRED VARCHAR2(9)
VALIDATED VARCHAR2(13)
GENERATED VARCHAR2(14)
BAD VARCHAR2(3)
RELY VARCHAR2(4)
LAST_CHANGE DATE
INDEX_OWNER VARCHAR2(30)
INDEX_NAME VARCHAR2(30)
INVALID VARCHAR2(7)
VIEW_RELATED VARCHAR2(14)CONSTRAINT_TYPE = P for Primary Key -
Hello
I have to update a primary key (PK) which is referenced by many foreign keys (FK).
The primary key columns cannot be updated as this would orphan the dependant tables,
and the dependant tables cannot be updated prior to the parent table as this would also make them orphans.
I think this problem was solved by disabling the foreign key constraints or deleting the original records and recreating them.
Since neither of these solutions is particularly satisfactory for me I read about 'deferred constraints'.
My question is:
Can I use(modify to) 'INITIALLY DEFERRED' keyword on constraints's table already created with The default, INITIALLY IMMEDIATE ,
that is, update my primary key and foreign keys, and then re-set to
'INITIALLY IMMEDIATE'? Or another trick exists ?
Thanks in advance for your attentionIt is very popular the idea that the updates on primary key columns are a very bad thing.
Oracle supports this idea and that's why they don't give the "on update cascade" clause on foreign keys.
So in this case I suggest you to define a master table like this.
create table master_table (
key_id number primary key,
your_primary_key varchar2 not null unique
/Then you must use that key_id column as foreign key in place of your original primary key. In this way don't even need to update referencing rows when updating the original primary key because the foreign key value doesn't change and everything is always fine as before.
So instead to lose time implementing some strange sort of cascade triggers plain to do something like this on your schema.
insert into master_table (id_key,primary_key) (
select rownum,primary_key
from your_main_table
alter table your_main_table add (
id_key number,
update your_main_table a
set id_key = (
select b.id_key
from master_table
where b.primary_key=a.primary_key
Drops foreign keys
alter table your_main_table drop primary key cascade
alter table your_main_table add constraint pk
primary key(id_key)
alter table your_main_table add constraint fk
foreign key(id_key) references master_table
alter table your_main_table drop (
your_primary_key
alter table a_referencing_table add (
id_key number,
update a_referencing_table a
set id_key = (
select b.id_key
from master_table
where b.primary_key=a.primary_key
alter table a_referencing_table add constraint fk_2
foreign key(id_key) references master_table
alter table a_referencing_table drop (
your_primary_key
/If you have many objects referencing those tables I suggest you to rename the tables and to create views with the original name of the renamed tables that show data as it was before with a join on master_table. in this way you don't need to change the code of the application referencing them but you just need to recompile invalidated objects.
Bye Alessandro -
Composite primary key as foreign key not working
i want have two tables
in one table i make a composite primary key
and in the other table i refer one of the column of the composite key from the above table as foreign key in this table but this didn't work.
eg:
create table temp1
( name char2(10),
ssn# number(10)
address varchar2(10)
constraint (cons_1)primary key(name,ssn#) );
create table temp2
( name1 char2(10) references temp1(name),
add varchar(20));
this didn't work....can't create temp2 table it's giving errorThe following includes some corrections and some suggestions. Your original code had several problems: missing comma, invalid name, invalid data type, no unique key for the foreign key to reference. The following fixes all of those and adds some meaningful names for the constraints and formats it so that it is easier to read.
CREATE TABLE temp1
(name VARCHAR2 (10),
ssn# NUMBER (10),
address VARCHAR2 (10),
CONSTRAINT temp1_name_ssn#_pk
PRIMARY KEY (name, ssn#),
CONSTRAINT temp1_name_uk
UNIQUE (name))
Table created.
CREATE TABLE temp2
(name1 VARCHAR2 (10),
address VARCHAR2 (20),
CONSTRAINT temp2_name1_fk
FOREIGN KEY (name1)
REFERENCES temp1 (name))
Table created. -
Hi, I have a table which maintains versions. This has a composite primary key - eg - Company_id + version_no. I tried creating a form based on a template with Primary key as Company_id and primary key column 2 as Version_no. When I try to run the form it gives an error, 'Invalid number' on the process in Rendering page. When i remove the second primary key the results are displayed correctly (however I have a problem when there are more than 1 versions - too many rows).
How do I create a form based on a template with a composite key.
How can I create a form which has more than 2 keys as part of a composite primary key.This thread is old....but let me make some notice...
Oracle guys,
does all that mean that you encourige using simple PK which is based on sequence, regardless that involve unique index on columns that normaly represent PK, but in master detail wizard it is impossible to use composite keys?
Why I'm asking this?
Because many apps are translated to HTMLDB (Oracle based) directly with not too much problems. But if we have to change PK then many things are complicated...
This all come from a problem how to fill detail table PK where first coulmn represent master key field and second one is filled with user input-nothing can be automated.
In your demo I saw that for "orders-order items" you use "simple PK" technique, regardless order items could have PK made from (OrderId, Id)...
Please make some respond for this....
THX! -
Composite Primary Key Mapping error
I have the following code:
public class PreviousStepEJB3PK implements Serializable {
private static final long serialVersionUID = 3024775815042084864L;
public Long id;
public Long previousId;
public PreviousStepEJB3PK() {
public PreviousStepEJB3PK(Long id, Long previousId) {
this.id = id;
this.previousId = previousId;
public boolean equals(Object other) {
if (other instanceof PreviousStepEJB3PK) {
final PreviousStepEJB3PK otherPreviousStepPK = (PreviousStepEJB3PK) other;
final boolean areEqual = (otherPreviousStepPK.id.equals(id) && otherPreviousStepPK.previousId.equals(previousId));
return areEqual;
return false;
public int hashCode() {
return super.hashCode();
@Entity
@Table(name = "OS_CURRENTSTEP_PREV")
@NamedQuery(name = "findById",
query = "select object(o) from PreviousCurrentStepEJB3 o where o.id = ?1")
@IdClass(PreviousStepEJB3PK.class)
public class PreviousCurrentStepEJB3 implements Serializable {
private static final long serialVersionUID = 1717698904412346878L;
@Id
@Column(name = "ID", nullable = false)
private Long id;
@Id
@Column(name = "PREVIOUS_ID", nullable = false)
private Long previousId;
public PreviousCurrentStepEJB3() {
I´m using eclipse to deploy my application over an OC4J. When I launch the deploy I have the following error:
07/07/05 11:42:47 Caused by: Exception [TOPLINK-7150] (Oracle TopLink Essentials - 2006.8 (Build 060829)): oracle.toplink.essentials.exceptions.ValidationException
Exception Description: Invalid composite primary key specification. The names of the primary key fields or properties in the primary key class [ar.com.eds.mcd.fawkes.model.PreviousStepEJB3PK] and those of the entity bean class [class ar.com.eds.mcd.fawkes.model.PreviousCurrentStepEJB3] must correspond and their types must be the same. Also, ensure that you have specified id elements for the corresponding attributes in XML and/or an @Id on the corresponding fields or properties of the entity class.
07/07/05 11:42:47 at oracle.toplink.essentials.exceptions.ValidationException.invalidCompositePKSpecification(ValidationException.java:995)
07/07/05 11:42:47 at oracle.toplink.essentials.internal.ejb.cmp3.metadata.MetadataValidator.throwInvalidCompositePKSpecification(MetadataValidator.java:119)
07/07/05 11:42:47 at oracle.toplink.essentials.internal.ejb.cmp3.metadata.accessors.ClassAccessor.validatePrimaryKey(ClassAccessor.java:1463)
07/07/05 11:42:47 at oracle.toplink.essentials.internal.ejb.cmp3.metadata.accessors.ClassAccessor.process(ClassAccessor.java:463)
07/07/05 11:42:47 at oracle.toplink.essentials.internal.ejb.cmp3.metadata.MetadataProcessor.processAnnotations(MetadataProcessor.java:196)
07/07/05 11:42:47 at oracle.toplink.essentials.internal.ejb.cmp3.EntityManagerSetupImpl.processORMetadata(EntityManagerSetupImpl.java:993)
07/07/05 11:42:47 at oracle.toplink.essentials.internal.ejb.cmp3.EntityManagerSetupImpl.predeploy(EntityManagerSetupImpl.java:501)
07/07/05 11:42:47 at oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider.createContainerEntityManagerFactory(EntityManagerFactoryProvider.java:152)I ran into a similar problem. I was able to work around it by putting the @Id annotations on the accessors for the primary key fields rather than on the fields themselves. This seems like a bug to me.
-
Need to create form on a table with report with a table has NO primary key
Hi, I tried to created some insert/update/delete form+report in an application, it works fine only if the table has primary key. Does anyone know how to create the same functionality with a table with no primary key? I saw an application is built on older version of htmldb that is using tables with no primary keys at all.
Here are the specific issues that I am facing:
- I am building some Form on a table with Report, it requires the table with primary key for form to update. Is there a workaround that I can use tables that has no primary keys at all?
- Say if primary key is necessary in the previous report+form, but the maximum number of columns that I can use to composed a primary is only 2 for that Form-Report, I cannot find anything handling > 2 primary key. Do you know if there are some ways to composite a primary key from many columns together?
Your help is really appreciated.
Thanks,
AngelaSorry to ask response so late. I had no time to get back to that issue before.
Regarding the triggers, I can make it work for the update, but not the insert.
Here is my trigger:
create or replace trigger STATUS_T1
instead of insert on STATUS
begin
insert into STATUS ("LABEL", "AREA", "OWNER", "TEST_NAME", "STATUS", "REMARKS", "BUGS", "DEV_MGR", "TEST_BY_DATE")
values(:new.LABEL, :new.AREA, :new.OWNER, :new.TEST_NAME, :new.STATUS, :new.REMARKS, :new.BUGS, :new.DEV_MGR, :new.TEST_BY_DATE);
end;
by any chance, you can notify what is wrong?
I already skip the ROWID when inserting to the view STATUS, but I cannot figure out what is wrong when inserting a new record to that view.
It gave me the following errors:
ORA-06550: line 1, column 38: PL/SQL: ORA-00904: "ID": invalid identifier ORA-06550: line 1, column 7: PL/SQL: SQL Statement ignored
Error Unable to process row of table STATUS
Then, I turned to debug mode, I am thinking that maybe because I use a HIDDEN item to hold the value of ROW_ID as I use the rowid (called ID in the view) to retrieve the record as a column link from previous page. What do you think?
Thanks again,
Angela
Maybe you are looking for
-
Problem in migrating from 6i to 10g and I need help
I'm trying to change my program from 6i to 10g I migrated libraries and every thing is ok but when I try to migrate forms I had this error ERROR opening D:\10gnkinkos\SHIFTS.fmb :oracle.forms.jdapi.JdapiException: A subclassed module could not be fou
-
Microsoft Office Home and Student 2010
I bought the family pack of Microsoft Office Home and Student 2010 and every time I try to install it on my computer it cancels and goes to this message saying "Setup has stopped working" "A problem caused the program to stop working correctly. Windo
-
AP Credit memo UDF on check stub
Hi, Having a real issue - I am trying to get a UDF from AP credit memos to print on the check stub. When I add a field I cannot select the ORPC table from the database where the UDF is populated. Credit memos appear on the check stub but is there a w
-
Lumia Imaging SDK and PubCenter on WP8.1 RT : System.TypeLoadException
Hello, i'm developping a WP8.1 RT app using the Lumia imaging SDK for 8.1 and it's working like a charm. Recently, I had to put some PubCenter ads on my layout. When navigating to a page that is making calls to Imaging library, I catch an exception :
-
Cost benefit analysis for using XI 3.0
Hi, Does anyone have a cost benefit analysis document for using XI 3.0 versus developing point to point interfaces ? I need something that can easily justify and sell the idea of using XI over going down the custom path for point to point development