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 73925 - Refactoring should update the object-relational metadata
Summary: Refactoring should update the object-relational metadata
Status: RESOLVED DUPLICATE of bug 73934
Alias: None
Product: javaee
Classification: Unclassified
Component: Refactoring (show other bugs)
Version: 5.x
Hardware: All All
: P2 blocker (vote)
Assignee: Erno Mononen
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-03-23 14:39 UTC by Petr Blaha
Modified: 2006-06-04 23:16 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Petr Blaha 2006-03-23 14:39:00 UTC
E-mail from Ian Evans:

For example, I generated several entities from a database schema, and was
cleaning up the entity field names by using the refactoring engine. For a
many-to-many relationship of customers and accounts, the Customer entity
misnamed the accounts field (it used accountId, from the column in the
database), and Account had a similar problem with customerId for customers. I
renamed these fields to accounts and customers, respectively, but the
relationship annotations weren't updated:

In Customer.java:
    @ManyToMany(mappedBy = "customerId")
    private Collection<Account> accounts;

In Account.java:
    @JoinTable(name = "BANK_CUSTOMER_ACCOUNT_XREF")
    @ManyToMany
    private Collection<Customer> customers;

The refactoring engine needs to update annotation elements. In my case, it
should have updated the entities to the following.

In Customer.java:
    @ManyToMany(mappedBy = "customers")
    private Collection<Account> accounts;

In Account.java:
    @JoinTable(name = "BANK_CUSTOMER_ACCOUNT_XREF")
    @ManyToMany
    private Collection<Customer> customers;
Comment 1 Pavel Buzek 2006-03-23 14:51:55 UTC
+1 on this; refactorinf is the only reasonable way to change the names (as they
can not be changed in the DB2Java wizard) so this is important. IMO can be fixed
after feature freeze.
Comment 2 Petr Blaha 2006-03-24 08:51:37 UTC

*** This issue has been marked as a duplicate of 73934 ***