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
|