I'm trying to get three simple beans to map to each other and am getting the 
following exception (v4.03SP1 EJB RFC 5):

(InvocationTargetException).....

Caused by: org.hibernate.AnnotationException: com.sms.srs.entity.Attribute 
collection not yet supported: com.sms.srs.entity.AttributeNameattr
        at 
org.hibernate.cfg.annotations.CollectionBinder.getCollectionBinder(CollectionBinder.java:197)
        at 
org.hibernate.cfg.AnnotationBinder.processElementAnnotations(AnnotationBinder.java:1175)
        at 
org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:629)
        at 
org.hibernate.cfg.AnnotationConfiguration.processArtifactsOfType(AnnotationConfiguration.java:276)


The classes involved are:


  | @Entity
  | @Table (name="ship")
  | public class Ship {
  | 
  |     public int getImo() {
  |             return imo;
  |     }
  | 
  |     public void setImo(int imo) {
  |             this.imo = imo;
  |     }
  | 
  |     @Id @GeneratedValue(strategy= GenerationType.AUTO)
  |     public int getId() {
  |             return id;
  |     }
  | 
  |     public void setId(int id) {
  |             this.id = id;
  |     }
  | 
  |     @CollectionOfElements
  |     public Collection<Attribute> getAttributes() {
  |             return attributes;
  |     }
  | 
  |     public void setAttributes(Collection<Attribute> attributes) {
  |             this.attributes = attributes;
  |     }
  | 
  |     private int imo;
  |     private int id;
  |     private Collection<Attribute> attributes;
  | 
  | 
  | 
  | }
  | 


  | @Entity
  | @Embeddable
  | @Table (name="attribute")
  | public class Attribute {
  | 
  |     @Id @GeneratedValue(strategy= GenerationType.AUTO)
  |     public int getId() {
  |             return id;
  |     }
  | 
  |     public void setId(int id) {
  |             this.id = id;
  |     }
  | 
  |    @ManyToOne
  |    @JoinColumn(name = "id")
  |     public AttributeName getNameid() {
  |             return nameid;
  |     }
  | 
  |     public void setNameid(AttributeName nameid) {
  |             this.nameid = nameid;
  |     }
  | 
  |     public String getValue() {
  |             return value;
  |     }
  | 
  |     public void setValue(String value) {
  |             this.value = value;
  |     }
  | 
  |     @ManyToOne
  |     @JoinColumn(name = "id")
  |     public Ship getShip() {
  |             return ship;
  |     }
  | 
  |     public void setShip(Ship ship) {
  |             this.ship = ship;
  |     }
  | 
  |     public long getStartdate() {
  |             return startdate;
  |     }
  | 
  |     public void setStartdate(long startdate) {
  |             this.startdate = startdate;
  |     }
  | 
  |     public long getEnddate() {
  |             return enddate;
  |     }
  | 
  |     public void setEnddate(long enddate) {
  |             this.enddate = enddate;
  |     }
  | 
  |     private Ship ship;
  |     private int id;
  |     private AttributeName nameid;
  |     private String value;
  |     private long startdate;
  |     private long enddate;
  | 
  | }
  | 


  | 
  | @Entity
  | @Table (name="attributename")
  | public class AttributeName {
  | 
  |     @Id @GeneratedValue(strategy= GenerationType.AUTO)
  |     public int getId() {
  |             return id;
  |     }
  | 
  |     public void setId(int id) {
  |             this.id = id;
  |     }
  | 
  |     //Name of the attribute
  |     public String getName() {
  |             return name;
  |     }
  | 
  |     public void setName(String name) {
  |             this.name = name;
  |     }
  | 
  |     @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER, 
mappedBy="order")
  |     public Attribute getAttr() {
  |             return attr;
  |     }
  | 
  |     public void setAttr(Attribute attr) {
  |             this.attr = attr;
  |     }
  | 
  |     private Attribute attr;
  |     private int id;
  |     private String name;
  | 
  | }
  | 

With my persistence.xml:


  | <persistence>
  |    <persistence-unit name="srsentity">
  |        <jta-data-source>java:/MySqlDS</jta-data-source>
  | 
  |        <properties>
  |             <property name="hibernate.dialect" 
value="org.hibernate.dialect.MySQLDialect"/>
  |             <property name="hibernate.hbm2ddl.auto" value="update"/>
  |        </properties>
  |    </persistence-unit>
  | </persistence>
  | 

According to the hibernate annotation documentation, if I use a collection of 
elements, I should use @CollectionOfElements instead of @OneToMany.... because 
the EJB spec does not support them...which I'm doing (a Ship has a collection 
of Attribute)

I'd really appreciate some help here.

Thanks.

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

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


-------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to