- This topic has 2 replies, 2 voices, and was last updated 11 years, 8 months ago by
christophec.
-
AuthorPosts
-
christophecMemberHi,
I’m having an issue with Spring MVC Scaffolding, dealing with multiple foreign keys.
Here, a part of the SQL code of the database I’m trying to scaffold :
CREATE TABLE conseiller (
conseiller_id INTEGER NOT NULL AUTO_INCREMENT,
nom VARCHAR(50) NOT NULL,
prenom VARCHAR(50) NOT NULL,
groupe_id INTEGER NOT NULL,
code_type_conseiller VARCHAR(10) NULL,
localisation_id INTEGER NULL,
CONSTRAINT conseiller_pk PRIMARY KEY ( conseiller_id )
)ENGINE=InnoDB DEFAULT CHARSET=utf8;CREATE TABLE type_conseiller (
code_type_conseiller VARCHAR(10) NOT NULL,
type_conseiller VARCHAR(50) NOT NULL,
CONSTRAINT type_conseiller_pk PRIMARY KEY ( code_type_conseiller )
)ENGINE=InnoDB DEFAULT CHARSET=utf8;CREATE TABLE localisation (
localisation_id INTEGER NOT NULL AUTO_INCREMENT,
nom_loc VARCHAR(50) NOT NULL,
groupe_id INTEGER NULL,
CONSTRAINT localisation_pk PRIMARY KEY ( localisation_id )
)ENGINE=InnoDB DEFAULT CHARSET=utf8;CREATE TABLE groupe (
groupe_id INTEGER NOT NULL AUTO_INCREMENT,
nom_groupe VARCHAR(50) NOT NULL,
responsable_id INTEGER NULL,
site_id INTEGER NULL,
CONSTRAINT groupe_pk PRIMARY KEY ( groupe_id )
)ENGINE=InnoDB DEFAULT CHARSET=utf8;ALTER TABLE conseiller ADD CONSTRAINT conseiller_fk_groupe FOREIGN KEY ( groupe_id ) REFERENCES groupe ( groupe_id );
ALTER TABLE conseiller ADD CONSTRAINT conseiller_fk_location FOREIGN KEY ( localisation_id ) REFERENCES localisation ( localisation_id );
ALTER TABLE conseiller ADD CONSTRAINT conseiller_fk_type FOREIGN KEY ( code_type_conseiller ) REFERENCES type_conseiller ( code_type_conseiller );
ALTER TABLE localisation ADD CONSTRAINT localisation_fk_groupe FOREIGN KEY ( groupe_id ) REFERENCES groupe ( groupe_id );
ALTER TABLE groupe ADD CONSTRAINT groupe_fk_conseiller FOREIGN KEY ( responsable_id ) REFERENCES conseiller ( conseiller_id );As you can see, it’s in french, so I’m will explain a little :
So I have an Advisor (Conseiller) who need a type (typeConseiller), a groupe, and a location (localisation). So I have some foreign keys.Here my problems :
The scaffolding seems works well, and when I see the views of one Advisor (Conseiller) I can see all the information I need.
But…
=> In the view of the list of all my advisor I can’t see the information which are foreign key.
=> In the view of the creation of a advisor, I can’t select a type, a groupe and a location, so I have error message when I click on create.
=> The same if I want to edit a advisor, I can’t edit the information relative to a foreign key.So my question : Is it normal? Or am I doing something wrong?
How can I deal with these foreign keys?I tried other scaffolding tools, and it created me combo list to select the information relative to foreign keys, but MyEclipse didn’t.
I hope you understand my problems, do note hesitate to ask question if you not.[/img]
support-swapnaModeratorchristophec,
Thank you for pointing it. I could replicate the issue at my end and I have filed a PR for the dev team to look into it.
I am afraid I do not have any workaround to suggest right away. I will post as soon as I have any information about it.
Sorry for inconvenience caused.
christophecMemberThank you for your answer,
Since my message, I’m looking into the template which is use to generate the code, and indeed I find nothing to deal with foreign keys like I want to.
I’m trying to add it by myself, but If you can add it by default it will be much appreciate!
In the same categories : When I display a view for an entity, I can view the detail of a foreign key attach wich is perfect! I can also edit the information about this foreign key, but not change it.
For example, If I have a advisor wich refer the groupe_id 1, I can see the name of the groupe, change it, but not change the groupe_id to make the advisor refer to the groupe_id 2.
I hope it’s understandable!
It’s the only issue that holding me to buy your product wich is quite interesting so far. (I have 3 days of evaluation left)
Thanks for your time!
-
AuthorPosts