-->
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: map index element must specify a type (?)
PostPosted: Wed Jul 22, 2009 8:44 am 
Newbie

Joined: Wed Jul 22, 2009 6:46 am
Posts: 3
Hi,

I am quite new to hibernate so this might be an newbe-problem:

I am trying to persist a collection (HashMap<String, byte[]>) with Hibernate. I am getting an

org.hibernate.MappingException: map index element must specify a type: eu.basi.fax.core.FaxCampaignImpl.jobs

Can anybody tell what this message means an how it can be recovered?

This is the mapping
Code:
<?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 package="eu.basi.fax.core">
   <class name="FaxCampaignImpl">
      <id name="id">
         <generator class="native" />
      </id>
      <property name="deleted" />
      <property name="name" />
      <property name="recipientGroup" />
      <property name="prio" />
      <map name="jobs" lazy="true">
         <key column="id" />
         <index column="basi_client_id" />
         <one-to-many class="gnu.hylafax.job.Job" />
      </map>
      <property name="start" />
      <property name="end" />
      <map name="documents" lazy="true">
         <key column="id" />
         <index column="fileName" />
         <element column="file" type="binary" />
      </map>
      <property name="status" />
   </class>
   <class name="gnu.hylafax.job.Job">
      <id name="id" column="jobId" />
      <property name="chopThreshold" />
      <property name="dialstring" />
      <property name="documentName" />
      <property name="fromUser" />
      <property name="jobInfo" />
      <property name="killtime" />
      <property name="maximumDials" />
      <property name="maximumTries" />
      <property name="notifyAddress" />
      <property name="notifyType" />
      <property name="pageChop" />
      <property name="pageDimension" />
      <property name="pageLength" />
      <property name="pageWidth" />
      <property name="priority" />
      <property name="retrytime" />
      <property name="tagline" />
      <property name="useTagline" />
      <property name="verticalResolution" />
   </class>
</hibernate-mapping>


The persistent class is:

Code:
public class FaxCampaignImpl implements FaxCampaign {
   private Integer id;
   private Boolean deleted;
   private String name;
   private String recipientGroup;
   private Integer prio;
   private Map<String, gnu.hylafax.Job> jobs;
   private Calendar start;
   private Calendar end;
   private HashMap<String, byte[]> documents;
   private Status status;

   public Integer getId() {
      return id;
   }
   public void setId(Integer id) {
      this.id = id;
   }
   public String getName() {
      return name;
   }
   public void setName(String name) {
      this.name = name;
   }
   public Map<String, gnu.hylafax.Job> getJobs() {
      return jobs;
   }
   public void setJobs(Map<String, gnu.hylafax.Job> jobs) {
      this.jobs = jobs;
   }
   public Calendar getStart() {
      return start;
   }
   public void setStart(Calendar start) {
      this.start = start;
   }
   public Calendar getEnd() {
      return end;
   }
   public void setEnd(Calendar end) {
      this.end = end;
   }
   public void setPrio(Integer prio) {
      this.prio = prio;
   }
   public Integer getPrio() {
      return prio;
   }
   public void setRecipientGroup(String recipientGroup) {
      this.recipientGroup = recipientGroup;
   }
   public String getRecipientGroup() {
      return recipientGroup;
   }
   public HashMap<String, byte[]> getDocuments() {
      return documents;
   }
   public void setDocuments(HashMap<String, byte[]> documents) {
      this.documents = documents;
   }
   public void setDeleted(Boolean deleted) {
      this.deleted = deleted;
   }
   public Boolean isDeleted() {
      return deleted;
   }
   public Status getStatus() {
      return status;
   }
   public void setStatus(Status status) {
      this.status = status;
   }
}


I would be very grateful if somebody could help!

regards
neurox


Top
 Profile  
 
 Post subject: Re: map index element must specify a type (?)
PostPosted: Wed Jul 22, 2009 9:32 am 
Newbie

Joined: Wed Jul 22, 2009 6:46 am
Posts: 3
I found the problem.

the mapping has to be like this:

Code:
      <map name="jobs" lazy="true">
         <key column="id" />
         <index column="basi_client_id" type="integer"/>
         <one-to-many class="gnu.hylafax.job.Job" />
      </map>


I hope this will help everbody who get stucked with this Exception.

regards
neurox


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.