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 178611 - Controller unable to create class
Summary: Controller unable to create class
Status: RESOLVED WONTFIX
Alias: None
Product: javaee
Classification: Unclassified
Component: Persistence (show other bugs)
Version: 6.x
Hardware: All All
: P3 normal (vote)
Assignee: Sergey Petrov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-12-14 09:38 UTC by javydreamercsw
Modified: 2016-07-07 08:52 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments
Test project (6.33 MB, application/x-zip-compressed)
2009-12-14 09:38 UTC, javydreamercsw
Details

Note You need to log in before you can comment on or make changes to this bug.
Description javydreamercsw 2009-12-14 09:38:59 UTC
Created attachment 92548 [details]
Test project

If an entity has related entities (stored in an ArrayList) assigning new instances of such entities creates a javax.persistence.EntityNotFoundException. For some reason the controller class tries to get a reference on the new entity which doesn't exist yet.

Open the attached project and run the TestProjectTest jUnit test. You'll need to create the MySQL database (look for the script in the DB folder)
Comment 1 javydreamercsw 2009-12-14 09:42:28 UTC
Basically I'm trying to create Entity A by assigning values to those arrays

a.setEntityArray(new Array of new entities);

Expecting that those would be created as well but the controller code tries to retrieve those from the database.
Comment 2 Sergey Petrov 2009-12-14 10:17:18 UTC
haven't tried the project yet.
is it runtime problem or problem with generated code? May it be eclipselink problem?
Comment 3 javydreamercsw 2009-12-16 08:45:57 UTC
Am I assuming correct?

a.setEntityArray(new Array of new entities);

Should create the new entities passed as parameters? If I pass existing entities it works fine.

Fixing the code to work based on my assumption requires lots of changes probably including other controllers and I think that each controller should stand on its own.
Comment 4 javydreamercsw 2009-12-16 09:11:30 UTC
I came across issue #178740 working on this issue.
Comment 5 Sergey Petrov 2009-12-16 09:18:50 UTC
if you are right it may be consider as unsupported usecase, but before I'll be sure will keep it as a defect.
looking at controller code I see controller tries to find each entity from array and initially passes entities are used just as id parameters.
regarding creation or node it may be dependent of cascade specification, also lazy fetch may affect.
Comment 6 Sergey Petrov 2010-04-14 14:05:51 UTC
Ok, now I see it as next, controller is created to handle creation of specific, and do not handle if some required references are not yet persisted as it should be persisted with another controllers. But may be something may be improved here, may be some more clear message, move to enhancement for now.
Feel free to update if you see it as a defect.
Comment 7 javydreamercsw 2010-09-27 15:57:40 UTC
Having one controller "use" another would breck their stand alone approach for sure. Probably a better error message needs to be provided to the user prompting him/her to create the entities before adding them.
Comment 8 Martin Balin 2016-07-07 08:52:57 UTC
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