2

I'm developing a javaEE project using Glassfish and EclipseLink.

ALthough, when i run my app i get the following exceptions:

Exception [EclipseLink-60] (Eclipse Persistence Services - 2.0.1.v20100213-r6600): org.eclipse.persistence.exceptions.DescriptorException
Exception Description: The method [_persistence_setjuego_vh] or [_persistence_getjuego_vh] is not defined in the object [model.ConcursosJuego].
Internal Exception: java.lang.NoSuchMethodException: model.ConcursosJuego._persistence_getjuego_vh()

i have no clue why i am getting this exception becuase the Entity "Juegos" has that methods, this is the Entity Code:

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package model;

import java.io.Serializable;
import java.math.BigInteger;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 *
 * @author user
 */
@Entity
@NamedQueries({
    @NamedQuery(name = "Juego.findAll", query = "SELECT j FROM Juego j"),
    @NamedQuery(name = "Juego.findById", query = "SELECT j FROM Juego j WHERE j.id = :id"),
    @NamedQuery(name = "Juego.findByNombre", query = "SELECT j FROM Juego j WHERE j.nombre = :nombre"),
    @NamedQuery(name = "Juego.findByUrl", query = "SELECT j FROM Juego j WHERE j.url = :url"),
    @NamedQuery(name = "Juego.findByMultijugador", query = "SELECT j FROM Juego j WHERE j.multijugador = :multijugador"),
    @NamedQuery(name = "Juego.findByTopejugadores", query = "SELECT j FROM Juego j WHERE j.topejugadores = :topejugadores"),
    @NamedQuery(name = "Juego.findByEstado", query = "SELECT j FROM Juego j WHERE j.estado = :estado")})
public class Juego implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 10)
    private String id;
    @Size(max = 255)
    private String nombre;
    @Size(max = 1000)
    private String url;
    private BigInteger multijugador;
    private BigInteger topejugadores;
    @Size(max = 1)
    private String estado;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "juego", fetch = FetchType.LAZY)
    private List<Partida> partidaList;
    @JoinColumn(name = "RANKING_ID", referencedColumnName = "ID")
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private Ranking ranking;
    @JoinColumn(name = "CATEGORIA_ID", referencedColumnName = "ID")
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private Categoria categoria;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "juego", fetch = FetchType.LAZY)
    private List<InteraccionUsuarioJuego> interaccionUsuarioJuegoList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "juego", fetch = FetchType.LAZY)
    private List<ConcursosJuego> concursosJuegoList;

    public Juego() {
    }

    public Juego(String id) {
        this.id = id;
    }

    public String getId() {
        return id;
    }

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

    public String getNombre() {
        return nombre;
    }

    public void setNombre(String nombre) {
        this.nombre = nombre;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public BigInteger getMultijugador() {
        return multijugador;
    }

    public void setMultijugador(BigInteger multijugador) {
        this.multijugador = multijugador;
    }

    public BigInteger getTopejugadores() {
        return topejugadores;
    }

    public void setTopejugadores(BigInteger topejugadores) {
        this.topejugadores = topejugadores;
    }

    public String getEstado() {
        return estado;
    }

    public void setEstado(String estado) {
        this.estado = estado;
    }

    public List<Partida> getPartidaList() {
        return partidaList;
    }

    public void setPartidaList(List<Partida> partidaList) {
        this.partidaList = partidaList;
    }





    public Categoria getCategoria() {
        return categoria;
    }

    public void setCategoria(Categoria categoria) {
        this.categoria = categoria;
    }

    public List<InteraccionUsuarioJuego> getInteraccionUsuarioJuegoList() {
        return interaccionUsuarioJuegoList;
    }

    public void setInteraccionUsuarioJuegoList(List<InteraccionUsuarioJuego> interaccionUsuarioJuegoList) {
        this.interaccionUsuarioJuegoList = interaccionUsuarioJuegoList;
    }

    public List<ConcursosJuego> getConcursosJuegoList() {
        return concursosJuegoList;
    }

    public void setConcursosJuegoList(List<ConcursosJuego> concursosJuegoList) {
        this.concursosJuegoList = concursosJuegoList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Juego)) {
            return false;
        }
        Juego other = (Juego) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "model.Juego[ id=" + id + " ]";
    }

    public Ranking getRanking() {
        return ranking;
    }

    public void setRanking(Ranking ranking) {
        this.ranking = ranking;
    }

}

this is the application.xml

<?xml version="1.0" encoding="UTF-8"?>
<application xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:application="http://java.sun.com/xml/ns/javaee/application_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_6.xsd" id="Application_ID" version="6">
  <display-name>p_ear</display-name>
  <module>
    <ejb>p.jar</ejb>
  </module>
   <module>
    <web>
      <web-uri>p_web.war</web-uri>
      <context-root>p_web</context-root>
    </web>
  </module>

</application>

i have tried eclipse link persistance and methods in other entities and it does work.

(This is the first entity that have more than 1 relation)

thanks

  • Can you please post the entire stack trace? specifically the "caused by" part. – Miguel Jiménez Jun 13 '13 at 20:21
  • 1
    The error is not in the Entity you have posted above. I think the error located in the class 'ConcursosJuego'. ConcursosJuego is not enhanced an cause EclipseLink to throw this error. If you deploy your beans EclipseLink shoud throw errors too, because the enhancement on ConcursosJuego could not be done. – ambassador86 Jul 17 '13 at 10:44

0 Answers0