Hi, having a problem mapping my MySQL view below using Hibernate 3. I am new to Hibernate (from today) but finding limited information on mapping views - this view doesn't have a unique key as such so wondering if that is the problem. Any help appreciated!
MySQL view:
CREATE OR REPLACE VIEW `get_dashlets` (`d_id`, `d_title`, `d_description`, `d_scope`,
`f_id`, `f_thumbnail`, `f_author`,
`c_id`)
AS
SELECT d.id, d.title, d.description, d.scope, f.id, f.thumbnail, f.author, c.id
FROM dashlets d,
features f,
feature_categories c
WHERE (d.feature_id = f.id) and (f.id = c.feature_id);
Mapping documents:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="database.dataEntities.GetDashlets" table="get_dashlets" catalog="sambajam">
<id name="dID" type="java.lang.Integer">
<column name="dID" />
<generator class="identity" />
</id>
<property name="title" type="string">
<column name="d_title" length="128" />
</property>
<property name="description" type="string">
<column name="d_description" length="16777215" />
</property>
<property name="scope" type="string">
<column name="scope" length="9" />
</property>
<property name="thumbnail" type="string">
<column name="thumbnail" length="128" />
</property>
<property name="author" type="string">
<column name="author" length="128" />
</property>
</class>
</hibernate-mapping>
Java POJO Class:
public class GetDashlets implements java.io.Serializable {
private Integer dID;
private String title;
private String description;
private String scope;
private String thumbnail;
private String author;
public GetDashlets() {
}
public GetDashlets(int dID, String scope) {
this.dID = dID;
this.scope = scope;
}
public GetDashlets(int dID, String title, String description, String scope, String thumbnail, String author) {
this.dID = dID;
this.title = title;
this.description = description;
this.scope = scope;
this.thumbnail = thumbnail;
this.author = author;
}
public Integer getdID() {
return this.dID;
}
public void setdID(Integer dID) {
this.dID = dID;
}
public String getTitle() {
return this.title;
}
public void setTitle(String title) {
this.title = title;
}
public String getDescription() {
return this.description;
}
public void setDescription(String description) {
this.description = description;
}
public String getScope() {
return this.scope;
}
public void setScope(String scope) {
this.scope = scope;
}
public String getThumbnail() {
return this.thumbnail;
}
public void setThumbnail(String thumbnail) {
this.thumbnail = thumbnail;
}
public String getAuthor() {
return this.author;
}
public void setAuthor(String author) {
this.author = author;
}
}
<b>Runtime Error:</b>
could not execute query
|