-->
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.  [ 2 posts ] 
Author Message
 Post subject: What is wrong with that mapping?
PostPosted: Wed Nov 08, 2006 3:35 am 
Beginner
Beginner

Joined: Tue Feb 08, 2005 1:29 pm
Posts: 20
Hibernate version: v3.1.2

Mapping documents:
<hibernate-mapping package="com.etil.sudetp.business.manager.gameaccount.impl" >
<class name="AccountFieldMap" table="accountfieldmap" >
<property name="fieldId" type="string" column="FIELDID" />
<property name="status" type="string" column="STATUS" />
<property name="value" type="string" column="VALUE" />
<one-to-one name="account" property-ref="accountId" />
</class>
<class name="Account" table="account" >
<cache usage="nonstrict-read-write"/>

<id name="accountId" unsaved-value="null" column="ACCOUNTID" >
<generator class="native"/>
</id>
<property name="timestampDB" type="long" column="TIMESTAMP" />
<property name="date" type="java.util.Date" column="DATE" />
<property name="description" type="string" column="DESCRIPTION" />
<property name="gameId" type="string" column="GAMEID" />
<property name="serverId" type="string" column="SERVERID" />
<map name="accountFields" table="ACCOUNTFIELDSMAPPING">
<key column="fieldId" not-null="true"/>
<map-key column="fieldId" type="string"/>
<one-to-many class="AccountFieldMap"/>
</map>
</class>
</hibernate-mapping>

Java Classes:
public class Account extends Object implements IAccount, IAuditable {
private String accountId;
private Timestamp timestamp;
private Date date;
private String description;
private String gameId;
private String serverId;
private Map accountFieldMap;
...}
public class AccountFieldMap extends Object implements IAccountFieldMap {
private Account account;
private String fieldId;
public String status;
public String value;
...}


Name and version of the database you are using: MySQL 4.1
CREATE TABLE `account` (
`ACCOUNTID` int(10) unsigned NOT NULL auto_increment,
`TIMESTAMP` bigint(20) unsigned NOT NULL default '0',
`DATE` datetime default NULL,
`DESCRIPTION` char(60) NOT NULL default '',
`GAMEID` int(10) NOT NULL,
`SERVERID` int(10) NOT NULL,
PRIMARY KEY (`ACCOUNTID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE `accountfieldmap` (
`ACCOUNTID` int(10) unsigned NOT NULL,
`FIELDID` int(10) unsigned NOT NULL,
`STATUS` char(1) NOT NULL default 'N',
`VALUE` char(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

When I am starting my JBOSS server, I have the following error message:
[java] 07:27:48,028 INFO [Configuration] Reading mappings from resource: com/etil/sudetp/business/manager/gameaccount/impl/Account.hbm.xml
[java] 07:27:48,098 INFO [HbmBinder] Mapping class: com.etil.sudetp.business.manager.gameaccount.impl.Account -> account
[java] 07:27:48,179 INFO [Configuration] Reading mappings from resource: com/etil/sudetp/business/manager/gameaccount/impl/AccountFieldMap.hbm.xml
[java] 07:27:48,229 ERROR [XMLHelper] Error parsing XML: XML InputStream(10) The content of element type "class" must match "(meta*,subselect?,cache?,synchronize*,comment?,tuplizer*,(id|composite-id),discriminator?,natural-id?,(version|timestamp)?,(property|many-to-one|one-to-one|component|dynamic-component|properties|any|map|set|list|bag|idbag|array|primitive-array)*,((join*,subclass*)|joined-subclass*|union-subclass*),loader?,sql-insert?,sql-update?,sql-delete?,filter*,resultset*,(query|sql-query)*)".
[java] 07:27:48,269 ERROR [HibernateUtil] Initial SessionFactory creation failed.
[java] org.hibernate.MappingException: Could not read mappings from resource: com/etil/sudetp/business/manager/gameaccount/impl/AccountFieldMap.hbm.xml

Looking at it, I have all requested!

Cheers.
DvJ


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 08, 2006 4:07 am 
Regular
Regular

Joined: Tue May 16, 2006 3:32 am
Posts: 117
AccountFieldMap missing <id>/<composite-id> tag..


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

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.