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 76320 - Refactor Package name on generated persistance classes causing IllegalArgumentException
Summary: Refactor Package name on generated persistance classes causing IllegalArgumen...
Status: RESOLVED DUPLICATE of bug 75738
Alias: None
Product: editor
Classification: Unclassified
Component: Refactoring (show other bugs)
Version: 5.x
Hardware: PC Windows XP
: P3 blocker (vote)
Assignee: issues@java
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-05-13 00:02 UTC by tbarlotta
Modified: 2006-05-26 12:48 UTC (History)
0 users

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 tbarlotta 2006-05-13 00:02:44 UTC
Created base persistence compoenents.  Realized I mistyped persistence and tried
to refactor the package name from xxx.xxx.persistance to xxx.xxx.persistence. 
Recieved an IllegalArgumentException.  Nothing was done to the code after
generation.

FROM LOG FILE:
*********** Exception occurred ************ at 6:50 PM on May 12, 2006
java.lang.IllegalArgumentException: Annotation tree not found; resource:
xxx/xxx/persistance/Statuscode.java
	at
org.netbeans.modules.javacore.jmiimpl.javamodel.ArrayInitializationImpl.createElement(ArrayInitializationImpl.java:80)
	at
org.netbeans.modules.javacore.jmiimpl.javamodel.MetadataElement.createChildrenList(MetadataElement.java:435)
	at
org.netbeans.modules.javacore.jmiimpl.javamodel.MetadataElement.createChildrenList(MetadataElement.java:392)
	at
org.netbeans.modules.javacore.jmiimpl.javamodel.MetadataElement.createChildrenList(MetadataElement.java:387)
	at
org.netbeans.modules.javacore.jmiimpl.javamodel.ArrayInitializationImpl.initChildren(ArrayInitializationImpl.java:55)
	at
org.netbeans.modules.javacore.jmiimpl.javamodel.ArrayInitializationImpl.getElementValues(ArrayInitializationImpl.java:41)
	at org.netbeans.jmi.javamodel.ArrayInitialization$Impl.getElementValues(Unknown
Source)
	at
org.netbeans.modules.javacore.jmiimpl.javamodel.ArrayInitializationImpl.getChildren(ArrayInitializationImpl.java:47)
	at
org.netbeans.modules.refactoring.plugins.MoveClassRefactoringPlugin.checkUsedElements(MoveClassRefactoringPlugin.java:373)
	at
org.netbeans.modules.refactoring.plugins.MoveClassRefactoringPlugin.checkUsedElements(MoveClassRefactoringPlugin.java:455)
	at
org.netbeans.modules.refactoring.plugins.MoveClassRefactoringPlugin.checkUsedElements(MoveClassRefactoringPlugin.java:455)
	at
org.netbeans.modules.refactoring.plugins.MoveClassRefactoringPlugin.checkUsedElements(MoveClassRefactoringPlugin.java:455)
	at
org.netbeans.modules.refactoring.plugins.MoveClassRefactoringPlugin.checkUsedElements(MoveClassRefactoringPlugin.java:367)
	at
org.netbeans.modules.refactoring.plugins.MoveClassRefactoringPlugin.preCheck(MoveClassRefactoringPlugin.java:184)
	at
org.netbeans.modules.refactoring.api.AbstractRefactoring.pluginsPreCheck(AbstractRefactoring.java:299)
	at
org.netbeans.modules.refactoring.api.AbstractRefactoring.preCheck(AbstractRefactoring.java:144)
	at
org.netbeans.modules.refactoring.spi.ui.ParametersPanel$9.run(ParametersPanel.java:441)
	at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:493)
[catch] at
org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:926)


OFFENDING SOURCE CODE:
import java.io.Serializable;
import java.util.Date;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author tim.barlotta
 */
@Entity
@Table(name = "statuscode")
@NamedQueries( {@NamedQuery(name = "Statuscode.findById", query = "SELECT s FROM
Statuscode s WHERE s.id = :id"), @NamedQuery(name =
"Statuscode.findByDescription", query = "SELECT s FROM Statuscode s WHERE
s.description = :description"), @NamedQuery(name = "Statuscode.findByCreated",
query = "SELECT s FROM Statuscode s WHERE s.created = :created"),
@NamedQuery(name = "Statuscode.findByActivity", query = "SELECT s FROM
Statuscode s WHERE s.activity = :activity")})
public class Statuscode implements Serializable {

    @Id
    @Column(name = "id", nullable = false)
    private Integer id;

    @Column(name = "description")
    private String description;

    @Column(name = "created", nullable = false)
    @Temporal(TemporalType.TIMESTAMP)
    private Date created;

    @Column(name = "activity", nullable = false)
    @Temporal(TemporalType.TIMESTAMP)
    private Date activity;

    @OneToMany(cascade = CascadeType.ALL, mappedBy = "statuscodeid")
    private java.util.Collection
<net.aegis.cronus.persistance.Employeetimesheetstatus> employeetimesheetstatus;

    @JoinColumn(name = "activityby")
    @ManyToOne
    private Employee activityby;

    @JoinColumn(name = "createdby")
    @ManyToOne
    private Employee createdby;
    
    /** Creates a new instance of Statuscode */
    public Statuscode() {
    }

    public Statuscode(Integer id) {
        this.id = id;
    }

    public Statuscode(Integer id, Date created, Date activity) {
        this.id = id;
        this.created = created;
        this.activity = activity;
    }

    public Integer getId() {
        return this.id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getDescription() {
        return this.description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public Date getCreated() {
        return this.created;
    }

    public void setCreated(Date created) {
        this.created = created;
    }

    public Date getActivity() {
        return this.activity;
    }

    public void setActivity(Date activity) {
        this.activity = activity;
    }

    public java.util.Collection
<net.aegis.cronus.persistance.Employeetimesheetstatus>
getEmployeetimesheetstatus() {
        return this.employeetimesheetstatus;
    }

    public void setEmployeetimesheetstatus(java.util.Collection
<net.aegis.cronus.persistance.Employeetimesheetstatus> employeetimesheetstatus) {
        this.employeetimesheetstatus = employeetimesheetstatus;
    }

    public Employee getActivityby() {
        return this.activityby;
    }

    public void setActivityby(Employee activityby) {
        this.activityby = activityby;
    }

    public Employee getCreatedby() {
        return this.createdby;
    }

    public void setCreatedby(Employee createdby) {
        this.createdby = createdby;
    }

    public int hashCode() {
        int hash = 0;
        hash += (this.id != null ? this.id.hashCode() : 0);
        return hash;
    }

    public boolean equals(Object object) {
        if (object == null || !this.getClass().equals(object.getClass())) {
            return false;
        }
        Statuscode other = (Statuscode)object;
        if (this.id != other.id && (this.id == null ||
!this.id.equals(other.id))) return false;
        return true;
    }

    public String toString() {
        //TODO change toString() implementation to return a better display name
        return "" + this.id;
    }
    
}
Comment 1 Jan Becicka 2006-05-26 12:48:18 UTC

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