For some time I have a problem in eclipselink mapping .
I have two classes , Acordo and ValorAcordo.
so I have
@ Entity
@ Table ( name = " TB_ACORDO " , schema = " JUR " )
@ NamedQueries ( {
@ NamedQuery ( name = " sql1 "
query = " SELECT a.NU_ACORDO , a.NU_MOVIMENTACAO , v.NU_CONTRATO "
+ "FROM Acordo"
+ " INNER JOIN ValorAcordo v"
+ "ON a.NU_ACORDO = v.NU_ACORDO "
+ " WHERE = a.NU_MOVIMENTACAO : nu_movimentacao " )
} )
public class Acordo implements Serializable {
private static final long serialVersionUID = - 6202293050832719017L ;
@ Id
@ GeneratedValue ( strategy = GenerationType.IDENTITY )
private Long NU_ACORDO ;
private Long NU_MOVIMENTACAO ;
private Long VR_TOTAL ;
@ OneToOne ( fetch = FetchType.LAZY )
private ValorAcordo valorAcordo ;
// ***
and
@ Entity
@ Table ( name = " TB_VALOR_ACORDO " , schema = " JUR " )
public class ValorAcordo implements Serializable {
private static final long serialVersionUID = 3024868010888830368L ;
@ Id
@ GeneratedValue ( strategy = GenerationType.IDENTITY )
private Long NU_VALOR_ACORDO ;
private Long NU_ACORDO ;
private Long NU_CONTRATO ;
private Long NU_PARTE ;
private Long QT_PARCELA ;
private Long VR_ACORDO ;
@ Temporal ( TemporalType.TIMESTAMP )
private Date DT_PRIMEIRA_PARCELA ;
@ Temporal ( TemporalType.TIMESTAMP )
private Date DT_ULTIMA_PARCELA ;
@ OneToOne ( fetch = FetchType.LAZY )
private acordo;
// ***
and when I run
Query q = em.createNamedQuery ( " sql1 " Acordo.class )
. setParameter ( " nu_movimentacao " 3103461 );
List <Acordo> q.getResultList list = ( ) ;
EclipseLink returns me the following error :
Exception in thread " main" java.lang.ClassCastException : [ Ljava.lang.Object ; can not be cast to br.victor.des.bean.Acordo
at br.victor.des.main.MainAcordo.main ( MainAcordo.java : 46)
any ideas?
I think it's a mapping problem, but found a link eclipsebug where some developers reported this error. But they had this problem with simple queries, I have this problem only when I use JOIN!
thank you