NetBeans Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
  

Detail Table with composite primary key

 
Post new topic   Reply to topic    NetBeans Forums -> NetBeans Users
View previous topic :: View next topic  
Author Message
Sasha Shams



Joined: 29 Mar 2012
Posts: 6

PostPosted: Fri Mar 30, 2012 8:49 pm    Post subject: Detail Table with composite primary key Reply with quote

I am working on a project with MySQL database Java GUI.

This is my SQL script CREATE TABLE takenservice ( ResvID INT UNSIGNED NOT
NULL, ServID INT UNSIGNED DEFAULT 0 NOT NULL, ServUsedDate DATETIME NOT NULL
, PayStat VARCHAR(6) DEFAULT Unpaid NOT NULL, ServRecBy VARCHAR(7) NOT NULL,
PayRecBy VARCHAR(7), Quantity SMALLINT DEFAULT 1 NOT NULL, PRIMARY KEY
(ResvID, ServID, ServUsedDate)); Alter table takenservice add constraint
foreign key (ResvId) references reservation (ResvID); Alter table
takenservice add constraint foreign key (ResvId) references reservation
(ResvID);

I created the entity classes with Netbeans 7.0 and created 4 classes:

Service Reservation ServiceTaken ServiceTakenPK

but I cant enter values to the table and it gives me an error that I am
trying to enter null values in as primary keys.

I have found the bug actually in Netbeans forum which is
http://netbeans.org/bugzilla/show_bug.cgi?id=105084.

and accordingly I have added the following methods to the class ServiceTaken

public int getResvID() {
return takenservicePK.resvID;
}

public int getServID() {
return takenservicePK.servID;
}

