-->
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.  [ 1 post ] 
Author Message
 Post subject: Entity with EmbededId
PostPosted: Wed Mar 04, 2015 10:54 am 
Newbie

Joined: Mon Aug 09, 2004 2:50 pm
Posts: 10
Location: Sao Paulo , SP, Brazil
Hi,

I´m trying to get data from a entity that have a embededId in a entity that have a property like this:

public class MyClass {
@OneToMany(mappedBy="formulario", fetch=FetchType.LAZY, cascade = {CascadeType.ALL})
@Cascade({org.hibernate.annotations.CascadeType.ALL,
org.hibernate.annotations.CascadeType.DELETE_ORPHAN})
private Set<FormularioVinculavel> formularioVinculavel = new HashSet<FormularioVinculavel>();
...
}

And in the class FormularioVinculavel, I have this EmbededId:

@Embeddable
public static class ID implements Serializable {
@Column(name = "formulario_id")
private Long formularioId;

@Column(name = "vinculavel_id")
private Long vinculavelId;

public ID(){}
public ID(final Long formularioId, final Long vinculavelId) {
this.formularioId = formularioId;
this.vinculavelId = vinculavelId;
}
}

@EmbeddedId
private ID id = new ID();



But, When I call this.formularioVinculavel inside MyClass, the following error is thrown:

11:50:56,080 ERROR [JDBCExceptionReporter] ORA-00904: "VINCULAVEL1_2_"."ID": invalid identifier

But there is no ID in the table. ID is the name of composite id´class. Why Hibernate is trying to access the column ID if the ID is a composite id?

Thanks in advance,

Sergio Stateri Junior.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.