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.
Customer Database (Java EE 5) sample (and Customer Database on Spring as well) does not show any data because of recent changes in web services. To reproduce: - open new project wizard - choose "Samples|Web Services|REST: Customer Database (Java EE 5)" - finish wizard - run project and confirm Jersey configuration as offered (server library, webresources path) - index page is opened but it shows no data IMO there are two problems: - it needs to replace http://localhost:8080/CustomerDB/resources by http://localhost:8080/CustomerDB/webresources in all javascript files - usage of '@uri' in javascript needs to be revised because for me it returns JSON response without this field. For example http://localhost:8080/CustomerDB/webresources/customerdb.customer/2 {"addressline1":"9754 Main Street","addressline2":"P.O. Box 567","city":"Miami","creditLimit":"50000","customerId":"2","discountCode":{"discountCode":"77","rate":"11.00"},"email":"www.new.example.com","fax":"305-555-0149","name":"New Enterprises","phone":"305-555-0148","state":"FL","zip":"95035"} Product Version: NetBeans IDE Dev (Build 201212120001) Java: 1.7.0_10; Java HotSpot(TM) 64-Bit Server VM 23.6-b04 Runtime: Java(TM) SE Runtime Environment 1.7.0_10-b18 System: Windows 7 version 6.1 running on amd64; Cp1250; en_US (nb)
web-main#13152d38d79f
Integrated into 'main-golden', will be available in build *201212140001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-golden/rev/13152d38d79f User: Denis Anisimov <ads@netbeans.org> Log: Fix for BZ#223718 - Customer Database sample does not work with data
Reopening because "Customer Database on Spring" sample still doesn't show any data. If I try "Test Resource URI" on "RESTful Web Services|CustomerRESTFacade" it fails and reason is [com.sun.istack.SAXException2: A cycle is detected in the object graph. This will cause infinitely deep XML: customerdb.Customer[customerId=2] -> customerdb.DiscountCode[discountCode=M] -> customerdb.Customer[customerId=2]] "Customer Database" sample shows data but it is not possible to create or edit data which is P3 problem IMO. It is because discountCode is from character (e.g. 'H') translated to ASCII value (e.g. 72) in web service response (http://localhost:8080/CustomerDB/webresources/customerdb.discountcode). And also there is mapping to MICRO_MARKET table through the ZIP column. I would recommend to rewrite both these samples to use just single table without references (e.g. MANUFACTURER) and use Java EE 6. At least in the next release.
(In reply to comment #3) > Reopening because "Customer Database on Spring" sample still doesn't show any > data. If I try "Test Resource URI" on "RESTful Web Services|CustomerRESTFacade" > it fails and reason is > [com.sun.istack.SAXException2: A cycle is detected in the object graph. This > will cause infinitely deep XML: customerdb.Customer[customerId=2] -> > customerdb.DiscountCode[discountCode=M] -> customerdb.Customer[customerId=2]] Right, Entity bean DiscountCode doesn't have @XmlTransient annotation. > > "Customer Database" sample shows data but it is not possible to create or edit > data which is P3 problem IMO. It is because discountCode is from character > (e.g. 'H') translated to ASCII value (e.g. 72) in web service response > (http://localhost:8080/CustomerDB/webresources/customerdb.discountcode). And > also there is mapping to MICRO_MARKET table through the ZIP column. I would > recommend to rewrite both these samples to use just single table without > references (e.g. MANUFACTURER) and use Java EE 6. At least in the next release. Discount code is an entity bean which is referenced from Customer. That's the issue (not character->ASCII translation). So created/updated Customer should reference to the *existing* DisountCode. Current UI state (JS code) designed badly: it doesn't allow to conform above requirement. There should be chooser for DiscountCode (f.e. "selection" element like ComboBox). I agree that samples has to be rewritten to avoid such references. I'm going to fix the issue with showing data for Spring case. The remaining issues should be fixed in the next release.
Fix for data showing in Spring sample. web-main#2c6c8661dc88 Samples have to be rewritten to get "update" and "create" working in the next release.
Thank you for the fix. I agree that update/create will be fixed in the next release.
Integrated into 'main-golden', will be available in build *201301100107* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-golden/rev/2c6c8661dc88 User: Denis Anisimov <ads@netbeans.org> Log: Fix for BZ#223718 - Customer Database sample does not work with data
IMO, the sample is still not working completely. The GET method works, but POST not. (Testing with GlassFish4) The JavaScript code looks quite obsolete. Would be fine to rewrite the code to some modern framework. e.g. AngularJS.
Rewritten to backbone library: hg.netbeans.org/web-main/rev/a40f98c28957 Still update, create doesn't work
Integrated into 'main-silver', will be available in build *201308062300* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-silver/rev/a40f98c28957 User: Milan Kuchtiak <mkuchtiak@netbeans.org> Log: #223718 sample rewritten to Backbone library
It would be worth to re-write the client to more RESTful AngularJS resources framework.
This old bug may not be relevant anymore. If you can still reproduce it in 8.2 development builds please reopen this issue. Thanks for your cooperation, NetBeans IDE 8.2 Release Boss