Hi guys, as the title suggest i have some problems.
Now i will show the context where the problem live.
this is one my mapped class which represent a film entry
Code:
@Entity
@Table(name = "FILM", schema = "XXX")
public class Film implements java.io.Serializable {
// Fields
private Integer idfilm;
private String title;
private Remains remains;
@Id
@GeneratedValue(strategy=GenerationType.AUTO, generator = "SEQUENCE_FILM")
@SequenceGenerator(name="SEQUENCE_FILM", sequenceName = "SEQUENCE_FILM")
@Column(name = "IDFILM", unique = true, nullable = false, precision = 22, scale = 0)
public Integer getIdfilm() {
return this.idfilm;
}
public void setIdfilm(Integer idfilm) {
this.idfilm = idfilm;
}
@Column(name = "TITLE", length = 400)
public String getTitle() {
return this.titolofilm1;
}
public void setTitle(String title) {
this.title = title;
}
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name="IDFILM")
public Remains getRemains() {
return emains;
}
public void setRemains(Remains remains) {
this.remains = remains;
}
This class in theory is mapped to a view. And i have mapped this view as a normal table.
Code:
@Entity
@Table(name = "FILM", schema = "XXX")
public class Remains implements Serializable{
private Integer day;
private Film film;
private Integer remainticket;
@Column(name = "DAY", precision = 22, scale = 0)
public Integer getDay() {
return day;
}
public void setDay(Integer day) {
this.day = day;
}
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "IDFILM")
public Film getfilm() {
return film;
}
public void setfilm(Film idfilm) {
this.film = idfilm;
}
@Column(name = "REMAINTICKET", precision = 22, scale = 0)
public Integer getRemainticket() {
return remainticket;
}
public void setRemainticket(Integer remainticket) {
this.remainticket = remainticket;
}
}
Now the point is: That i have mapped in the film class the object Remains, because i have the need, of knowing how many ticket it was remaining for a specific film.
The DBMS is Oracle 10g.
When my webserver start there i see this exception:
Caused by: org.hibernate.AnnotationException: No identifier specified for entity: Remains
But the point is this table/view has no an ID.
My intent is only join the film table to a view, and getting the result.
So exist a way to tell to hibernate "forget everything about the identifier for this class" ??
add after.
I will create a composition of id as a work-around and now i have also this ex.
Repeated column in mapping for entity: com.Film column: IDFILM