This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
getAsString method has errors if the Entity has a primary key class complaining it has no setter methods. Here's the generated comment in the code: // TODO: no setter methods were found in your primary key class // persistence.XincoAddAttributePK // and therefore getAsString() method could not be pre-generated. Will attach project for review.
Created attachment 100545 [details] Sample Project
to reproduce: 1) create a new Web Application, GF v3.0.1, Java EE 6 Web 2) generate Entity Classes from jdbc/sample database for all tables 3) generate JSF Pages from Entity Classes for all the entities ERROR: LCustController.java is uncompilable. The problem is L_CUST view table which does not have a primary key. IMHO we should not generate the JSF Pages for entities like this.
(In reply to comment #2) > to reproduce: > 1) create a new Web Application, GF v3.0.1, Java EE 6 Web > 2) generate Entity Classes from jdbc/sample database for all tables > 3) generate JSF Pages from Entity Classes for all the entities > ERROR: LCustController.java is uncompilable. The problem is L_CUST view table > which does not have a primary key. IMHO we should not generate the JSF Pages > for entities like this. Martin I don't see L_CUST view table in GF 3.0.1, and Entity classes wizard will not allow you to create entity classes for tables without Primary Key. According to sample project submitted by reporter, there was wrongly generated code, which is not reproducible on the recent builds. Mark as INCOMPLETE for now.
In fact the wizard allows to create entity classes for tables without Primary Key. But there is a warning: 'You will likely need to specify Entity IDs for selected views (hint can be used).' And the generated LCust.java is compilable but there is a warning: 'There is not ID defined for this entity hierarchy'. So the JSF wizard should refuse to generate the JSF Pages for entity classes without IDs.
to reproduce 2: --------------- 1) open the attached WebApplication69 project 2) generate JSF Pages from Entity Classes for all the entities ERROR: LCustController.java is uncompilable.
Created attachment 101374 [details] WebApplication69 sample project
I'm not able to create JSF Pages with the attached project since since there is no any entities available in the wizard. What build you are using? Could you provide the structure of the table? Attached screenshot of the wizard with table with no primary key.
Created attachment 101406 [details] screen
You are right, you cannot create entity classes for tables without Primary Key. But you can for VIEWS. Try to create 'CUST_VIEW' for 'SELECT * FROM CUSTOMER' QUERY. It does not have a primary key but you can generate entity class for it. I'm using trunk dev builds now: 201008130001.
If I remember right there is a warning for views and also some TODO in generated code, in my opinion problems are expected and user is warned for the case if no updates for entities was done after generation. But it may be good to handle absence of primary keys in jsf wizard.
reproduced, get UNDEFINED word instead of type. Discussed with Sergey, and agreed that it would be good to disable addition of the entity classes without IDs for JSF Pages generation in the wizard, reassigning, since entity classes collected in the Persistence module.
will try to block jsf/jsp pages creation from entities without pk. Initial logic for current implementation was not to block user as - user is warned at entity creation step - if user made no correction user will get uncompilable code instead of some compilable draft but with problem at runtime. compilation problems should bring user attention to the problem in attempt to fix/complete code, it's intended.
Integrated into 'main-golden', will be available in build *201008180001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main/rev/730f80b27b2d User: Sergey B. Petrov <sj-nb@netbeans.org> Log: fix #188281 just started, look for ui update to handle 'no pk' case
Integrated into 'main-golden', will be available in build *201008260001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main/rev/ab2c21ed9355 User: Sergey B. Petrov <sj-nb@netbeans.org> Log: fix #188281 - some api changes and additional dependency to get access to TypeElement from Entity
http://hg.netbeans.org/web-main/rev/1be1517638fd Generation of jsf pages shouldn't be possible to entities without id now. As there are a lot of chages it's good it's some time before release for testing/feedback.
Integrated into 'main-golden', will be available in build *201008270001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main/rev/cdca59a654dc User: Sergey B. Petrov <sj-nb@netbeans.org> Log: fix #188281 - additional cleanup for unused controller parameter