[jboss-user] [EJB 3.0] - problems with @Idclass

lastra do-not-reply at jboss.com
Tue Apr 15 14:02:21 EDT 2008

well i will explain a bit, i have one table with 3 fields how primary key, i'm using @Idclass and when i'm using any function of .find i get that exception:

javax.ejb.EJBException: javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not load an entity: [com.recargaexpress.gestionpro.entity.Apuntes#component[empresa,numeroAsiento, numeroLinea]{numeroLinea=1,numeroAsiento=86, empresa=1}]

My entity:

public class Apuntes implements Serializable{
	private Integer empresa;
	private Integer numeroAsiento;
	private Integer numeroLinea;	

	private String modificado;
        others fields and methods get/set


and in other class file:

public class ApuntesPK implements Serializable {  
	private Integer empresa;
	private Integer numeroLinea;
	private Integer numeroAsiento;
	//private static final long serialVersionUID = 1L;
	public ApuntesPK() {

	public ApuntesPK(int empresa, int numAsiento, int numLinea){

        Methods get/set

	public boolean equals(Object o) {
		if (o == this) {
			return true;
		else if (o instanceof ApuntesPK ) {
			return empresa==(((ApuntesPK)o).empresa) &&
			numeroAsiento==(((ApuntesPK)o).numeroAsiento)&& numeroLinea==(((ApuntesPK)o).numeroLinea);
		return false;

	public int hashCode() {
		return this.numeroLinea ^ this.numeroAsiento ^ this.empresa;

In my bean method for find:

public Apuntes buscarApunte(int empresa, int numAsiento, int numLinea) throws RemoteException {

                        ApuntesPK pk = new ApuntesPK();
			Apuntes sqlb= em.find(Apuntes.class, pk);
			return sqlb;

And in request from my client:

Apuntes x= beanremote.buscarApunte(1,86,1);

If anyone can help me, and sry for my english

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

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4144306

More information about the jboss-user mailing list