Hello Everyone,
I am working on my first Hibernate project and I am having some problems that I just cannot figure out.
I have a simple DAO that calls a hibernate template. I have 2 classes that I use a join to link. I have made similar tests work using MS-SQL.
I would like to know if anyone has any experience working with Sybase ASE 15.0 and the JTDS driver or the jConnect Driver.
Is it my code? My understanding (am I missing something)? Or is this just a problem?
Error Message:
2010-07-01 08:09:42,011 [tomcat-http--2] ERROR org.hennepinsheriff.jailroster.dao.SearchDAOImpl.nameSearch(SearchDAOImpl.java:311) - Error Logging: org.springframework.orm.hibernate3.HibernateQueryException: Book.bookInfo is not mapped [ from org.hennepinsheriff.jailroster.business.Book, Book.bookInfo as i where Book.booknum = i.booknum and i.bookDate >= ?]; nested exception is org.hibernate.hql.ast.QuerySyntaxException: Book.bookInfo is not mapped [ from org.hennepinsheriff.jailroster.business.Book, Book.bookInfo as i where Book.booknum = i.booknum and i.bookDate >= ?]
DAO Snippet:
Code:
String sSQL = " from Book, Book.bookInfo as i " +
" where Book.booknum = i.booknum " +
" and i.bookDate >= ?";
try {
List lBookingSummaryType = this.hibernateTemplate.find(sSQL, searchDate);
} catch(Exception e) {
statusMessage = "Error with assigning type or parsing....";
log.error("Error Logging: " + e);
log.debug(statusMessage);
}
Book Class:
Code:
@Entity
@Table(name = "ojms.JOWN.book")
public class Book extends AbstractEntity implements java.io.Serializable {
private Long bookNum;
private String vBookNum;
private Long cinID;
private Date createDate;
private String resStatus;
private Integer sealID;
@Id
@Column(name = "booknum")
public Long getBookNum() {
return this.bookNum;
}
public void setBookNum(Long bookNum) {
this.bookNum = bookNum;
}
@OneToOne(cascade=CascadeType.ALL, fetch=FetchType.EAGER)
@JoinColumn(name="booknum", referencedColumnName="booknum")
private BookInfo bookInfo;
public BookInfo getBookInfo() {
return this.bookInfo;
}
public void setBookInfo(BookInfo bookInfo) {
this.bookInfo = bookInfo;
}
@Column(name = "v_booknum")
public String getVBookNum() {
return this.vBookNum;
}
public void setVBookNum(String vBookNum) {
this.vBookNum = vBookNum;
}
@Column(name = "cin")
public Long getCinID() {
return this.cinID;
}
public void setCinID(Long cinID) {
this.cinID = cinID;
}
@Column(name = "create_dt")
public Date getCreateDate() {
return this.createDate;
}
public void setCreateDate(Date createDate) {
this.createDate = createDate;
}
@Column(name = "res_status")
public String getResStatus() {
return this.resStatus;
}
public void setResStatus(String resStatus) {
this.resStatus = resStatus;
}
@Column(name = "seal_id")
public Integer getSealID() {
return this.sealID;
}
public void setSealID(Integer sealID) {
this.sealID = sealID;
}
}
Book Info Class:
Code:
@Entity
@Table(name = "ojms.JOWN.bkinfo1")
public class BookInfo extends AbstractEntity implements java.io.Serializable {
private Long bookNum;
private Date bookDate;
private Date releaseDate;
@Id
@Column(name = "booknum")
public Long getBookNum() {
return this.bookNum;
}
public void setBookNum(Long bookNum) {
this.bookNum = bookNum;
}
@OneToOne(fetch=FetchType.EAGER)
@JoinColumn(name="booknum", referencedColumnName="booknum")
private Book book;
public Book getBook() {
return this.book;
}
public void setBook(Book book) {
this.book = book;
}
@Column(name = "book_dt")
public Date getBookDate() {
return this.bookDate;
}
public void setBookDate(Date bookDate) {
this.bookDate = bookDate;
}
@Column(name = "act_rels_dt")
public Date getReleaseDate() {
return this.releaseDate;
}
public void setReleaseDate(Date releaseDate) {
this.releaseDate = releaseDate;
}
}
Any help is greatly appreciated.
Thank you
Dave