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.
NB 200606050200 daily build. JDK 1.5.0_06. WinXP. Wrong code is generated for Converter class when entity has composed primary key, leading to not compilable code. Sample (wrong) code: public Object getAsObject(FacesContext facesContext, UIComponent uIComponent, String string) { SomeEntityController controller = (SomeEntityController) facesContext.getApplication().getELResolver().getValue( facesContext.getELContext(), null, "somenEntityPredicativo"); br.com.brinfo.entity.SomeEntityPK id = (br.com.brinfo.entity.SomeEntityPK)string; return controller.findSomenEntity(id); } Compile error when trying to cast String to SomeEntityPK.
You are right, of course. I have a prototype of app for composed keys which I want to turn into the generator. For the Converter I have a simple solution like id.getA() + ":" + id.getB() - and then tokenize the String by ":" going back from String to object. But this will only work for IDs that do not have ":" in them. I could also add escaping for ":" (first replace : by ::), but this would add complexity to the generated code. Maybe if I add it only if the keys are String values it will be OK. Any opinion on this? What would you do if you wrote it? Thanks.
Well, your suggestion is almost what I've done actually Just I used "|/" (pipe and a bar) as separator, since it's a very odd combination. Could still cause problems (what could not in computer science?), but is less probable. Anyway, there is no easy solution. Another one is convert keys into a piece of XML, something like: <pkcol><[CDATA[Value1]]></pkcol><pkcol<[CDATA[Value2]]></pkcol and let XML libs deal with complexity encoding/decoding data... XML solution may not be faster as spliting strings, but will certain give no encoding errors, neither will add much complexity...
*** Issue 77703 has been marked as a duplicate of this issue. ***
I mark issue as fix-in-55 since we have a duplicate of this issue. This status whiteboard means issue shall be fixed in NetBeans 5.5.
*** This issue has been marked as a duplicate of 77732 ***
My mistake, this issue should be opened. The issue #77703 tracks a different bug.
*** Issue 77732 has been marked as a duplicate of this issue. ***
Many internal users reported this issue directly to me. It shows that many users face this bug in his project. Therefore, I'm changing priority to P2.
/cvs/web/jsf/src/org/netbeans/modules/web/jsf/palette/items/Attic/JsfForm.java,v new revision: 1.1.2.4.2.19; previous revision: 1.1.2.4.2.18 /cvs/web/jsf/src/org/netbeans/modules/web/jsf/palette/items/Attic/JsfTable.java,v new revision: 1.1.2.5.2.9; previous revision: 1.1.2.5.2.8 /cvs/web/jsf/src/org/netbeans/modules/web/jsf/wizards/Attic/JSFClinetGenerator.java,v new revision: 1.1.2.28; previous revision: 1.1.2.27 I've implemented the simple of converers (using ; as the delimiter) and some related changes needed to make one entity with complex PKs work. I removed the use of <f:param> for passing parameters between pages bcs converters are not used for f:param and replaced this mechanism w/JSF DataModel. I will test more scenarios with complex PKs as reported in issue 75688 and issue 76460.
VERIFIED