I am getting this error when trying to remove an entity, that I just previously 
loaded(as in the line before).

Find find = new Find(inUserGrpFacility);
getExecMgr().executeEntityManaged(find);
                    System.out.println("usergroup exists="+ (find.getResult() 
!= null));
                    getExecMgr().executeEntityManagedTx(new 
Remove(inUserGrpFacility));

The output of the print statement is: usergroup exists=true
Basically my find and remove calls are just custom command pattern wrappers on 
the entity manager find and remove methods.  The UserGroupFacility class and 
its embedded key class are included below. Assuming that the find works, I am 
thinking that there is a bug because the remove is throwing the exception in 
the title of my message. I did a trace and there are no SQL delete statements 
being executed. Are there any known issues with removing entities with 
composite keys?

/**
 * UserGrpFacility generated by hbm2java
 */
@Entity
@Table(name="USER_GRP_FACILITY"
    ,schema="SUPPORT"
    ,catalog="C_TOWER"
    , uniqueConstraints = {  }
)
public class UserGrpFacility  implements java.io.Serializable {

    // Fields

     private UserGrpFacilityId id;
     private Facility facility;

     // Constructors

    /** default constructor */
    public UserGrpFacility() {
    }

    /** full constructor */
    public UserGrpFacility(UserGrpFacilityId id, Facility facility) {
       this.id = id;
       this.facility = facility;
    }


    // Property accessors
     @EmbeddedId
    @AttributeOverrides( {
        @AttributeOverride(name="userGrpGuid", [EMAIL 
PROTECTED](name="USER_GRP_GUID", unique=false, nullable=false, insertable=true, 
updatable=true) ),
        @AttributeOverride(name="facilityId", [EMAIL 
PROTECTED](name="FACILITY_ID", unique=false, nullable=false, insertable=true, 
updatable=true, precision=18, scale=0) ) } )
    public UserGrpFacilityId getId() {
        return this.id;
    }

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

    @ManyToOne(
        fetch=FetchType.EAGER)
    @JoinColumn(name="FACILITY_ID", unique=false, nullable=false, 
insertable=false, updatable=false)
    public Facility getFacility() {
        return this.facility;
    }

    public void setFacility(Facility facility) {
        this.facility = facility;
    }


/**
 * UserGrpFacilityId generated by hbm2java
 */
@Embeddable
public class UserGrpFacilityId  implements java.io.Serializable {

    // Fields

     private byte[] userGrpGuid;
     private long facilityId;

     // Constructors

    /** default constructor */
    public UserGrpFacilityId() {
    }

    /** full constructor */
    public UserGrpFacilityId(byte[] userGrpGuid, long facilityId) {
       this.userGrpGuid = userGrpGuid;
       this.facilityId = facilityId;
    }


    // Property accessors

    @Column(name="USER_GRP_GUID", unique=false, nullable=false, 
insertable=true, updatable=true)
    public byte[] getUserGrpGuid() {
        return this.userGrpGuid;
    }

    public void setUserGrpGuid(byte[] userGrpGuid) {
        this.userGrpGuid = userGrpGuid;
    }

    @Column(name="FACILITY_ID", unique=false, nullable=false, insertable=true, 
updatable=true, precision=18, scale=0)
    public long getFacilityId() {
        return this.facilityId;
    }

    public void setFacilityId(long facilityId) {
        this.facilityId = facilityId;
    }


   public boolean equals(Object other) {
         if ( (this == other ) ) return true;
                 if ( (other == null ) ) return false;
                 if ( !(other instanceof UserGrpFacilityId) ) return false;
                 UserGrpFacilityId castOther = ( UserGrpFacilityId ) other;

                 return ( (this.getUserGrpGuid()==castOther.getUserGrpGuid()) 
|| ( this.getUserGrpGuid()!=null && castOther.getUserGrpGuid()!=null && 
Arrays.equals(this.getUserGrpGuid(), castOther.getUserGrpGuid()) ) )
 && (this.getFacilityId()==castOther.getFacilityId());
   }

   public int hashCode() {
         int result = 17;

         result = 37 * result + ( getUserGrpGuid() == null ? 0 : 
Arrays.hashCode(this.getUserGrpGuid()) );
         result = 37 * result + (int) this.getFacilityId();
         return result;
   }



View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3970457#3970457

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3970457
_______________________________________________
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to