I am getting an error suggesting that I need to declase the insert and update attribute for my id element. The problem is that I already have those declared in my mapping. I have tried setting them to both true and false, without any change.
ERRORS:
2005-03-09 16:11:44,451 ERROR [net.sf.hibernate.util.XMLHelper] Error parsing XML: XML InputStream(9) Attribute "insert" must be declared for element type "id".
2005-03-09 16:11:44,451 ERROR [net.sf.hibernate.util.XMLHelper] Error parsing XML: XML InputStream(9) Attribute "update" must be declared for element type "id".
2005-03-09 16:11:44,456 INFO [net.sf.hibernate.jmx.HibernateServiceMBean] Could
not build SessionFactory using the MBean classpath - will try again using client classpath: Error reading resource: com/px/ecm/mapping/NewsItem.hbm.xml
2005-03-09 16:11:44,456 DEBUG [net.sf.hibernate.jmx.HibernateServiceMBean] Error was net.sf.hibernate.MappingException: Error reading resource: com/px/ecm/mapping/NewsItem.hbm.xml
----------------------------------------------------
MAPPING:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping
PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping package="com.px.ecm.domain">
<class name="NewsItem" table="news_item">
<id name="id" column="news_item_id" insert="true" update="true" type="long" unsaved-value="null">
<generator class="native"/>
</id>
<property name="newsItemTitle" column="news_item_title" />
<property name="newsItemLinkText" column="news_item_linktext" />
<property name="newsItemLink" column="news_item_link" />
<property name="newsItemText" column="news_item_text" />
<many-to-one name="newsItemMedia"
class="NewsItemMedia"
column="news_item_id"
cascade="all"
/>
<many-to-one name="newsEdition" class="NewsEdition">
<column name="news_edition_date"/>
<column name="news_edition_type"/>
</many-to-one>
</class>
</hibernate-mapping>
----------------------------------------------------
MySQL TABLE
CREATE TABLE `news_item` (
`news_edition_date` date NOT NULL default '0000-00-00',
`news_edition_type` varchar(4) NOT NULL default '',
`news_item_id` int(11) NOT NULL default '0',
`news_item_title` varchar(128) default '',
`news_item_linktext` varchar(255) default '',
`news_item_link` varchar(255) default NULL,
`news_item_text` text,
`news_item_sequence` int(11) default '0',
`alterdate` timestamp(14) NOT NULL,
PRIMARY KEY (`news_item_id`)
----------------------------------------------------
JAVA CLASS
public class NewsItem {
protected long id;
protected NewsEditionID newsEditionID;
protected Date newsEditionDate;
protected String newsEditionType;
protected String newsItemTitle;
protected String newsItemLinkText;
protected String newsItemLink;
protected String newsItemText;
protected NewsEdition newsEdition;
protected String newsItemImg;
protected NewsItemMedia newsItemMedia;
public NewsItem() {
}
public NewsItem(int id) {
this.id = id;
}
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public NewsEditionID getNewsEditionID() {
return new NewsEditionID(newsEditionDate,newsEditionType);
}
public void setNewsEditionID(NewsEditionID newsEditionID) {
this.newsEditionID = newsEditionID;
}
public Date getNewsEditionDate() {
return newsEditionDate;
}
public void setNewsEditionDate(Date newsEditionDate) {
this.newsEditionDate = newsEditionDate;
}
public String getNewsEditionType() {
return newsEditionType;
}
public void setNewsEditionType(String newsEditionType) {
this.newsEditionType = newsEditionType;
}
public String getNewsItemTitle() {
return newsItemTitle;
}
public void setNewsItemTitle(String newsItemTitle) {
this.newsItemTitle = newsItemTitle;
}
public String getNewsItemLinkText() {
return newsItemLinkText;
}
public void setNewsItemLinkText(String newsItemLinkText) {
this.newsItemLinkText = newsItemLinkText;
}
public String getNewsItemLink() {
return newsItemLink;
}
public void setNewsItemLink(String newsItemLink) {
this.newsItemLink = newsItemLink;
}
public String getNewsItemText() {
return newsItemText;
}
public void setNewsItemText(String newsItemText) {
this.newsItemText = newsItemText;
}
public String getNewsItemImg() {
return newsItemImg;
}
public void setNewsItemImg(String newsItemImg) {
this.newsItemImg = newsItemImg;
}
public NewsEdition getNewsEdition() {
return newsEdition;
}
public void setNewsEdition(NewsEdition newsEdition) {
this.newsEdition = newsEdition;
}
public NewsItemMedia getNewsItemMedia() {
return newsItemMedia;
}
public void setNewsItemMedia(NewsItemMedia newsItemMedia) {
this.newsItemMedia = newsItemMedia;
}
}
|