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: | Controller unable to create class | ||
---|---|---|---|
Product: | javaee | Reporter: | javydreamercsw <javydreamercsw> |
Component: | Persistence | Assignee: | Sergey Petrov <sj-nb> |
Status: | RESOLVED WONTFIX | ||
Severity: | normal | ||
Priority: | P3 | ||
Version: | 6.x | ||
Hardware: | All | ||
OS: | All | ||
Issue Type: | ENHANCEMENT | Exception Reporter: | |
Attachments: | Test project |
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. haven't tried the project yet. is it runtime problem or problem with generated code? May it be eclipselink problem? 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. I came across issue #178740 working on this issue. 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. 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. 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. 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 |
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)