Hi Luis,
luis molina wrote:
i said time ago that the problem with that wizard was that only one table
can be used, now i see for the post, (now i cant try it) that can be used
two tables, well , i would like to use the wizard several times in the same
project, the only thing you have to do its not create the project, i mean in
a project theres not only one master table an only one detail table, could
be more, please ...;)
I know what you mean. I'd like to port our terminal-based application to Java, using NetBeans as the
design tool. It's the diagnostic labs portion of a medical records system - one master-detail form per
project certainly wouldn't be workable!
For our little team this is a "community acceptance" issue. The question is whether we can use NetBeans
for this type of design, or if that level of functionality is still a release or two off.
There does seem to be a way to create other database forms, including master-detail, in the same
project and package. If you right-click on the package in the Projects window, and choose New > Other
you can create a "Swing GUI Form" with the sub-type of "Master Detail Sample Form". The dialog is almost
like running the wizard, except the result is a simple form with its own main() method. (The project wizard,
by comparison, creates a view/app pair, where the main method resides in the app.) The form has no top
menu bar or bottom status bar. (It also doesn't show the detail when you press the New detail record
button).
I tried to do this as master-detail using the same two tables (BOOK and AUTHOR).
It gets created fine, but when you run the form it generates an exception:
Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException:
An exception occured while creating a query in EntityManager at
oracle.toplink.essentials.internal.ejb.cmp3.EntityManagerImpl.createQuery(EntityManagerImpl.java:209)
A single table version based on AUTHOR alone seems to run normally.
I finally created two different tables, and successfully created a master-detail form that runs using them.
Publisher is the master, and Editor is the detail.
CREATE TABLE PUBLISHER
(
PUBLISHER_ID INT NOT NULL,
COMPANYNAME VARCHAR(200) NOT NULL,
PRIMARY KEY (PUBLISHER_ID)
);
CREATE TABLE EDITOR
(
EDITOR_ID INT NOT NULL,
FIRSTNAME VARCHAR(200) NOT NULL,
SURNAME VARCHAR(200) NOT NULL,
PUBLISHER_INH INT,
FOREIGN KEY (PUBLISHER_INH) REFERENCES PUBLISHER (PUBLISHER_ID),
PRIMARY KEY (EDITOR_ID)
);
The new form runs normally, and seems to be able to exist in the same package.
I don't pretend to know yet what all the non-obvious differences are.
But there is a way to create more than one database form in a package.
Regards,
Robert