[XDoclet-JIRA] Assigned: (XDT-1503) Bug in value object with generated primary key, only default constructor works

[email protected]
Newsgroups gmane.comp.java.xdoclet.devel
Message-ID <[email protected]>
Message:

   The following issue has been re-assigned.

   Assignee: Matthias Germann (mailto:[email protected])
---------------------------------------------------------------------
View the issue:
  http://opensource.atlassian.com/projects/xdoclet/browse/XDT-1503

Here is an overview of the issue:
---------------------------------------------------------------------
        Key: XDT-1503
    Summary: Bug in value object with generated primary key, only default constructor works
       Type: Bug

     Status: Open
   Priority: Major

 Original Estimate: Unknown
 Time Spent: Unknown
  Remaining: Unknown

    Project: XDoclet
   Versions:
             1.2.3

   Assignee: Matthias Germann
   Reporter: Robert Upshall

    Created: Fri, 12 Aug 2005 8:27 AM
    Updated: Sun, 14 Aug 2005 2:04 AM
Environment: jvm 1.4.2, Mac OS X

Description:
I have included partical code below from one of my generated VO's. 

The problem is with the non-default constructor.  From the example below, the first thing the non default constructor does is call the SetParentType method, in the setParentType it attempts to set the parentType property in the primary key, the problem is that the primary key hasn't been initialized yet, thus the non-default constructor will always end up with a null pointer exception.



public class LinkValue
   extends java.lang.Object
   implements java.io.Serializable, java.lang.Cloneable 
{

 . . . 

   private com.psasoft.inventory.pk.LinkCPK primaryKey;

   public LinkValue()
   {
	  primaryKey = new com.psasoft.inventory.pk.LinkCPK();
   }

   public LinkValue( java.lang.String parentType,java.lang.Integer parentId,java.lang.String childType,java.lang.Integer childId )
   {
       setParentType(parentType);
       setParentId(parentId);
       setChildType(childType);
       setChildId(childId);
       primaryKey = new com.psasoft.inventory.pk.LinkCPK(this.getParentType(),this.getParentId(),this.getChildType(),this.getChildId());
   }


 . . .

   public void setParentType( java.lang.String parentType )
   {
	  this.parentType = parentType;
	  parentTypeHasBeenSet = true;

      primaryKey.setParentType(parentType);
   }

}



---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.

If you think it was sent incorrectly contact one of the administrators:
   http://opensource.atlassian.com/projects/xdoclet/secure/Administrators.jspa

If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira



-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.