The prupose of this post is to save future, new SEAM users hours if not days.
Given what SEAM is and what it is capable of, the solution for someone with some relevant knowledge will probably take less time than it took to write this. In theory, a solution will take only a few minutes to develop, test and deploy.
I hope that a few of you will be able to quickly knock-up a full, working solution that meets the following very simple (but of a commonly occurring class of problem's) requirements ... or at least have a go so you can learn how to deal with the issues you may face.
Such an example, simple as it is, should help those wishing to evaluate SEAM.
See the schema below (all the sql runs in HSQLDB 18.104.22.168)
Create just 1 screen for creating records in MOLECULE with
1 - a drop-down list showing the ATOMs' PT_SYMBOLs
2 - a drop-down list showing the COMPOUNDs' NAMEs
3 - a text field for the QUANTITY
4 - a button to add the above values into the MOLECULE table
Please do not change the schema(below) and do not use JSPs if possible.
Provide a short note saying how long it took to design and develop your solution in SEAM and note where you had to make some tweaks to the OOTB behaviour of seam-gen or if you just hand-coded the whole lot.
Include all artefacts in your post - don't assume anything is obvious (especially to me).
Here's your schema:
CREATE TABLE ATOM ( ID_ BIGINT GENERATED BY DEFAULT AS IDENTITY(START WITH 1) NOT NULL PRIMARY KEY, PT_SYMBOL VARCHAR(3) ) CREATE TABLE COMPOUND ( ID_ BIGINT GENERATED BY DEFAULT AS IDENTITY(START WITH 1) NOT NULL PRIMARY KEY, NAME VARCHAR(10) ) CREATE TABLE MOLECULE( ATOM_ID BIGINT, COMPOUND_ID BIGINT, QUANTITY INTEGER, PRIMARY KEY(ATOM_ID,COMPOUND_ID), CONSTRAINT VALID_ATOM FOREIGN KEY (ATOM_ID) REFERENCES ATOM(ID_), CONSTRAINT VALID_COMPOUND FOREIGN KEY (COMPOUND_ID) REFERENCES COMPOUND(ID_) )
You can also add the following data in case empty tables cause you grief (if so, please say why)...
INSERT INTO ATOM (PT_SYMBOL) VALUES('H'); INSERT INTO ATOM (PT_SYMBOL) VALUES('O'); INSERT INTO COMPOUND (NAME) VALUES('Water'); INSERT INTO MOLECULE (ATOM_ID,COMPOUND_ID,QUANTITY) VALUES(1,1,2); INSERT INTO MOLECULE (ATOM_ID,COMPOUND_ID,QUANTITY) VALUES(2,1,1); INSERT INTO COMPOUND (NAME) VALUES('CarbonDioxide'); INSERT INTO ATOM (PT_SYMBOL) VALUES('C'); INSERT INTO MOLECULE (ATOM_ID,COMPOUND_ID,QUANTITY) VALUES(3,2,1); INSERT INTO MOLECULE (ATOM_ID,COMPOUND_ID,QUANTITY) VALUES(2,2,2);
Finally, this should give some sensible output (a sanity-check) before you start coding:
SELECT C.NAME, A.PT_SYMBOL,M.QUANTITY FROM ATOM A, COMPOUND C, MOLECULE M WHERE M.ATOM_ID = A.ID_ AND M.COMPOUND_ID = C.ID_