Ver Mensaje Individual
  #9 (permalink)  
Antiguo 25/08/2008, 10:34
AdRii
 
Fecha de Ingreso: agosto-2008
Mensajes: 96
Antigüedad: 15 años, 8 meses
Puntos: 3
Respuesta: Fallo en base de datos

Es curioso por que si pongo la clase del mensaje anterior da el siguiente fallo

init:
deps-jar:
compile:
run:
[TopLink Config]: 2008.08.25 06:33:27.765--ServerSession(32278793)--The alias name for the entity class [class UhuPoly.Guardar] is being defaulted to: Guardar.
[TopLink Config]: 2008.08.25 06:33:27.765--ServerSession(32278793)--The table name for entity [class UhuPoly.Guardar] is being defaulted to: GUARDAR.
[TopLink Config]: 2008.08.25 06:33:27.781--ServerSession(32278793)--The column name for element [private int UhuPoly.Guardar.NumJugadores] is being defaulted to: NUMJUGADORES.
[TopLink Config]: 2008.08.25 06:33:27.781--ServerSession(32278793)--Element [private java.util.List UhuPoly.Guardar.Saldo] is being defaulted to a one to many mapping.
[TopLink Config]: 2008.08.25 06:33:27.781--ServerSession(32278793)--The column name for element [private java.lang.Long UhuPoly.Guardar.id] is being defaulted to: ID.
[TopLink Config]: 2008.08.25 06:33:27.828--ServerSession(32278793)--The target entity (reference) class for the one to many mapping element [private java.util.List UhuPoly.Guardar.Saldo] is being defaulted to: class java.lang.Integer.
[TopLink Config]: 2008.08.25 06:33:27.828--ServerSession(32278793)--The join table name for the many to many mapping [private java.util.List UhuPoly.Guardar.Saldo] is being defaulted to: GUARDAR_INTEGER.
Exception in thread "AWT-EventQueue-0" java.lang.ExceptionInInitializerError
at UhuPoly.FRMtablero.clickguardar(FRMtablero.java:30 1)

...
...
...

Caused by: Exception [TOPLINK-7243] (Oracle TopLink Essentials - 2006.8 (Build 060830)): oracle.toplink.essentials.exceptions.ValidationExc eption
Exception Description: Missing meta data for class [java.lang.Integer]. Ensure the class is not being excluded from your persistence unit by a <exclude-unlisted-classes>true</exclude-unlisted-classes> setting. If this is the case, you will need to include the class directly by adding a <class>[java.lang.Integer]</class> entry for your persistence-unit.
at oracle.toplink.essentials.exceptions.ValidationExc eption.classNotListedInPersistenceUnit(ValidationE xception.java:2120)

....
....

y sin embargo cuando quito el <Integer> de la declaracion del List el fallo es diferente...

/**
* Clase Entidad Guardar
*
* @author Administrador
*/
@Entity
public class Guardar implements Serializable {

private int NumJugadores;
private static final long serialVersionUID = 1L;

//private List<String> Jugadores;

private List<Integer> Saldo;

@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;

/** Creates a new instance of Guardar */
public Guardar() {
NumJugadores = 0;
//Jugadores = new ArrayList<String>();
Saldo = new ArrayList<Integer>();
}

//añade jugadores
public void addJugador(int saldo) {
//Jugadores.add(nombre);
Saldo.add(saldo);
NumJugadores++;
}
...
...

el fallo es el siguiente...

Internal Exception: SQL Exception: An attempt was made to get a data value of type 'VARCHAR' from a data value of type 'java.util.ArrayList'.Error Code: 20000
Call:INSERT INTO GUARDAR (ID, SALDO, NUMJUGADORES) VALUES (?, ?, ?)
bind => [1, [300000], 1]
Query:InsertObjectQuery(Partida con 1 jugadores : Saldo: 300000 )
javax.persistence.RollbackException: Exception [TOPLINK-4002] (Oracle TopLink Essentials - 2006.8 (Build 060830)): oracle.toplink.essentials.exceptions.DatabaseExcep tion
Internal Exception: SQL Exception: An attempt was made to get a data value of type 'VARCHAR' from a data value of type 'java.util.ArrayList'.Error Code: 20000
Call:INSERT INTO GUARDAR (ID, SALDO, NUMJUGADORES) VALUES (?, ?, ?)
bind => [1, [300000], 1]
Query:InsertObjectQuery(Partida con 1 jugadores : Saldo: 300000 )
at oracle.toplink.essentials.internal.ejb.cmp3.transa ction.base.EntityTransactionImpl.commit(EntityTran sactionImpl.java:109)
at oracle.toplink.essentials.internal.ejb.cmp3.transa ction.EntityTransactionImpl.commit(EntityTransacti onImpl.java:45)
at UhuPoly.ControladorBD.persist(ControladorBD.java:3 1)