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 155972

Summary: RESTful Wizard generates code that will not compile
Product: webservices Reporter: nthompson <nthompson>
Component: RESTAssignee: Milan Kuchtiak <mkuchtiak>
Status: VERIFIED FIXED    
Severity: blocker CC: rbalada
Priority: P3    
Version: 6.x   
Hardware: All   
OS: Windows Vista   
Issue Type: DEFECT Exception Reporter:
Attachments: Zip file containing three NetBeans 6.5 projects to demonstrate problem.

Description nthompson 2008-12-23 03:11:54 UTC
The RESTful Web Service from Entity Classes Wizard was being used against a Derby database table that employs a 
composite primary key. When the entity classes are contained within the same NetBeans project as the RESTful web 
service classes, the project build successfully and rund correctly. When the entity classes are in a linked project's 
jar file, then the composite key is not handled properly and the generated RESTful web service code will not compile.
Comment 1 nthompson 2008-12-23 04:21:24 UTC
Created attachment 75260 [details]
Zip file containing three NetBeans 6.5 projects to demonstrate problem.
Comment 2 nthompson 2008-12-23 17:43:49 UTC
Here is the AircraftConverter constructor code from the RestServerWithoutEntityClasses project. It fails to compile. In
this case the entity classes are located in an external jar file (in the RestServerWithoutEntityClasses project).

public AircraftConverter(Aircraft entity, URI uri, int expandLevel, boolean isUriExtendable) {
this.entity = entity;
this.uri = (isUriExtendable) ? UriBuilder.fromUri(uri).path(entity.getAircraftPK().getAircraftPK() + "," +
entity.getAircraftPK().getManufacturer() + "," + entity.getAircraftPK().getType() + "," +
entity.getAircraftPK().getModel() + "/").build() : uri;
this.expandLevel = expandLevel;
}

The following is the AircraftConverter constructor code from the RestServerWithEntityClasses project. This is the case
where the entity classes are located in the same project as the RESTful web service classes. This example compiles
correctly.

public AircraftConverter(Aircraft entity, URI uri, int expandLevel, boolean isUriExtendable) {
this.entity = entity;
this.uri = (isUriExtendable) ? UriBuilder.fromUri(uri).path(entity.getAircraftPK().getOperatorIcaoCode() + "," +
entity.getAircraftPK().getTailNumber() + "/").build() : uri;
this.expandLevel = expandLevel;
}

As previously mentioned, if the primary key is removed from the database table design, then this problem disappears. It
is possible to place the entity classes in an external jar file and use the "RESTful Web Services from Entity Classes"
wizard to generate the code.
Comment 3 Milan Kuchtiak 2010-05-19 15:51:33 UTC
The issue is still valid.
Comment 4 Milan Kuchtiak 2010-05-24 15:51:09 UTC
Fixed:
http://hg.netbeans.org/main/rev/7d1664cf1fdd
Comment 5 Quality Engineering 2010-05-26 07:19:57 UTC
Integrated into 'main-golden', will be available in build *201005260001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/7d1664cf1fdd
User: mkuchtiak@netbeans.org
Log: #155972: fixed problem with fields for Primary keys
Comment 6 Jaroslav Pospisil 2010-06-24 14:17:08 UTC
v.
Comment 7 rbalada 2010-06-24 21:05:09 UTC
main #7d1664cf1fdd transplanted to release691 #419c6ba3e06d