Whenever I generate entity classes from an existing database that contains multi column primary keys, no default
constructor is generated for them. The editor also indicates/warns that the default constructor is missing.
I have tested this against Netbeans 6.5 which does generate a default constructor.
I have run the same test with Netbeans RC6.7 RC3 in which the default constructor for a PK-class representing a multi
column PK is not generated.
I am running Netbeans on 32 bits Windows Vista. The database with which I am testing is Oracle 11g.
can you attach schema for your database?
or can you try the same with sample database or generated from db schema(if schema is correct) to find out if it's
oracle specific, I tried to create table with two columnt pk in sample and got correct pk class with default no arg
it may also be a good luck to have it working in 6.5 as oracle 11g isn't listed as tested platform for 6.7 on
http://www.netbeans.org/community/releases/67/relnotes.html#system_requirements and this way can't be considered as
About working configuration: I tried it with 6.7 release, on java 6, on linux with sample derby database.
I have tried it with NetBeans FCS this moring as well, when running the following tutorial against a derby database:
http://www.netbeans.org/kb/docs/web/jsf-jpa-crud-wizard.html. I had to manually add the default constructors for PK
classes ClientPK and ProjectPK.
I will attach a sql script for my Oracle schema as well.
Created attachment 84231 [details]
The Oracle script
ok, looks like I need to try vista, what jdk do you use?
thanks for your script.
Which tables did you use in entity classes generation? I see there are a lot..
In fact I generated entities for them all.
I just tested it again and have to make some extra remarks:
When I tried to only generate entity class for "Huurovereenkomst" entities "Woning" and "Huurder" were selected as
well (based on their dependencies). In this case, the default constructor IS created.
Whenever I try to generate the entities for all tables, the default constructor for all PK-classes is omitted...
used jdk: jdk1.6.0_14
*** Issue 168049 has been marked as a duplicate of this issue. ***
*** Issue 168665 has been marked as a duplicate of this issue. ***
Created attachment 84828 [details]
a bit modofied script to run in netbeans for derby sample (except some issues)
was abe to reproduce with last script+derby+generate for all tables, got missing def constrctor
As I see MethodInfo is created incorrectly also it's created in nbjavac/java.source code, so pass to java-source either
to ask assistance or to find if it's a problem in nb-javac or java.source part and fix it.
a bit more details org.netbeans.api.java.source.ElementUtilities::isSynthetic return false for these constructors, but
later when JCClassDecl is rewriten an code is generated, no code for these constructors is generated, so may be code gen
use another method to get if constructor should be in code or not.
with Dusan help find a way to fix on my side, but still want to be sure if there is any issue on javac, javac usage size
fixed in http://hg.netbeans.org/web-main/rev/d34bfdc6f7ff by switch from ElementUtilities to TreeUtilities.
going to investigate a bit more before closing, not closing, filing related separate issue or any more steps.
Integrated into 'main-golden', will be available in build *200907200201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Log: fix #167773 - changed a way to find if constructor is "generated/synthetic"
Sergej, can this be marked as fixed?
I'm waiting if it will be fixed in root cause by Dusan and also waiting for a response from him.
rollback my fix http://hg.netbeans.org/web-main/rev/0a92d5c9582e
issue is fixed in nb javac
Integrated into 'main-golden', will be available in build *200907230201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
User: Dusan Balek <email@example.com>
Log: Element coupling should preserve flags from trees (see issue #167773).
*** Issue 168987 has been marked as a duplicate of this issue. ***
I have downloaded the latest development build and tried against my Oracle schema. The default constructors are
generated by this version of the IDE. Seems ok now.
User bennyv said it looks fixed. Marked as verified. Please reopen if you think it is still valid.
v. 200908210201 by user henriquemeira. Thanks Henrique.