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.
Summary: | CRUD sample app does not work: NPE at org.netbeans.modules.crudsampleapplication.editor.EditorTopComponent$SaveCookieImpl.save(EditorTopComponent.java:344) | ||
---|---|---|---|
Product: | apisupport | Reporter: | Tomas Danek <musilt2> |
Component: | Maven | Assignee: | Martin Kozeny <mkozeny> |
Status: | VERIFIED FIXED | ||
Severity: | normal | CC: | jrechtacek, mmirilovic |
Priority: | P2 | ||
Version: | 7.3 | ||
Hardware: | PC | ||
OS: | Mac OS X | ||
Issue Type: | DEFECT | Exception Reporter: |
Description
Tomas Danek
2012-12-12 15:36:40 UTC
increasing to p2, since samples should work in FCS. NPE indicates that 'customer' is null on line 344, can be workarounded by invoking 'New' action prior filling data and saving. However, even after that sample does not work; getting exception indicating bad insert into db: Local Exception Stack: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.0.0.v20091127-r5931): org.eclipse.persistence.exceptions.DatabaseException Internal Exception: java.sql.SQLIntegrityConstraintViolationException: INSERT on table 'CUSTOMER' caused a violation of foreign key constraint 'FOREIGNKEY_ZIP' for key (12345). The statement has been rolled back. Error Code: -1 Call: INSERT INTO CUSTOMER (CUSTOMER_ID, ADDRESSLINE2, ZIP, PHONE, ADDRESSLINE1, FAX, EMAIL, NAME, STATE, CREDIT_LIMIT, CITY, DISCOUNT_CODE) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) bind => [864, null, 12345, null, null, null, null, ggg, null, null, hhh, H] Query: InsertObjectQuery(org.netbeans.modules.crudsampleapplication.dbaccess.Customer[customerId=864]) ... ... Easy (non-robust fix) is to modify EditorTopComponent:355 from customer.setZip("12345"); to e.g. customer.setZip("12347"); Better fix would be to invoke query on MICRO_MARKET table and pick first existing zip code value. Reproducible also with Ant CRUD Sample on Mac, Java 7 Update 10. https://hg.netbeans.org/core-main/rev/43149eaa41dd https://hg.netbeans.org/core-main/rev/4edeca848040 Integrated into 'main-golden', will be available in build *201301090001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-golden/rev/4edeca848040 User: Martin Kozeny <mkozeny@netbeans.org> Log: #223735: Problem was with foreign key used on customer's zip code. Bug was fixed by replacing of setting hard-coded zip code with selected zip code from database. verified, no NPE during save now. Product Version: NetBeans IDE 7.3 RC1 (Build 201301102100) 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: Mac OS X version 10.8.2 running on x86_64; US-ASCII; en_US (nb) User directory: /Users/tomas/Library/Application Support/NetBeans/7.3rc1 Cache directory: /Users/tomas/Library/Caches/NetBeans/7.3rc1 *** Bug 205783 has been marked as a duplicate of this bug. *** |