-->
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.  [ 7 posts ] 
Author Message
 Post subject: java.lang.IllegalAccessError - Hibernate2.1 final
PostPosted: Fri Dec 12, 2003 2:15 pm 
Regular
Regular

Joined: Tue Oct 14, 2003 11:11 pm
Posts: 62
Location: Brasil/Curitiba
I downloaded Hibernate2.1 final.

When I add the UsuarioRegraVO.class in the Configuration the following exception is being thrown!
java.lang.IllegalAccessError

cfg.addClass(UsuarioRegraVO.class);
where UsuarioRegraVO has a composite-id

what's the problem?

thanks :-)

_________________
Ricardo Lecheta


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 12, 2003 2:26 pm 
Newbie

Joined: Fri Oct 31, 2003 9:17 am
Posts: 10
Location: USA
Ricardo,

Can you post your code, and your mapping? It would make things a bit more easier ;-)

_________________
Rich Herman


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 12, 2003 2:39 pm 
Regular
Regular

Joined: Tue Oct 14, 2003 11:11 pm
Posts: 62
Location: Brasil/Curitiba
I have 25 mapping files, but the error only occurs with this:

The application was working fine with the Hibernate 2.0.1, and when I updated to 2.1 final, that error occurred.

thanks

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">
   
<hibernate-mapping>

<class
    name="net.wasys.crea.model.UsuarioRegraVO"
    table="USUARIOREGRA"
>
    <composite-id name="id" class="net.wasys.crea.model.UsuarioRegraPK">
        <key-property name="usuario" column="USUARIO" type="java.lang.String"/>
        <key-property name="tiporegra" column="TIPOREGRA" type="java.lang.String"/>
    </composite-id>   

</class>
</hibernate-mapping>


_________________
Ricardo Lecheta


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 12, 2003 3:10 pm 
Newbie

Joined: Fri Oct 31, 2003 9:17 am
Posts: 10
Location: USA
Ok,

Can you also post the VO, and the PK classes as well?

_________________
Rich Herman


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 12, 2003 4:00 pm 
Regular
Regular

Joined: Tue Oct 14, 2003 11:11 pm
Posts: 62
Location: Brasil/Curitiba
I generated the code with the Hibernate CodeGenerator..

Code:
package net.wasys.crea.model;

import java.io.Serializable;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;

/** @author Hibernate CodeGenerator */
public class UsuarioRegraVO implements Serializable {

    /** identifier field */
    private net.wasys.crea.model.UsuarioRegraPK id;

    /** full constructor */
    public UsuarioRegraVO(net.wasys.crea.model.UsuarioRegraPK id) {
        this.id = id;
    }

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

    public net.wasys.crea.model.UsuarioRegraPK getId() {
        return this.id;
    }

    public void setId(net.wasys.crea.model.UsuarioRegraPK id) {
        this.id = id;
    }

    public String toString() {
        return new ToStringBuilder(this)
            .append("id", getId())
            .toString();
    }

    public boolean equals(Object other) {
        if ( !(other instanceof UsuarioRegraVO) ) return false;
        UsuarioRegraVO castOther = (UsuarioRegraVO) other;
        return new EqualsBuilder()
            .append(this.getId(), castOther.getId())
            .isEquals();
    }

    public int hashCode() {
        return new HashCodeBuilder()
            .append(getId())
            .toHashCode();
    }

}


Code:
package net.wasys.crea.model;

import java.io.Serializable;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;

/** @author Hibernate CodeGenerator */
public class UsuarioRegraPK implements Serializable {

    /** identifier field */
    private String usuario;

    /** identifier field */
    private String tiporegra;

    /** full constructor */
    public UsuarioRegraPK(java.lang.String usuario, java.lang.String tiporegra) {
        this.usuario = usuario;
        this.tiporegra = tiporegra;
    }

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

    public java.lang.String getUsuario() {
        return this.usuario;
    }

    public void setUsuario(java.lang.String usuario) {
        this.usuario = usuario;
    }

    public java.lang.String getTiporegra() {
        return this.tiporegra;
    }

    public void setTiporegra(java.lang.String tiporegra) {
        this.tiporegra = tiporegra;
    }

    public String toString() {
        return new ToStringBuilder(this)
            .append("usuario", getUsuario())
            .append("tiporegra", getTiporegra())
            .toString();
    }

    public boolean equals(Object other) {
        if ( !(other instanceof UsuarioRegraPK) ) return false;
        UsuarioRegraPK castOther = (UsuarioRegraPK) other;
        return new EqualsBuilder()
            .append(this.getUsuario(), castOther.getUsuario())
            .append(this.getTiporegra(), castOther.getTiporegra())
            .isEquals();
    }

    public int hashCode() {
        return new HashCodeBuilder()
            .append(getUsuario())
            .append(getTiporegra())
            .toHashCode();
    }

}

_________________
Ricardo Lecheta


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 12, 2003 10:40 pm 
Expert
Expert

Joined: Tue Sep 16, 2003 4:06 pm
Posts: 318
Location: St. Petersburg, Russia
To me, exception stack trace would be helpful.

Take a look at the FAQ, at first glance your problem looks very popular http://www.hibernate.org/74.html#A3


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 15, 2003 9:36 am 
Regular
Regular

Joined: Tue Oct 14, 2003 11:11 pm
Posts: 62
Location: Brasil/Curitiba
ok guys, thanks.

sorry, I should have read the FAQ :-)

_________________
Ricardo Lecheta


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 7 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.