Reputation: 877
I have an entity for hibernate orm like below. In this entity, i dont want to persist EntHesaplasma object. so i used @transient annotation.
import javax.persistence.Transient;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
@Entity
@Table(name = "CARI_HAREKETLERI")
public class EntCariHareketler {
private Integer cha_RECno;
@Resolvable()
private EntHesaplasma enthesaplasma;
@Id
@GeneratedValue
@Column(name = "cha_recno", unique = true, nullable = false)
public Integer getCha_RECno() {
return cha_RECno;
}
@Transient
public EntHesaplasma getEnthesaplasma() {
return enthesaplasma;
}
public void setEnthesaplasma(EntHesaplasma enthesaplasma) {
this.enthesaplasma = enthesaplasma;
}
despite the fact that i added @transient annotation, it gave an error like that
Could not determine type for: com.entity.EntHesaplasma, at table:
CARI_HAREKETLERI, for columns: org.hibernate.mapping.Column(enthesaplasma)]
thanks.
Upvotes: 1
Views: 667
Reputation: 3227
You can't apply annotations to methods or fields randomly. Normally, you should apply your annotations the same way as @Id..
In EntCariHareketler class Transientshould be like
@Transient
private EntHesaplasma enthesaplasma;
Upvotes: 0
Reputation: 41123
Maybe you need to define it at the field, not getter/setter
@Transient
private EntHesaplasma enthesaplasma;
Upvotes: 2