org.hibernate.MappingException help needed!
tzablock Dec 9, 2005 10:41 AMOk here's my painful problem:
while deploying par file I get this sort of exception:
org.hibernate.MappingException: property not found: CompanyId on entity pl.com.filmservice.par.Film at org.hibernate.mapping.PersistenetClass.getProperty(PersistentClass.java:352)
....and so on
well this thing is kind of strange because I have the CompanyId on Film entity
HERE IS THE Company entity
package pl.com.filmservice.par;
import javax.ejb.*;
import javax.persistence.*;
import java.io.Serializable;
import java.util.List;
import java.math.BigDecimal;
@Entity
@Table(name="COMPANY")
public class Company implements Serializable
{
BigDecimal companyId;
String name;
Dictionary TypeDictionaryId;;
List films;
List locations;
@Id(generate=GeneratorType.AUTO)
@Column(name="ID")
public BigDecimal getCompanyId()
{
return companyId;
}
public void setCompanyId(BigDecimal id)
{
this.companyId = id;
}
@Column(name="NAME",nullable=false,length=40)
public String getName()
{
return name;
}
public void setName(String name)
{
this.name = name;
}
@ManyToOne(optional=false, fetch=FetchType.LAZY, cascade = {CascadeType.PERSIST, CascadeType.MERGE})
@JoinColumn(name="TYPE_DIC_ID",nullable=false)
public Dictionary getDictionary()
{
return TypeDictionaryId;
}
public void setDictionary(Dictionary dictionary)
{
this.TypeDictionaryId = dictionary;
}
@OneToMany(fetch=FetchType.LAZY,mappedBy="CompanyId",cascade = {CascadeType.ALL})
public List getFilms()
{
return films;
}
public void setFilms(List films)
{
this.films = films;
}
@OneToMany(fetch=FetchType.LAZY,mappedBy="CompanyId",cascade = {CascadeType.ALL})
public List getLocations()
{
return locations;
}
public void setLocations(List locations)
{
this.locations = locations;
}
}
AND HERE GOES THE Film one
package pl.com.filmservice.par;
import javax.ejb.*;
import javax.persistence.*;
import java.io.Serializable;
import java.util.List;
import java.math.BigDecimal;
@Entity
@Table(name="FILM")
public class Film implements Serializable
{
BigDecimal filmId;
String originalTitle;
String title;
BigDecimal reelCount;
Dictionary TypeDictionaryId;
Dictionary FormatDictionaryId;
Company CompanyId;
List copies;
@Id(generate=GeneratorType.AUTO)
@Column(name="ID")
public BigDecimal getFilmId()
{
return filmId;
}
public void setFilmId(BigDecimal id)
{
this.filmId = id;
}
@Column(name="ORIGINAL_TITLE",nullable=false,length=40)
public String getOriginalTitle()
{
return originalTitle;
}
public void setOriginalTitle(String originalTitle)
{
this.originalTitle = originalTitle;
}
@Column(name="TITLE",nullable=false,length=40)
public String getTitle()
{
return title;
}
public void setTitle(String title)
{
this.title = title;
}
@Column(name="REEL_CNT",nullable=true)
public BigDecimal getReelCount()
{
return reelCount;
}
public void setReelCount(BigDecimal reelCount)
{
this.reelCount = reelCount;
}
@ManyToOne(optional=false, fetch=FetchType.LAZY, cascade = {CascadeType.PERSIST, CascadeType.MERGE})
@JoinColumn(name="CMP_ID",nullable=false)
public Company getCompany()
{
return CompanyId;
}
public void setCompany(Company company)
{
this.CompanyId = company;
}
@ManyToOne(optional=false, fetch=FetchType.LAZY, cascade = {CascadeType.PERSIST, CascadeType.MERGE})
@JoinColumn(name="TYPE_DIC_ID",nullable=false)
public Dictionary getTypeDictionary()
{
return TypeDictionaryId;
}
public void setTypeDictionary(Dictionary dictionary)
{
this.TypeDictionaryId = dictionary;
}
@ManyToOne(optional=false, fetch=FetchType.LAZY, cascade = {CascadeType.PERSIST, CascadeType.MERGE})
@JoinColumn(name="FORMAT_DIC_ID",nullable=false)
public Dictionary getFormatDictionary()
{
return FormatDictionaryId;
}
public void setFormatDictionary(Dictionary dictionary)
{
this.FormatDictionaryId = dictionary;
}
@OneToMany(fetch=FetchType.LAZY,mappedBy="FilmId",cascade = {CascadeType.ALL})
public List getCopies()
{
return copies;
}
public void setCopies(List copies)
{
this.copies = copies;
}
}