-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: insert/update attribute of id element
PostPosted: Wed Mar 09, 2005 5:41 pm 
Newbie

Joined: Thu Sep 16, 2004 4:35 pm
Posts: 6
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;
}
}


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.