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 185882 - Duplicate entities when update using the new feature
Summary: Duplicate entities when update using the new feature
Status: RESOLVED FIXED
Alias: None
Product: javaee
Classification: Unclassified
Component: Persistence (show other bugs)
Version: 6.x
Hardware: All All
: P2 normal (vote)
Assignee: Sergey Petrov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-05-11 08:55 UTC by mpapamichael
Modified: 2010-06-30 03:18 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
schema used for testing (1.53 MB, application/octet-stream)
2010-06-29 16:44 UTC, Sergey Petrov
Details

Note You need to log in before you can comment on or make changes to this bug.
Description mpapamichael 2010-05-11 08:55:13 UTC
Hi guys i just made changes to my database, i tried to use the new entities
update feature.

the outcome was i got a lot of duplicates, because i renamed all my foreign key
attributes to the entity name(class name), it assumed that those attributes
where missing.

these are the attributes already there(these i changed to meet my needs).

    @JoinColumn(name = "ServiceProviderID", referencedColumnName =
"ServiceProviderID")
    @ManyToOne(optional = false, fetch = FetchType.EAGER)
    private Serviceprovider serviceProvider;
    @JoinColumn(name = "SimTypeID", referencedColumnName = "SimTypeID")
    @ManyToOne(optional = false, fetch = FetchType.EAGER)
    private Simtype simType; 

these are the newly generated ones, which are the same

    @JoinColumn(name = "ServiceProviderID", referencedColumnName =
"ServiceProviderID")
    @ManyToOne(optional = false)
    private Serviceprovider serviceProviderID;
    @JoinColumn(name = "SimTypeID", referencedColumnName = "SimTypeID")
    @ManyToOne(optional = false)
    private Simtype simTypeID;
Comment 1 Sergey Petrov 2010-06-03 12:58:28 UTC
it's not necessary to rename something, the same is reproducible if generate discoundcode and customer from sample database and update it without modification, both entities will contain duplicates.
Comment 2 Quality Engineering 2010-06-08 06:07:15 UTC
Integrated into 'main-golden', will be available in build *201006080001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/6c0ce8a602d2
User: Sergey B. Petrov <sj-nb@netbeans.org>
Log: fix #185882 some work, no imprvement yet
Comment 3 Quality Engineering 2010-06-10 06:07:07 UTC
Integrated into 'main-golden', will be available in build *201006100001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/06a801bf5a27
User: Sergey B. Petrov <sj-nb@netbeans.org>
Log: fix #185882 a bit more
Comment 4 Quality Engineering 2010-06-11 06:53:37 UTC
Integrated into 'main-golden', will be available in build *201006110001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/8c078799c83e
User: Sergey B. Petrov <sj-nb@netbeans.org>
Log: fix #185882 discountcode+customer case without renaming seems to be covered now
Comment 5 Quality Engineering 2010-06-12 06:50:26 UTC
Integrated into 'main-golden', will be available in build *201006120001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/217dd89aeda3
User: Sergey B. Petrov <sj-nb@netbeans.org>
Log: fix #185882 discountcode+customer case with renamed discountCode id and renamed relation works
Comment 6 Quality Engineering 2010-06-25 03:16:08 UTC
Integrated into 'main-golden', will be available in build *201006250001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/e599d15f8b20
User: Sergey B. Petrov <sj-nb@netbeans.org>
Log: fix #185882 collect existing JoinColumns
Comment 7 Quality Engineering 2010-06-29 03:20:54 UTC
Integrated into 'main-golden', will be available in build *201006290001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/d48e5095a37b
User: Sergey B. Petrov <sj-nb@netbeans.org>
Log: fix #185882 - collect jointables, do not duplicate jointable and joincolumns (udate isn't implemented)
Comment 8 Sergey Petrov 2010-06-29 16:44:23 UTC
Created attachment 100493 [details]
schema used for testing
Comment 9 Sergey Petrov 2010-06-29 16:45:52 UTC
http://hg.netbeans.org/web-main/rev/c6f653aa274a
on attached schema there are no duplicates, ome minor cases may not be handled but need to be filed separately. Also need to implement more smart update instead not updating in some cases and plain update in other.
Comment 10 Quality Engineering 2010-06-30 03:18:37 UTC
Integrated into 'main-golden', will be available in build *201006300001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/c6f653aa274a
User: Sergey B. Petrov <sj-nb@netbeans.org>
Log: fix #185882 - missed manytomany added, the issue can be considered as fixed now