public Date getServUsedDate() {
return takenservicePK.servUsedDate;
upon inserting a new entry in the table I get this error :

Error Code: 1048 Call: INSERT INTO takenservice (PayRecBy, ServRecBy,
Quantity, PayStat, ServUsedDate, ResvID, ServID) VALUES (?, ?, ?, ?, ?, ?,
?) bind => [ddd, ddd, 0, ddd, null, null, null]

What I can do to fix this ? Please help me with this I am running out of
time =/

--
View this message in context: http://netbeans-org.1045718.n5.nabble.com/Detail-Table-with-composite-primary-key-tp5605659p5605659.html
Sent from the Netbeans IDE Users mailing list archive at Nabble.com.
Back to top
Sasha Shams



Joined: 29 Mar 2012
Posts: 6

PostPosted: Fri Mar 30, 2012 8:49 pm    Post subject: Detail Table with composite primary key Reply with quote

I am working on a project with MySQL database Java GUI.

This is my SQL script CREATE TABLE takenservice ( ResvID INT UNSIGNED NOT
NULL, ServID INT UNSIGNED DEFAULT 0 NOT NULL, ServUsedDate DATETIME NOT NULL
, PayStat VARCHAR(6) DEFAULT Unpaid NOT NULL, ServRecBy VARCHAR(7) NOT NULL,
PayRecBy VARCHAR(7), Quantity SMALLINT DEFAULT 1 NOT NULL, PRIMARY KEY
(ResvID, ServID, ServUsedDate)); Alter table takenservice add constraint
foreign key (ResvId) references reservation (ResvID); Alter table
takenservice add constraint foreign key (ResvId) references reservation
(ResvID);

I created the entity classes with Netbeans 7.0 and created 4 classes:

Service Reservation ServiceTaken ServiceTakenPK

but I cant enter values to the table and it gives me an error that I am
trying to enter null values in as primary keys.

I have found the bug actually in Netbeans forum which is
http://netbeans.org/bugzilla/show_bug.cgi?id=105084.

and accordingly I have added the following methods to the class ServiceTaken

public int getResvID() {
return takenservicePK.resvID;
}

public int getServID() {
return takenservicePK.servID;
}

public Date getServUsedDate() {
return takenservicePK.servUsedDate;
upon inserting a new entry in the table I get this error :

Error Code: 1048 Call: INSERT INTO takenservice (PayRecBy, ServRecBy,
Quantity, PayStat, ServUsedDate, ResvID, ServID) VALUES (?, ?, ?, ?, ?, ?,
?) bind => [ddd, ddd, 0, ddd, null, null, null]

What I can do to fix this ? Please help me with this I am running out of
time =/

--
View this message in context: http://netbeans-org.1045718.n5.nabble.com/Detail-Table-with-composite-primary-key-tp5605660p5605660.html
Sent from the Netbeans IDE Users mailing list archive at Nabble.com.
Back to top
Javier Ortiz
Posted via mailing list.





PostPosted: Fri Mar 30, 2012 9:04 pm    Post subject: Detail Table with composite primary key Reply with quote

Still we need to see the code used to create the entities.



Senior Software Quality Engineer
ArthroCare Corporation
7000 William Cannon Drive
Austin, TX 78735
Phone: 512-358-5996
email: address-removed


-----Original Message-----
From: Sasha Shams [mailto:address-removed]
Sent: Thursday, March 29, 2012 11:24 PM
To: address-removed
Subject: [nbusers] Detail Table with composite primary key

I am working on a project with MySQL database Java GUI.

This is my SQL script CREATE TABLE takenservice ( ResvID INT UNSIGNED NOT NULL, ServID INT UNSIGNED DEFAULT 0 NOT NULL, ServUsedDate DATETIME NOT NULL , PayStat VARCHAR(6) DEFAULT Unpaid NOT NULL, ServRecBy VARCHAR(7) NOT NULL, PayRecBy VARCHAR(7), Quantity SMALLINT DEFAULT 1 NOT NULL, PRIMARY KEY (ResvID, ServID, ServUsedDate)); Alter table takenservice add constraint foreign key (ResvId) references reservation (ResvID); Alter table takenservice add constraint foreign key (ResvId) references reservation (ResvID);

I created the entity classes with Netbeans 7.0 and created 4 classes:

Service Reservation ServiceTaken ServiceTakenPK

but I cant enter values to the table and it gives me an error that I am trying to enter null values in as primary keys.

I have found the bug actually in Netbeans forum which is http://netbeans.org/bugzilla/show_bug.cgi?id=105084.

and accordingly I have added the following methods to the class ServiceTaken

public int getResvID() {
return takenservicePK.resvID;
}

public int getServID() {
return takenservicePK.servID;
}

public Date getServUsedDate() {
return takenservicePK.servUsedDate;
upon inserting a new entry in the table I get this error :

Error Code: 1048 Call: INSERT INTO takenservice (PayRecBy, ServRecBy, Quantity, PayStat, ServUsedDate, ResvID, ServID) VALUES (?, ?, ?, ?, ?, ?,
?) bind => [ddd, ddd, 0, ddd, null, null, null]

What I can do to fix this ? Please help me with this I am running out of time =/

--
View this message in context: http://netbeans-org.1045718.n5.nabble.com/Detail-Table-with-composite-primary-key-tp5605660p5605660.html
Sent from the Netbeans IDE Users mailing list archive at Nabble.com.
**********

The information contained in this e-mail message, together with any
attachments thereto, is intended only for the personal and confidential
use of the addressee named above. The message and the attachments
are or may be privileged or protected communication. If you are not the
intended recipient of this message, or authorized to receive it for the
intended recipient, you have received this message in error, and you
are not to review, use, disseminate, distribute or copy this message,
any attachments thereto, or their contents. If you have received this
message in error, please immediately notify us by return e-mail
message, and delete the original message.

Pursuant to Circular 230 issued by the United States Treasury
Department and relating to practice before the Internal Revenue
Services, any comment or opinion in this communication relating to a
federal tax issue is not intended to be used, and cannot be used, by a
taxpayer for the purpose of avoiding tax-related penalties that may be
imposed on the taxpayer.
Back to top
Sasha Shams



Joined: 29 Mar 2012
Posts: 6

PostPosted: Fri Mar 30, 2012 9:19 pm    Post subject: Detail Table with composite primary key Reply with quote

This is my SQL script
Back to top
Sasha Shams



Joined: 29 Mar 2012
Posts: 6

PostPosted: Mon Apr 02, 2012 10:21 pm    Post subject: Detail Table with composite primary key Reply with quote

Any updates on this ?! Your suggestions are highly appreciated.
Back to top
bolsover



Joined: 24 Jun 2010
Posts: 185

PostPosted: Tue Apr 03, 2012 2:56 pm    Post subject: Reply with quote

Looks like you are attempting to bind null values to fields that are declared NOT NULL...

Error Code: 1048 Call: INSERT INTO takenservice (PayRecBy, ServRecBy,
Quantity, PayStat, ServUsedDate, ResvID, ServID) VALUES (?, ?, ?, ?, ?, ?,
?) bind => [ddd, ddd, 0, ddd, null, null, null]

From your create table, I take it that ServUsedDate, ResvID, ServID are all declared NOT NULL.

db
Back to top
Sasha Shams



Joined: 29 Mar 2012
Posts: 6

PostPosted: Tue Apr 03, 2012 11:35 pm    Post subject: Detail Table with composite primary key Reply with quote

yes, I have found that the cause of the problem is that I have composite primary keys and the "master/detail form" which was created by Netbeans does not support this.

It was
Back to top
Display posts from previous:   
Post new topic   Reply to topic    NetBeans Forums -> NetBeans Users All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo