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 220284 - JoinTable verification may warn if table is similar to JoinTable but is not
Summary: JoinTable verification may warn if table is similar to JoinTable but is not
Status: RESOLVED WONTFIX
Alias: None
Product: javaee
Classification: Unclassified
Component: Persistence (show other bugs)
Version: 7.2.1
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Sergey Petrov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-10-17 14:05 UTC by javydreamercsw
Modified: 2016-07-07 08:53 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments
IDE log (90.71 KB, text/plain)
2012-10-17 14:05 UTC, javydreamercsw
Details
MySQL script (69.50 KB, application/octet-stream)
2012-10-17 17:38 UTC, javydreamercsw
Details
Wizard step 1 (46.40 KB, image/png)
2012-11-08 23:25 UTC, javydreamercsw
Details
Wizard step 2 (40.78 KB, image/png)
2012-11-08 23:25 UTC, javydreamercsw
Details
Wizard step 3 (39.61 KB, image/png)
2012-11-08 23:26 UTC, javydreamercsw
Details
how it shoud be (9.13 KB, image/png)
2012-11-09 10:45 UTC, Sergey Petrov
Details
Requested schema (3.16 MB, application/octet-stream)
2012-11-09 14:51 UTC, javydreamercsw
Details
Updated script (69.62 KB, application/octet-stream)
2012-11-09 22:51 UTC, javydreamercsw
Details
Updated script (69.89 KB, application/octet-stream)
2012-11-14 14:42 UTC, javydreamercsw
Details
Updated script (69.89 KB, application/octet-stream)
2012-11-14 14:45 UTC, javydreamercsw
Details
Updated script (69.89 KB, application/octet-stream)
2012-11-14 18:05 UTC, javydreamercsw
Details
Schema (2.57 MB, application/octet-stream)
2012-11-14 18:07 UTC, javydreamercsw
Details

Note You need to log in before you can comment on or make changes to this bug.
Description javydreamercsw 2012-10-17 14:05:52 UTC
Product Version = NetBeans IDE 7.2 (Build 201207171143)
Operating System = Windows 7 version 6.1 running on x86
Java; VM; Vendor = 1.7.0_07
Runtime = Java HotSpot(TM) Client VM 23.3-b01


I get an error (the window shows blank, just OK button). Hopefully the log is useful. If needed I can provide the sources I'm using.
Comment 1 javydreamercsw 2012-10-17 14:05:56 UTC
Created attachment 126086 [details]
IDE log
Comment 2 Sergey Petrov 2012-10-17 14:42:21 UTC
yes, please provide some detail about entities, either way to create or code itself. it will help both for issue evaluation and for possible fix verification.
Comment 3 Sergey Petrov 2012-10-17 14:44:41 UTC
or just a link to sql script+which one entity to use.

I see com.sun.tools.javac.code.Symbol$CompletionFailure: class file for RiskControlHasRequirement not found in log, is it the one entity to try?
Comment 4 javydreamercsw 2012-10-17 17:38:37 UTC
Created attachment 126106 [details]
MySQL script

RiskControlHasRequirement is one of the ones I had issues with. See the attached SQL file. I was able to create those on build 201210170002
Comment 5 Sergey Petrov 2012-10-22 12:25:18 UTC
RiskControlHasRequirement is a join table and ide do not generate entity for this table, I can't try to generate jpa controller for RiskControlHasRequirement with attached script, are you sure sql is correct?
Comment 6 javydreamercsw 2012-10-22 13:17:05 UTC
Script is correct. Maybe that's part of the issue. It might have showed as an option in the wizard and had trouble at implementation time?
Comment 7 Sergey Petrov 2012-10-23 08:58:28 UTC
ok, I have similar problem for this schema and it's random for me and happens if generate a lot of controllers at once(for all entities).
but I can't reproduce initially reported because IDE do not allow to create RiskControlHasRequirement  and it's not listed later in controllers's wizard.
How this entity was generated?
Comment 8 Sergey Petrov 2012-10-29 13:14:23 UTC
can't reproduce in maven.web also as still can't create this entity and it's not shown in jpacontroller wizard as expected for absent entity. may you have this entity somewhere on classpath in your project dependencies?

do you have any simple steps from project creation up to controller generation, is it reproducible for you in new projects?
Comment 9 Sergey Petrov 2012-11-08 21:59:39 UTC
as one more attempt, can you provide full set of steps like
1. create new project {type} {name} with next {options}(frameworks, ee level etc) with next {server}/{no server}, {dependencies}
2. select some {node}, invoke entities from db, select {connection with what options?}?{datasource with what url/options?}
3. select {some}/all entities and step and step, {such} options in a {package}
how RiskControlHasRequirement  is shown in the wizard/sceenshots.
4. invoke JpaController wizard on a {node}
screen of entities selection panel, is there anything interesting, is there RiskControlHasRequirement, is there RiskControlHasRequirement  somewhere in the project, 
5. select what entities? is RiskControlHasRequirement selected? {package}, other possible ideas? and finish.

"the window shows blank," what window? exception dialog or a wizard or?

"I was able to create those on build 201210170002" is it about RiskControlHasRequirement entity, was it created even if it was shown as join or it wasn't shown as jin table?
Comment 10 javydreamercsw 2012-11-08 22:28:59 UTC
What I meant is that it worked fine with the build 201210170002 without making any changes to the source/project.

I'll try to recreate with a new project and provide your requested steps in a bit.
Comment 11 javydreamercsw 2012-11-08 23:23:48 UTC
1. create new project Maven Web Application Apache Tomcat Server Java EE 6 Web (Everything else is default)
2. select the default node (based on the values in the wizard), invoke entities from db, select validation manager connection (jdbc:mysql://localhost:3306/validation_manager?zeroDateTimeBehavior=convertToNull [root on Default schema]) as created by the IDE connecting from MySQL server.
3. select all entities, Collection type:List, everything else default (see pictures for details). Click Finish

Ran on issue on report 194794, issue 221773 at this point. Unable to proceed.

4. invoke JpaController wizard on the default node (based on the values in the wizard). 
5. Select all entities (See pictures for details). Click finish.

Will upload pictures in a bit.
Comment 12 javydreamercsw 2012-11-08 23:25:02 UTC
Created attachment 127432 [details]
Wizard step 1
Comment 13 javydreamercsw 2012-11-08 23:25:48 UTC
Created attachment 127433 [details]
Wizard step 2
Comment 14 javydreamercsw 2012-11-08 23:26:02 UTC
Created attachment 127435 [details]
Wizard step 3
Comment 15 javydreamercsw 2012-11-08 23:26:37 UTC
I'll try to repeat tomorrow. Time to go home now.
Comment 16 Sergey Petrov 2012-11-09 03:46:28 UTC
ok, thanks, the only problem if there was issue 221773 in between, it may cause also inconsistent state and other issues, in this case this one isnt independent and may not be an issue as tries to generate code on corrupted entities (may be).
Comment 17 Sergey Petrov 2012-11-09 09:16:04 UTC
From screenshots I see RiskControlHasRequirement  isn't recognized as join table and have 'new' generation option. in this case my comment above about inconsistent state isn't applied to the issue.
Can you generate RiskControlHasRequirement separately?
Comment 18 Sergey Petrov 2012-11-09 10:45:50 UTC
Created attachment 127451 [details]
how it shoud be

join table - have no class name and grayed. also it have 'new' option but it doesn't matter.
Comment 19 Sergey Petrov 2012-11-09 11:15:17 UTC
few more questions -
- do you use bundled mysql jdbc driver?
- what mysql version do you use?
- can you create and attach db schema?
Comment 20 javydreamercsw 2012-11-09 14:17:52 UTC
(In reply to comment #19)
> few more questions -
> - do you use bundled mysql jdbc driver?
Bundled
> - what mysql version do you use?
5.5.27 MySQL COmmunity Server
> - can you create and attach db schema?
Do you mean a NetBeans schema? If so, I will in a bit.

I'm downloading today's build to retry the creation and creating that one alone and see how it goes.
Comment 21 javydreamercsw 2012-11-09 14:21:27 UTC
(In reply to comment #18)
> Created attachment 127451 [details]
> how it should be
> 
> join table - have no class name and grayed. also it have 'new' option but it
> doesn't matter.
This is what I expected as well.
Comment 22 javydreamercsw 2012-11-09 14:36:42 UTC
Corrected NetBeans version.
Comment 23 javydreamercsw 2012-11-09 14:51:33 UTC
Created attachment 127480 [details]
Requested schema
Comment 24 javydreamercsw 2012-11-09 14:54:00 UTC
I was able to create RiskControlHasRequirement on its own.
Comment 25 Sergey Petrov 2012-11-09 20:55:22 UTC
I see attached sql contain no version for requienment in risk_control_has_requirenment and attached schema contain this part. It's important to have actual data in the issue if sql is obsolete.
It may be the issue, also attache schema contain  3 out of 4 columns in promary key for risk_control_has_requirenment, schema may not be solid.
It still may be another issue if persistence can or not to generate an entity in this case for this table.
Comment 26 javydreamercsw 2012-11-09 22:51:28 UTC
Created attachment 127516 [details]
Updated script

You were right about the missing version in that table. I looked at the MySQL workbench model and it was missing there as well. (This is a known bug for Workbench I already reported).

I fixed that and attached updated script.
Comment 27 Sergey Petrov 2012-11-14 10:45:35 UTC
with new script still have 'join column' for RiskControlHasRequirement RiskControlHasRequirement, and fk in generated schema are different, in attached above fk do not contain version properly and it's the case when RiskControlHasRequirement can't be considered as join table.
Comment 28 javydreamercsw 2012-11-14 14:42:15 UTC
Created attachment 127786 [details]
Updated script
Comment 29 javydreamercsw 2012-11-14 14:45:09 UTC
Created attachment 127787 [details]
Updated script

Updated script with that fix. I found another instance with the same type of issue. Hopefully is due to this errors in the design.

Should the creation check for this irregularities as well?
Comment 30 Sergey Petrov 2012-11-14 15:33:19 UTC
Schema validation may be a good option but is not an issue in my opinion(but depends on issues it may cause), currently schema is used as is.
Anyway is schema is wrong it's main reason, fail-save behaviour of persistence module is secondary issue and may be db should check consistency too and in first place it's hard to implement complex logic on any client if db allow some irregularity.

So what script should I use, tried latest one and still have join table, have you tried it?
Comment 31 Sergey Petrov 2012-11-14 16:20:25 UTC
have you tried to generate entities from attached schema and jpa controller later?
Just tried it, and RiskControlHasRequirement is generated(as expected in my opinion) and also I got JPAController for RiskControlHasRequirement  generated without any problems. 
I'm using latest daily, but it may not be the reason I can't reproduce the problem. Some information may be still missed, script/schema may not match properly or anything else.
Comment 32 javydreamercsw 2012-11-14 17:48:07 UTC
I'll update the attachments (script and schema) in a bit, specially obsoleting some of them.

I'll get back to you in a bit.
Comment 33 javydreamercsw 2012-11-14 18:05:19 UTC
Created attachment 127803 [details]
Updated script

Tested script.
Comment 34 javydreamercsw 2012-11-14 18:07:16 UTC
Created attachment 127804 [details]
Schema

Schema matching the script. Everything worked fine. Looks like a bad design as input.

The class didn't show up so I guess it was processed correctly. Should I open an RFE for the schema check or can you guys do it? Probably you have more technical information due to this investigation.
Comment 35 Sergey Petrov 2012-11-14 19:43:17 UTC
This one can be turned into rfe and subj may need to be updated as it already have some comments/investigation.
Also regarding schema verification, it's better to have specific use-case(not a cmmon words like 'verify schecma support'), what wrong schema case is good to consider as wrong and what to produce in this case, I suppose it shouldn't be blocking behaviour but wizard may warn some relationships/tables are looking suspicious.
Comment 36 Martin Balin 2016-07-07 08:53:40 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