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.

Bug 76457 - [55cat] "JSF Pages from Entity Class" generates wrong codes when primary key is SMALLINT
Summary: [55cat] "JSF Pages from Entity Class" generates wrong codes when primary key ...
Status: VERIFIED FIXED
Alias: None
Product: javaee
Classification: Unclassified
Component: JSF (show other bugs)
Version: 5.x
Hardware: PC Windows XP
: P2 blocker (vote)
Assignee: Pavel Buzek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-05-17 00:49 UTC by Masaki Katakai
Modified: 2006-05-22 15:12 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Masaki Katakai 2006-05-17 00:49:59 UTC
[ JDK VERSION : 1.5.0_06 ]

NetBeans 5.5 Beta + Enterprise Pack
Windows XP
JDK1.5.0_06

1. In Java DB, Create a table that has primary key as "SMALLINT", another row is also "SMALLINT" 
2. Create a Web application project
3. Create Entity class by "Persistence->Entity Classes from Database", use the table
4. Create Persistence Unit for it
5. Create JSF Pages from Entity Class, select the Entity class

Now we have "<tablename>Controller.java" and "<tablename>Converer.java" in source directory,
these two files contain these codes blow, but it can not compile it by error,

    public Object getAsObject(FacesContext facesContext, UIComponent uIComponent, String string) {
        MytableController controller = (MytableController) facesContext.getApplication().getELResolver().getValue(
            facesContext.getELContext(), null, "mytable");
        java.lang.Short id = (java.lang.Short)string;
        return controller.findMytable(id);
    }

    public Mytable getMytableFromRequestParam() {
        ExternalContext ec = FacesContext.getCurrentInstance().getExternalContext();
        HttpServletRequest request = (HttpServletRequest)ec.getRequest();
        String param = request.getParameter("key");
        java.lang.Short id = (java.lang.Short)param;
        return em.find(Mytable.class, id);
    }

The compile error happens in

        java.lang.Short id = (java.lang.Short)string;
Comment 1 Pavel Buzek 2006-05-19 16:52:57 UTC
I added support for all numeric types in java.lang and for all primitive types
(I hope).

Checking in src/org/netbeans/modules/web/jsf/wizards/JSFClinetGenerator.java;
/cvs/web/jsf/src/org/netbeans/modules/web/jsf/wizards/Attic/JSFClinetGenerator.java,v
 <--  JSFClinetGenerator.java
new revision: 1.1.2.17; previous revision: 1.1.2.16
done
Comment 2 Masaki Katakai 2006-05-22 15:12:23 UTC
Thanks!

I've verified the fix on 200605220200 Windows.