How to prevent a new record sequence number to be created for a period of 14 days
ALTER proc [dbo].[spCreateSequenceContainerFill]
(@containerID as nvarchar(64),
@lotNum as bigint,
@customerID as int = 1164,
@productID as int,
@fillDateTime as datetime
as
BEGIN
declare @checkcontainerID as bigint
DECLARE @ID int;
set nocount on
SELECT @checkcontainerID = CONVERT(bigint, SUBSTRING(@containerID, 1, 6)) FROM ContainerFillHistory WHERE containerID = @containerID
IF (@checkcontainerID is null)
SELECT @ID = COALESCE((SELECT MAX(ID) + 1 FROM ContainerFillHistory), 1)
ELSE
SELECT @ID = Max(ID) FROM ContainerFillHistory WHERE containerID = @containerID AND @fillDateTime >= DATEADD(DAY, 14, CAST(fillDateTime as DATETIME))
IF (@ID is not null)
SET @ID = @ID + 1
INSERT INTO ContainerFillHistory(ID, containerID, lotID, customerID, productID, fillDateTime, purchorderNum)
VALUES(@ID, @containerID, @lotNum, @customerID, @productID, @fillDateTime, null)
END
If there is a no record with an ID then a new record is created and inserted in the table. After 14 days it is OK to add another record with that ID and bump up the sequence number of the total records in the table. Handling the non existing
case the first time is OK, but the restriction of 14 days if a new record is trying to be inserted has to be ignored.
So far I have this TSQL code.
Please try the following and tweak accordingly.
ALTER proc [dbo].[spCreateSequenceContainerFill]
(@containerID as nvarchar(64),
@lotNum as bigint,
@customerID as int = 1164,
@productID as int,
@fillDateTime as datetime
AS
BEGIN
SET NOCOUNT ON;
DECLARE @ID int;
IF EXISTS (select * FROM ContainerFillHistory WHERE containerID = @containerID)
BEGIN
SELECT @fillDateTime = DATEADD(DAY, -14, @fillDateTime)
IF EXISTS ( SELECT *
FROM ContainerFillHistory
WHERE containerID = @containerID
AND CAST(fillDateTime as DATETIME) > @fillDateTime --AND @fillDateTime >= DATEADD(DAY, 14, CAST(fillDateTime as DATETIME))
BEGIN
RETURN; --//14 Days condition not met
END
ELSE
BEGIN
SELECT @ID = Max(ID) FROM ContainerFillHistory
WHERE containerID = @containerID
AND CAST(fillDateTime as DATETIME) <= @fillDateTime
END
END
ELSE
BEGIN
SELECT @ID = MAX(ID) FROM ContainerFillHistory ;
END
IF @ID IS NULL
BEGIN
SET @ID = 1 ;
END
ELSE
BEGIN
SET @ID = @ID + 1 ;
END
INSERT INTO ContainerFillHistory(ID, containerID, lotID, customerID, productID, fillDateTime, purchorderNum)
VALUES(@ID, @containerID, @lotNum, @customerID, @productID, @fillDateTime, null) ;
END
Similar Messages
-
Portal Master-detail form how to auto assign detail record sequence number
Portal Master-detail form how to auto assign detail record sequence number.Please help me?
You can just read the following section
Can I specify a sequence number generator as the default value for a form column?
Yes. Enter the following in the "default value" field for the column:
#<schema name>.<sequence name>.nextval
where <schema name> is the name of the schema containing the sequence, and <sequence name> is the name of the sequence. The entry is preceded by a "#".
For example, if the schema name is "SCOTT", and the sequence name is "CUSTOMER_SEQ", the default value entry is:
#SCOTT.CUSTOMER_SEQ.NEXTVAL
same way you can do for master - detail form.
for more information on forms please refer the following URL.
http://otn.oracle.com/products/iportal/htdocs/portal_faq.htm#BuildingApplications
hope it helps. -
How to add a new column (Project Number) in the action items table under NPD Module?
There are two projects with same name and created by same person in NPD.
So when it is displayed in "Action Items" table, It looks similar.
To avoid this, I need one more column (Project Number) to be added in the "Action Items" table and " Strategic briefs and projects" table.
So, How to add a new column (Project Number) in the "Action Items" table and " Strategic briefs and projects" table under NPD Module?
Please do the needful.There is no out of the box configuration available to add columns to NPD action items. As always we welcome enhancement requests.
Thanks
Kelly -
How do I insert new record and get results on a landing page
how do I insert new record and get results on a landing page
It's not clear from your post what you are asking. In a SQL database, you use the INSERT statement to insert a row into a table. You use the SELECT statement to retrieve rows. Here's some basic info on how to do that within PHP
PHP MySQL Insert Into
PHP MySQL Select -
How to add a new record(RowSet) in another ViewObject in doDML method
how to add a new record(RowSet) in another ViewObject in doDML method
Re: An Entity/View Object attributes default values from other view object should help
-
How to find the number of references created for a given object ??
How to find the number of references created for a given object in a big application environment.
That means, if i give any object name (of my application) as input, then how can i find the[b] number of references created for that particular object ??Please do not post the same question multiple times.
As for your original question, there is no direct way to do it.
Especially not the way you phrased it,
since objects don't have "names".
Applications also don't have "names".
They have classes and instances.
Also, there are 2 related issues, and I'm not sure which one is the one you asked.
#1. Finding the number of references to the same object.
Eg.
Map<String,String> a = new HashMap<String,String>();
Map<String,String> b = new HashMap<String,String>();
Map<String,String> c = a;In this case, there are only 2 objects.
The first object has (at least) 2 references pointing to it.
The second object has (at least) 1 reference pointing to it.
(There may be more, if the HashMap library keeps
references to these things, or if the HashMap object has
some internal cyclic references...)
If you're asking this, then it can't be done.
It's an active research topic in universities
and software research labs, called "alias analysis".
Type it in google, and you'll see people are working hard
and having little success so far.
#2. Finding the number of instances created from a class.
In this case, what you have to do is to add a counter to
the constructor of the class. Every time an object is constructed,
you increment the counter. Like this:
class MyClass
public static int counter = 0;
public MyClass( ) { counter++; }
// Then later in your program, you can do this:
MyClass a = new MyClass();
MyClass b = new MyClass();
System.out.println(MyClass.counter); // It should show 2Note: you won't be able to do this to every class in the system.
For every class you care about, you have to modify its constructor.
Also: when an object is deleted, you won't always know it
(and thus you won't always be able to decrement the counter).
Finalizers cannot always work (read Joshua Bloch's
"Effective Java" book if you don't believe me), but basically
(1) finalizers will not always be called, and
(2) finalizers can sometimes cause objects to not be deleted,
and thus the JVM will run out of memory and crash -
Geotagging - how can I edit new places that I have previously created but with typos, errors etc? How do I delete a place I have set up? Then I could create a new, correct entry. I'm using iPhoto '09.
Is it OK to reply to my own question?? Thanks to the related posts that appeared AFTER I'd made the post above, I learnt about the 'Manage my places' item under the Windows menu. I felt a bit dumb not knowing this.
BUT it doesn't completely resolve the issue. The info shown in the EXIF (using opt-cmd-I) under Places has the place name I choose, but it is followed by a few other lines that are incorrect and do not seem to be anything to do with any data I can see under 'Manage my places'.
Can anyone explain where these other entries might come from, and how to edit them? -
I got busy over the new year and forgot to purchase Applecare for my iPhone. 30 days past purchase date is too late - right?
Thanks Peter. I thought about that and had discounted the idea but since I am only 30 minutes away from my A store, I think I'll give it a try. I can be charming specially when I wear clean jeans and a nice top. :-)
Jerry H -
How to write the new records not with existing records.
hi,
I have a script.If i execute the script it writes the records.but its writing with the exisiting records.It writes not only the new records but also the old records.
for eg: the exisiting records are:
1111115-2,USD,DINESH,1,1,,,,9,,,,123456184001,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,9999,,,,
1111116-2,USD,DINESH,1,1,,,,9,,,,123456184001,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,9999,,,,
1111117-2,USD,DINESH,1,1,,,,9,,,,123456184001,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,9999,,,,
1111118-2,USD,DINESH,1,1,,,,9,,,,123456184001,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,9999,,,,
1111119-2,USD,DINESH,1,1,,,,9,,,,123456184001,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,9999,,,,
but now what happend is the new records such as
1111116-2,USD,DINESHBABU,1,1,,,,9,,,,123456184003,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,9999,,,,
1111117-2,USD,DINESHBABU,1,1,,,,9,,,,123456184003,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,9999,,,,
1111118-2,USD,DINESHBABU,1,1,,,,9,,,,123456184003,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,9999,,,,
1111119-2,USD,DINESHBABU,1,1,,,,9,,,,123456184003,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,9999,,,,
it gets appended with the old existing records,
1111117-2,USD,DINESH,1,1,,,,9,,,,123456184001,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,9999,,,,
1111118-2,USD,DINESH,1,1,,,,9,,,,123456184001,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,9999,,,,
1111119-2,USD,DINESH,1,1,,,,9,,,,123456184001,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,9999,,,,
1111113-2,USD,DINESHBABU,1,1,,,,9,,,,123456184003,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,9999,,,,
1111114-2,USD,DINESHBABU,1,1,,,,9,,,,123456184003,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,9999,,,,
1111115-2,USD,DINESHBABU,1,1,,,,9,,,,123456184003,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,9999,,,,
1111116-2,USD,DINESHBABU,1,1,,,,9,,,,123456184003,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,9999,,,,
1111117-2,USD,DINESHBABU,1,1,,,,9,,,,123456184003,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,9999,,,,
1111118-2,USD,DINESHBABU,1,1,,,,9,,,,123456184003,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,9999,,,,
1111119-2,USD,DINESHBABU,1,1,,,,9,,,,123456184003,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,9999,,,,
there will be some problem happens when we are going to upload a bulk data of say 25000 records.if its gonna update 20000 records,rest 5000 records i have to do it in next step,if this is going to happen then the first 20000 records will be displayed forever.because it have the capacity to write 20000 records.thenext 500 records will not be written.so there is a chance of redundancy.how to avoid this redundancy while running this script
my script is
create or replace procedure input_tables(table1 in varchar2)
is
str varchar2(32767);
cnt number(2);
cursor c1(tname in varchar2)
is
select column_name
from all_tab_columns
where table_name = tname
order by column_id;
rec c1%rowtype;
begin
cnt:= 1;
str:= 'declare '||
'cursor c2 '||
'is '||
'select ';
open c1(table1);
loop
fetch c1 into rec;
exit when c1%notfound;
if cnt = 1 then -- Added New
str:= str||rec.column_name; -- Added New
cnt:= cnt + 1; -- Added New
else -- Added New
str:= str||'||'',''||'||rec.column_name; -- Added New
end if; -- Added New
end loop;
close c1;
str:= str||' SRC from '||table1||';'||
' r2 c2%rowtype;'||
' ft UTL_FILE.file_type;'||
' str2 varchar2(200);'|| --Added New
' begin '||
' ft := UTL_FILE.fopen(''SAMPLE'',''OUTPUT.csv'',''w'');'||
' for r2 in c2'||
' loop '||
' UTL_FILE.put_line(ft,r2.SRC);'||
' end loop;'||
' UTL_FILE.fclose(ft);'||
' end;';
execute immediate(str);
end;
thanks,
Ratheesh.Hi!
U can check the following script --
create or replace procedure input_tables(table1 in varchar2,start_col in number,last_col in number)
is
str varchar2(32767);
cnt number(2);
cursor c1(tname in varchar2)
is
select column_name
from all_tab_columns
where table_name = tname
order by column_id;
rec c1%rowtype;
begin
cnt:= 1;
str:= 'declare '||
'cursor c2 '||
'is '||
'select ';
open c1(table1);
loop
fetch c1 into rec;
exit when c1%notfound;
if cnt = 1 then -- Added New
str:= str||rec.column_name; -- Added New
cnt:= cnt + 1; -- Added New
else -- Added New
str:= str||'||'',''||'||rec.column_name; -- Added New
end if; -- Added New
end loop;
close c1;
str:= str||' SRC from '||table1||
' where rownum between '||start_col||' and '||last_col||';'|| -- Added New
' r2 c2%rowtype;'||
' ft UTL_FILE.file_type;'||
' str2 varchar2(200);'|| --Added New
' begin '||
' ft := UTL_FILE.fopen(''SAMPLE'',''OUTPUT.csv'',''w'');'||
' for r2 in c2'||
' loop '||
' UTL_FILE.put_line(ft,r2.SRC);'||
' end loop;'||
' UTL_FILE.fclose(ft);'||
' end;';
execute immediate(str);
end;
/ To print first ten rows --
exec input_tables('EMP',1,10); --first 10 rowsTo print next remain rows --
exec input_tables('EMP',11,15);N.B: No tested....
Regrads.
Satyaki De. -
How to detect when new record is created?
How can I detect when new record is created in PA30? For example, a newly create record for infotype 6 (address).
Can I get the information in PCL4?Hi Irene,
the field PAnnnn-AEDTM, nnnn is the infotype number, will give you the date when the record was last changed.
Not sure if you can precisely get the date when the infotype was created. I dont feel the need to read cluster form the same.
Regards,
Pulkit -
How do you insert new records into multiple tables using the same unique primary key?
I’ve created a PHP site and MySQL server using a free app called XAMPP. I have successfully created a form in Dreamweaver that will write data to a (name) table in the SQL database. Here’s my question: How do you write to two (or more) tables in the same database and pass the same primary key to both tables? In the SQL database, I defined the first field as ID and set it as the primary key with auto update. So, when you insert a new record, it creates a unique primary key for that record. In my form, I’m capturing info that needs to be stored to two tables at the same time; a Name table and Address table. Since the Name and Address tables use the ID field as the primary key, I believe I will need to pass the ID value from the Name table to the insert of the Address table to insure they both have the same primary key, right?
No. You probably need the primary key from one table to be a foreign key in the other tables. In any case, I believe you can use two methods to obtain the auto generated key. First with SQL:
http://dev.mysql.com/doc/refman/5.0/en/getting-unique-id.html
And the other using a PHP function:
http://us3.php.net/mysql_insert_id -
How to sort the new records when you input them in a Forms bloc?
Hi,
I have a multi-record data block, how can I do to sort the records in this block when you enter some new records? for instance, you have a table(emp), 3 coloumns(empid, empname, deptno). when you enter new records, how can you do to make records order by deptno? not in quiry status.
Thanks. Please help me!I think Steve has answered your question and I doubt that what Frank is suggesting is what you are actually trying to do.
However,
from the top of my head I don't know if you can set the order by clause on a datablock dynamically <<-Yes you can set it with set_block_property. You don't really want to put it in the where clause because if the user enters query criteria in database fields, they will get appended after the order by and the query will fail. -
SAP HR: How to prevent delimiting of records when setting a lock
Hi All,
I am part of a SAP HR implementation. In one of the Infotypes, I am copying a record and setting a lock in the new record by going to the menu Edit-->Lock/Unlock.
This should ideally lock the record without touching the previous record. But in my case, the previous record is being delimited. Can someone tell me what settings need to be done in order to prevent the delimiting of the previous record till the lock is unlocked.
Thanks & Regards,
ShobhitI think it depends on the Time Constraint of the Infotype in question. Do you have a valid record with a BEGDA after the record that you are trying to lock?
~Suresh -
How to prevent LV "New Open Help Config" panel displaying during TS?
what is the easiest way to prevent LV "New Open Help Config" panel displaying or being visible during TS execution?
Hi Stephen,
The first option you could look at is just to use the LabVIEW Run-Time Engine instead of the Development System as your LabVIEW adapter (Configure >> Adapters). This will not show the Getting Started window that pops open when you run a sequence that contains LabVIEW action steps.
The other option that you could look into is the window activation properties for each step found by right-clicking a step and selecting properties. Then select the Run Options tab and mess with the TestStand Activation Window drop down menu.
Hope this helps!
Best Regards,
Jonathan N.
National Instruments -
How to insert a new record to table with foreign key
I have 3 tables like this :
CREATE TABLE PERSON (
PK INTEGER NOT NULL,
NAME VARCHAR(10),
SSNUM INTEGER,
MGR INTEGER);
ALTER TABLE PERSON ADD CONSTRAINT PK_PERSON PRIMARY KEY (PK);
ALTER TABLE PERSON ADD CONSTRAINT FK_PERSON FOREIGN KEY (MGR) REFERENCES
PERSON (PK);
/* Tables
CREATE TABLE PROJECT (
PK INTEGER NOT NULL,
CODE_NAME INTEGER);
ALTER TABLE PROJECT ADD CONSTRAINT PK_PROJECT PRIMARY KEY (PK);
/* Tables
CREATE TABLE XREF (
PERSON INTEGER NOT NULL,
PROJECT INTEGER NOT NULL);
ALTER TABLE XREF ADD CONSTRAINT PK_XREF PRIMARY KEY (PERSON, PROJECT);
ALTER TABLE XREF ADD CONSTRAINT FK_XREF1 FOREIGN KEY (PERSON) REFERENCES
PERSON (PK);
ALTER TABLE XREF ADD CONSTRAINT FK_XREF2 FOREIGN KEY (PROJECT) REFERENCES
PROJECT (PK);
I do like the way of "ReverseTutoral" and the file .jdo here :
<?xml version="1.0" encoding="UTF-8"?>
<jdo>
<package name="reversetutorial">
<class name="Person" objectid-class="PersonId">
<extension vendor-name="kodo" key="class-column" value="none"/>
<extension vendor-name="kodo" key="lock-column" value="none"/>
<extension vendor-name="kodo" key="table" value="PERSON"/>
<field name="name">
<extension vendor-name="kodo" key="data-column"
value="NAME"/>
</field>
<field name="person">
<extension vendor-name="kodo" key="pk-data-column"
value="MGR"/>
</field>
<field name="persons">
<collection element-type="Person"/>
<extension vendor-name="kodo" key="inverse"
value="person"/>
<extension vendor-name="kodo" key="inverse-owner"
value="person"/>
</field>
<field name="pk" primary-key="true">
<extension vendor-name="kodo" key="data-column"
value="PK"/>
</field>
<field name="ssnum">
<extension vendor-name="kodo" key="data-column"
value="SSNUM"/>
</field>
<field name="xrefs">
<collection element-type="Xref"/>
<extension vendor-name="kodo" key="inverse"
value="person"/>
<extension vendor-name="kodo" key="inverse-owner"
value="person"/>
</field>
</class>
<class name="Project" objectid-class="ProjectId">
<extension vendor-name="kodo" key="class-column" value="none"/>
<extension vendor-name="kodo" key="lock-column" value="none"/>
<extension vendor-name="kodo" key="table" value="PROJECT"/>
<field name="codeName">
<extension vendor-name="kodo" key="data-column"
value="CODE_NAME"/>
</field>
<field name="pk" primary-key="true">
<extension vendor-name="kodo" key="data-column"
value="PK"/>
</field>
<field name="xrefs">
<collection element-type="Xref"/>
<extension vendor-name="kodo" key="inverse"
value="project"/>
<extension vendor-name="kodo" key="inverse-owner"
value="project"/>
</field>
</class>
<class name="Xref" objectid-class="XrefId">
<extension vendor-name="kodo" key="class-column" value="none"/>
<extension vendor-name="kodo" key="lock-column" value="none"/>
<extension vendor-name="kodo" key="table" value="XREF"/>
<field name="person">
<extension vendor-name="kodo" key="pk-data-column"
value="PERSON"/>
</field>
<field name="person2" primary-key="true">
<extension vendor-name="kodo" key="data-column"
value="PERSON"/>
</field>
<field name="project">
<extension vendor-name="kodo" key="pk-data-column"
value="PROJECT"/>
</field>
<field name="project2" primary-key="true">
<extension vendor-name="kodo" key="data-column"
value="PROJECT"/>
</field>
</class>
</package>
</jdo>
Data of those tables are :
PERSON :
| PK | NAME | SSNUM | MGR |
| 1 | ABC | 1 | 1 |
| 2 | DEF | 5 | 1 |
PROJECT
| PK | CODE_NAME |
| 1 | 12 |
| 2 | 13 |
And now I want to add a new record into table XREF : insert into XREF
values (1,1);
public void createData() {
Xref xref = new Xref();
Person person = new Person(1);
Project project = new Project(1);
xref.setPerson(person);
xref.setProject(project);
person.getXrefs().add(xref);
person.getXrefs().add(xref);
pm.currentTransaction().begin();
pm.makePersistent(xref);
pm.currentTransaction().commit();
I don't know why Kodo automatically insert new record to table PERSON ->
confilct Primary Key. The errors are :
0 [main] INFO kodo.Runtime - Starting Kodo JDO version 2.4.1
(kodojdo-2.4.1-20030126-1556) with capabilities: [Enterprise Edition
Features, Standard Edition Features, Lite Edition Features, Evaluation
License, Query Extensions, Datacache Plug-in, Statement Batching, Global
Transactions, Developer Tools, Custom Database Dictionaries, Enterprise
Databases, Custom ClassMappings, Custom ResultObjectProviders]
41 [main] WARN kodo.Runtime - WARNING: Kodo JDO Evaluation expires in 29
days. Please contact [email protected] for information on extending
your evaluation period or purchasing a license.
1627 [main] INFO kodo.MetaData -
com.solarmetric.kodo.meta.JDOMetaDataParser@e28b9: parsing source:
file:/D:/AN/Test/classes/reversetutorial/reversetutorial.jdo
3092 [main] INFO jdbc.JDBC - [ C:23387093; T:19356985; D:10268916 ] open:
jdbc:firebirdsql:localhost/3050:D:/An/test/temp.gdb (sysdba)
3325 [main] INFO jdbc.JDBC - [ C:23387093; T:19356985; D:10268916 ]
close:
com.solarmetric.datasource.PoolConnection@164dbd5[[requests=0;size=0;max=70;hits=0;created=0;redundant=0;overflow=0;new=0;leaked=0;unavailable=0]]
3335 [main] INFO jdbc.JDBC - [ C:23387093; T:19356985; D:10268916 ] close
connection
3648 [main] INFO jdbc.JDBC - Using dictionary class
"com.solarmetric.kodo.impl.jdbc.schema.dict.InterbaseDictionary" to
connect to "Firebird" (version "__WI-V6.2.972 Firebird 1.0.3)WI-V6.2.972
Firebird 1.0.3/tcp (annm)/P10") with JDBC driver "firebirdsql jca/jdbc
resource adapter" (version "0.1")
4032 [main] INFO jdbc.JDBC - [ C:25657668; T:19356985; D:10268916 ] open:
jdbc:firebirdsql:localhost/3050:D:/An/test/temp.gdb (sysdba)
4143 [main] INFO jdbc.SQL - [ C:25657668; T:19356985; D:10268916 ]
preparing statement <3098834>: INSERT INTO XREF(PERSON, PROJECT) VALUES
4224 [main] INFO jdbc.SQL - [ C:25657668; T:19356985; D:10268916 ]
executing statement <3098834>: [reused=1;params={(int)1,(int)1}]
4244 [main] INFO jdbc.SQL - [ C:25657668; T:19356985; D:10268916 ]
preparing statement <9090824>: INSERT INTO PERSON(MGR, NAME, PK, SSNUM)
VALUES (?, ?, ?, ?)
4315 [main] INFO jdbc.SQL - [ C:25657668; T:19356985; D:10268916 ]
executing statement <9090824>: [reused=1;params={null,null,(int)1,(int)0}]
4598 [main] WARN jdbc.JDBC - java.sql.SQLWarning: java.sql.SQLWarning:
resultSetType or resultSetConcurrency changed
4598 [main] WARN jdbc.JDBC - java.sql.SQLWarning: java.sql.SQLWarning:
resultSetType or resultSetConcurrency changed
4598 [main] INFO jdbc.JDBC - [ C:25657668; T:19356985; D:10268916 ] begin
rollback
4608 [main] INFO jdbc.JDBC - [ C:25657668; T:19356985; D:10268916 ] end
rollback 10ms
4628 [main] INFO jdbc.JDBC - [ C:25657668; T:19356985; D:10268916 ]
close:
com.solarmetric.datasource.PoolConnection@1878144[[requests=2;size=2;max=70;hits=0;created=2;redundant=0;overflow=0;new=2;leaked=0;unavailable=0]]
4628 [main] INFO jdbc.JDBC - [ C:25657668; T:19356985; D:10268916 ] close
connection
javax.jdo.JDOFatalDataStoreException:
com.solarmetric.kodo.impl.jdbc.sql.SQLExceptionWrapper:
[SQL=INSERT INTO PERSON(MGR, NAME, PK, SSNUM) VALUES (null, null, 1, 0)]
[PRE=INSERT INTO PERSON(MGR, NAME, PK, SSNUM) VALUES (?, ?, ?, ?)]
GDS Exception. violation of PRIMARY or UNIQUE KEY constraint "PK_PERSON"
on table "PERSON" [code=335544665;state=null]
NestedThrowables:
com.solarmetric.kodo.impl.jdbc.sql.SQLExceptionWrapper:
[SQL=INSERT INTO PERSON(MGR, NAME, PK, SSNUM) VALUES (null, null, 1, 0)]
[PRE=INSERT INTO PERSON(MGR, NAME, PK, SSNUM) VALUES (?, ?, ?, ?)]
GDS Exception. violation of PRIMARY or UNIQUE KEY constraint "PK_PERSON"
on table "PERSON"
at
com.solarmetric.kodo.impl.jdbc.runtime.SQLExceptions.throwFatal(SQLExceptions.java:17)
at
com.solarmetric.kodo.impl.jdbc.runtime.JDBCStoreManager.flush(JDBCStoreManager.java:416)
at
com.solarmetric.kodo.runtime.PersistenceManagerImpl.flush(PersistenceManagerImpl.java:575)
at
com.solarmetric.kodo.runtime.PersistenceManagerImpl.commit(PersistenceManagerImpl.java:438)
at reversetutorial.Finder.createData(Finder.java:74)
at reversetutorial.Finder.main(Finder.java:141)
NestedThrowablesStackTrace:
org.firebirdsql.jdbc.FBSQLException: GDS Exception. violation of PRIMARY
or UNIQUE KEY constraint "PK_PERSON" on table "PERSON"
at
org.firebirdsql.jdbc.FBPreparedStatement.internalExecute(FBPreparedStatement.java:425)
at
org.firebirdsql.jdbc.FBPreparedStatement.executeUpdate(FBPreparedStatement.java:136)
at
com.solarmetric.datasource.PreparedStatementWrapper.executeUpdate(PreparedStatementWrapper.java:111)
at
com.solarmetric.kodo.impl.jdbc.SQLExecutionManagerImpl.executePreparedStatementNonBatch(SQLExecutionManagerImpl.java:542)
at
com.solarmetric.kodo.impl.jdbc.SQLExecutionManagerImpl.executePreparedStatement(SQLExecutionManagerImpl.java:511
at
com.solarmetric.kodo.impl.jdbc.SQLExecutionManagerImpl.executeInternal(SQLExecutionManagerImpl.java:405)
at
com.solarmetric.kodo.impl.jdbc.SQLExecutionManagerImpl.flush(SQLExecutionManagerImpl.java:272
at
com.solarmetric.kodo.impl.jdbc.runtime.JDBCStoreManager.flush(JDBCStoreManager.java:411)
at
com.solarmetric.kodo.runtime.PersistenceManagerImpl.flush(PersistenceManagerImpl.java:575)
at
com.solarmetric.kodo.runtime.PersistenceManagerImpl.commit(PersistenceManagerImpl.java:438)
at reversetutorial.Finder.createData(Finder.java:74)
at reversetutorial.Finder.main(Finder.java:141)
at org.firebirdsql.gds.GDSException: violation of PRIMARY or UNIQUE KEY
constraint "PK_PERSON" on table "PERSON
at org.firebirdsql.jgds.GDS_Impl.readStatusVector(GDS_Impl.java:1683)
at org.firebirdsql.jgds.GDS_Impl.receiveResponse(GDS_Impl.java:1636)
at org.firebirdsql.jgds.GDS_Impl.isc_dsql_execute2(GDS_Impl.java:865)
at
org.firebirdsql.jca.FBManagedConnection.executeStatement(FBManagedConnection.java:782)
at
org.firebirdsql.jdbc.FBConnection.executeStatement(FBConnection.java:1072)
at
org.firebirdsql.jdbc.FBPreparedStatement.internalExecute(FBPreparedStatement.java:420)
at
org.firebirdsql.jdbc.FBPreparedStatement.executeUpdate(FBPreparedStatement.java:136)
at
com.solarmetric.datasource.PreparedStatementWrapper.executeUpdate(PreparedStatementWrapper.java:111)
at
com.solarmetric.kodo.impl.jdbc.SQLExecutionManagerImpl.executePreparedStatementNonBatch(SQLExecutionManagerImpl.java:542)
at
com.solarmetric.kodo.impl.jdbc.SQLExecutionManagerImpl.executePreparedStatement(SQLExecutionManagerImpl.java:511)
at
com.solarmetric.kodo.impl.jdbc.SQLExecutionManagerImpl.executeInternal(SQLExecutionManagerImpl.java:405)
at
com.solarmetric.kodo.impl.jdbc.SQLExecutionManagerImpl.flush(SQLExecutionManagerImpl.java:272)
at
com.solarmetric.kodo.impl.jdbc.runtime.JDBCStoreManager.flush(JDBCStoreManager.java:411)
at
com.solarmetric.kodo.runtime.PersistenceManagerImpl.flush(PersistenceManagerImpl.java:575)
at
com.solarmetric.kodo.runtime.PersistenceManagerImpl.commit(PersistenceManagerImpl.java:438)
at reversetutorial.Finder.createData(Finder.java:74)
at reversetutorial.Finder.main(Finder.java:141)
Exception in thread "main"First off, use the '-primaryKeyOnJoin true' flag when running the reverse
mapping tool so that you can get rid of that useless Xref class and have
a direct relation between Person and Project. See the documentation on
reverse mapping tool options here:
http://www.solarmetric.com/Software/Documentation/latest/docs/ref_guide_pc_reverse.html
But your real problem is that you are creating new objects, assigning
primary key values, and expecting them to represent existing objects.
That's not the way JDO works. If you want to set relations to existing
objects in JDO, you use the PM to look up those objects. If you try to
create new objects, JDO will assume you want to insert new records into
the DB, and you'll get PK conflicts like you see here.
There are several good books out on JDO; if you're just starting out with
it, they might save you a lot of time and help you master JDO quickly.
Maybe you are looking for
-
HT204053 can I have multiple icloud accounts for one apple id?
I have multiple people in my family using our original apple id . As they have gotten iphones, macbooks, etc they register there devices under our originale apple id. over the holidays when my youngest child got her ipod touch and registered it for
-
How can I stop Safari reloading web pages every time?
When I am using Safari on my iPad I frequently want to jump between web pages or between the internet and other applications. This is simple on my laptop as once I have loaded a page it does not require reloading until I ask it to, but on my iPad I
-
Problem accessing e.book with the adobe log in details
Hi I bought an ebook. I downloaded it onto a laptop. I had access t o it no problems. I had a problem with the laptop and I had to change. I am having a problem opening the same book on the new one it is giving me the following error if I log in my A
-
My iPad reads in Hebrew instead of in Norwegian, even though I have not set my preferences to do so, how do I get it to read in Norwegian again?
-
Why do online videos only play for 5 seconds??
I have ie version 8 win xp,sp 3..I have uninstalled and reinstalled flash player...but it doesn't show up in my add-ons list?? when I try to install flash player,,I click on download,that goes through,,then i click on next,after making my choice abou