I have question concerning mappings in EJB3. I found examples with mappings, 
where the values are entity beans. I would like to define a mapping with 
primitive types like java.lang.String.  My example is the following:

  package bean;

  import java.io.Serializable;
  import java.util.Map;
  import javax.persistence.*;
  import org.hibernate.annotations.CollectionOfElements;

  @Entity
  public class Test implements Serializable {

     private int                                      id;
     private Map<java.lang.String,java.lang.String>   texts;
   
     @Id 
     @GeneratedValue(strategy=GenerationType.AUTO)
     public int getId()
     {
        return id;
     }

     public void setId(int id)
     {
        this.id = id;
     }

     @CollectionOfElements 
     @MapKey
     public Map<java.lang.String,java.lang.String> getTexts()
     {
          return texts;  
     }
   
     public void setTexts(Map<java.lang.String,java.lang.String> texts)
     {
           this.texts = texts;
     }
  }

and I use jboss-4.0.4RC1 with the "all" configuration. While deploying I 
get with the mentioned settings the following errors:

19:17:28,812 WARN  [ServiceController] Problem starting service 
persistence.units:unitName=tempdb
java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
....
Caused by: org.hibernate.AnnotationException: Associated class not found: 
java.lang.String
        at 
org.hibernate.cfg.annotations.MapBinder.bindKeyFromAssociationTable(MapBinder.java:65)
        at org.hibernate.cfg.annotations.MapBinder.access$000(MapBinder.java:32)
        at 
org.hibernate.cfg.annotations.MapBinder$1.secondPass(MapBinder.java:55)
        at 
org.hibernate.cfg.CollectionSecondPass.doSecondPass(CollectionSecondPass.java:35)
        at 
org.hibernate.cfg.annotations.CollectionBinder.bind(CollectionBinder.java:331)
        at 
org.hibernate.cfg.AnnotationBinder.processElementAnnotations(AnnotationBinder.java:1296)
        at 
org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:629)
...

Please could you tell me how to define a mapping with Strings as values?

Thanks in advance!

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3925413#3925413

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3925413


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to