These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: java.lang.StackOverflowError when deleting
PostPosted: Tue Mar 22, 2005 6:06 am 
Newbie

Joined: Wed Jan 05, 2005 5:30 am
Posts: 14
Hello I get a java.lang.StackOverflowError when trying to delete a persistant object. Can it be due to some recoursive depdencies?


here is my mapping file



Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
                            "-//Hibernate/Hibernate Mapping DTD 2.0//EN"
                            "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" >

<!-- Created Fri Jan 07 11:24:24 PST 2005                         -->
<hibernate-mapping package="data">

    <class name="Person" table="person">
        <id name="personId" column="Person_ID" type="java.lang.Integer">
            <generator class="native"/>
        </id>

        <property name="handle" column="Handle" type="java.lang.String"  not-null="true" />
        <property name="password" column="Password" type="java.lang.String"  not-null="true" />
        <property name="createddate" column="CreatedDate" type="java.lang.Long"  not-null="true" />
       <property name="name" column="FullName" type="java.lang.String"  not-null="true" />
       
       <set name="projects" table="person_is_related_to_project"  inverse="false" cascade ="all">
          <key column="FK_Person_ID"/>
          <many-to-many column="FK_Project_ID" class ="data.Project"/>
       </set>
      
       <joined-subclass name="Employee" table="employee">
      <key column="Employee_ID"/>
         
       </joined-subclass>
   
    </class>
   
</hibernate-mapping>
[/code]


Top
 Profile  
 
 Post subject: Here is my class file
PostPosted: Tue Mar 22, 2005 6:17 am 
Newbie

Joined: Wed Jan 05, 2005 5:30 am
Posts: 14
I cam to think, can it be my hashcode function?

Code:
/*
* Created on Feb 2, 2005
*
*/
package data;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;

import frontend.util.IDUtil;
import frontend.util.PathHolder;

/**
* Represents a person in the system. Do not init this class,
* factory.PersonFactory instead
* @author Oliver Billing
*
*/
public  class Person implements ContainsFiles {
   
    private int uniqueID = IDUtil.getInstance().getUniqueID();
   /** The composite primary key value. */
    protected java.lang.Integer personId;
   
    /** The cached hash code value for this instance.  Settting to 0 triggers re-calculation. */
    protected int hashValue = 0;
   
   /**Full name of person*/
   protected java.lang.String name;
   
    /** The value of the simple handle property. */
    protected java.lang.String handle;

    /** The value of the simple password property. */
    protected java.lang.String password;

    /** The value of the simple createddate property. */
    protected java.lang.Long createddate;
   
    /** Projects that the person has access too*/
    protected Set projects;
   
    /** Projects on list form*/
    protected List projectsList;
   
    /**PathHolder */
    protected PathHolder pathH;
   
    /**Marks wether projectsListhas been set or not*/
    private boolean SetConverted = false;
   
    public Person(){
       
       projects= new HashSet();
       projectsList = new ArrayList();
       createddate = new Long(System.currentTimeMillis());
       
    }
   
    public Person(String fullname,String userName,String password){
       
       this.createddate = new Long(System.currentTimeMillis());
       this.handle = userName;
       this.password = password;
       this.name=fullname;
       projects= new HashSet();
       projectsList = new ArrayList();
       
    }
   
   
   
   /**
    * @return Returns the createddate.
    */
   public java.lang.Long getCreateddate() {
      return createddate;
   }
   /**
    * @param createddate The createddate to set.
    */
   public void setCreateddate(java.lang.Long createddate) {
      this.createddate = createddate;
   }
   /**
    * @return Returns the handle.
    */
   public java.lang.String getHandle() {
      return handle;
   }
   /**
    * @param handle The handle to set.
    */
   public void setHandle(java.lang.String handle) {
      this.handle = handle;
   }
   /**
    * @return Returns the name.
    */
   public java.lang.String getName() {
      return name;
   }
   /**
    * @param name The name to set.
    */
   public void setName(java.lang.String name) {
      this.name = name;
   }
   /**
    * @return Returns the password.
    */
   public java.lang.String getPassword() {
      return password;
   }
   /**
    * @param password The password to set.
    */
   public void setPassword(java.lang.String password) {
      this.password = password;
   }
   /**
    * @return Returns the projects.
    */
   public Set getProjects() {
      return projects;
   }
   /**
    * @param projects The projects to set.
    */
   public void setProjects(Set projects) {
      this.projects = projects;
   }
   
   /**
    * @return Returns the personId.
    */
   public java.lang.Integer getPersonId() {
      return personId;
   }
   /**
    * @param personId The personId to set.
    */
   public void setPersonId(java.lang.Integer personId) {
            this.hashValue = 0;
           this.personId = personId;
   }
   
     /**
     * Implementation of the equals comparison on the basis of equality of the primary key values.
     * @param rhs
     * @return boolean
     */
    public boolean equals(Object rhs)
    {
        if (rhs == null)
            return false;
        if (! (rhs instanceof Person))
            return false;
        Person that = (Person) rhs;
        if (this.getPersonId() != null && that.getPersonId() != null)
        {
            if (! this.getPersonId().equals(that.getPersonId()))
            {
                return false;
            }
        }
        return true;
    }

    /**
     * Implementation of the hashCode method conforming to the Bloch pattern with
     * the exception of array properties (these are very unlikely primary key types).
     * @return int
     */
    public int hashCode()
    {
        if (this.hashValue == 0)
        {
            int result = 17;
            int customerIdValue = this.getPersonId() == null ? 0 : this.getPersonId().hashCode();
            result = result * 37 + customerIdValue;
            this.hashValue = result;
        }
        return this.hashValue;
    }
    /**
     * get a persons projects by ID
     * @param id
     * @return null or project
     */
    public Project getProjectByID(int id){
       Iterator i = this.projects.iterator();
       while(i.hasNext()){
          
          Project p = (Project)i.next();
          
          if( p.getProjectId().equals(new Integer(id))) return p;
       }
       return null;
    }

   /* (non-Javadoc)
    * @see data.ContainsFiles#getContainerName()
    */
   public String getContainerName() {
      return this.name;
   }

   /* (non-Javadoc)
    * @see data.ContainsFiles#getChilds()
    */
   public List getChilds() {
      
         Iterator it = this.getProjects().iterator();
         projectsList.removeAll(projectsList);
         while(it.hasNext()){
                ContainsFiles f =(ContainsFiles) it.next();
            this.projectsList.add(f);
            f.setfather(this);
         }
   
      return projectsList;
   }


   public ContainsFiles getFather() {

      return this;
   }

   /* (non-Javadoc)
    * @see data.ContainsFiles#getUniqueID()
    */
   public int getUniqueID() {
      
      return uniqueID;
   }

   /* (non-Javadoc)
    * @see data.ContainsFiles#GetFiles()
    */
   public List GetFiles() {
      
      return null;
   }


   public void setfather(ContainsFiles father) {
   
      //do nothing
   }

    /**
     * @return Returns the pathH.
     */
    public PathHolder getPathH() {
        return pathH;
    }
   

    /**
     * @param pathH The pathH to set.
     */
    public void setPathH(PathHolder pathH) {
        this.pathH = pathH;
    }
   







   
   
}


Top
 Profile  
 
 Post subject: sorry
PostPosted: Tue Mar 22, 2005 9:38 am 
Newbie

Joined: Wed Jan 05, 2005 5:30 am
Posts: 14
Delete this thread it was a nasty bug in an Jface right after the deletion.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.