All,

Below are the contents of three classfiles. The first and second generated
by BNFC from the grammar
here<http://github.com/leithaus/stockholm/blob/c64f6287a986c8f9f05220e5d3efd5dbfaad9c69/src/main/bnfc/rlambda.cf>.
The second is a subclass generated from the first to provide persistence to
the abstract syntax. My procedure is working for everything but those
classes that contain collections. The call to hibernate via the
maven-hibernate-plugin is generating the following error.

[INFO]
------------------------------------------------------------------------
[ERROR] FATAL ERROR
[INFO]
------------------------------------------------------------------------
[INFO] org.hibernate.AnnotationException: Illegal attempt to map a non
collection as a @OneToMany, @ManyToMany or @CollectionOfElements:
com.biosimilarity.reflection.model.rlambda.Absyn.persistence.sql.AbstractionResource.listvariableexpr_
[INFO]
------------------------------------------------------------------------
[INFO] Trace
javax.persistence.PersistenceException: org.hibernate.AnnotationException:
Illegal attempt to map a non collection as a @OneToMany, @ManyToMany or
@CollectionOfElements:
com.biosimilarity.reflection.model.rlambda.Absyn.persistence.sql.AbstractionResource.listvariableexpr_
    at
org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:247)
    at
org.codehaus.mojo.hibernate3.configuration.JPAComponentConfiguration.createConfiguration(JPAComponentConfiguration.java:26)
...

However, as the contents of the second class indicate, the member is clearly
a collection. Is it that hibernate can't deal with subclasses of
collections?

Best wishes,

--greg


// class generated for abstractions
package com.biosimilarity.reflection.model.rlambda.Absyn; // Java Package
generated by the BNF Converter.

public class Abstraction extends Expression {
  public final ListVariableExpr listvariableexpr_;
  public final Expression expression_;

  public Abstraction(ListVariableExpr p1, Expression p2) { listvariableexpr_
= p1; expression_ = p2; }

  public <R,A> R
accept(com.biosimilarity.reflection.model.rlambda.Absyn.Expression.Visitor<R,A>
v, A arg) { return v.visit(this, arg); }

  public boolean equals(Object o) {
    if (this == o) return true;
    if (o instanceof
com.biosimilarity.reflection.model.rlambda.Absyn.Abstraction) {
      com.biosimilarity.reflection.model.rlambda.Absyn.Abstraction x =
(com.biosimilarity.reflection.model.rlambda.Absyn.Abstraction)o;
      return this.listvariableexpr_.equals(x.listvariableexpr_) &&
this.expression_.equals(x.expression_);
    }
    return false;
  }

  public int hashCode() {
    return
37*(this.listvariableexpr_.hashCode())+this.expression_.hashCode();
  }


}

// container class generated to hold lists of variables
package com.biosimilarity.reflection.model.rlambda.Absyn; // Java Package
generated by the BNF Converter.

public class ListVariableExpr extends java.util.LinkedList<VariableExpr> {
}


// Generated by stockholm to add persistence to abstraction class

package com.biosimilarity.reflection.model.rlambda.Absyn.persistence.sql;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import java.util.Iterator;
import java.net.URI;
import com.biosimilarity.reflection.model.rlambda.Absyn.*;
import com.biosimilarity.reflection.model.rlambda.Absyn.persistence.sql.*;

@Entity
@Table(name = "Abstraction_table", catalog = "rlambda_production",
uniqueConstraints = { @UniqueConstraint(columnNames = "uuid") })
public class AbstractionResource extends Abstraction {

    private String uuid;

    private String id;

    public AbstractionResource(ListVariableExpr listvariableexpr_,
Expression expression_) {
        super(listvariableexpr_, expression_);
    }

    @Id
    @Column(name = "uuid", unique = true, nullable = false, insertable =
true, updatable = true)
    public String getUuid() {
        return this.uuid;
    }

    public void setUuid(String id) {
        this.uuid = id;
    }

    @Id
    @Column(name = "id", unique = true, nullable = false, insertable = true,
updatable = true)
    public String getId() {
        return this.uuid;
    }

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

    @OneToMany(cascade = { CascadeType.ALL }, fetch = FetchType.LAZY,
mappedBy = "AbstractionResource")
    public ListVariableExpr getListvariableexpr_() {
        return this.listvariableexpr_;
    }

    @Column(name = "expression_", unique = false, nullable = true,
insertable = true, updatable = true)
    public Expression getExpression_() {
        return this.expression_;
    }
}


-- 
L.G. Meredith
Managing Partner
Biosimilarity LLC
1219 NW 83rd St
Seattle, WA 98117

+1 206.650.3740

http://biosimilarity.blogspot.com

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to