I have an entity thus: @Entity @Table{val name = "cocktails"} class Cocktail extends BaseEntity { @Id @GeneratedValue{val strategy = GenerationType.AUTO} var id : Long = _
var name : String = "" var description : String = "" var ingredients : String = "" @Column{val name = "file_name"} var fileName : String = "" @Column{val name = "is_archived"} var isArchived : Boolean = false @Type{val `type` = "com.xxx.model.CocktailGroupType"} @Column{val name="cocktail_group"} var cocktailGroup: CocktailGroup.Value = CocktailGroup.Originals } Which uses this enumeration: object CocktailGroup extends Enumeration with Enumv { val Originals = Value("Originals") val Contemporaries = Value("Contemporaries") val Classics = Value("Classics") val Others = Value("Others") } class CocktailGroupType extends EnumvType(CocktailGroup) {} Which is queried thus in orm.xml: <named-query name="findCocktailsByGroup"> <query><![CDATA[from Cocktail c where c.isArchived = false and c.cocktailGroup = :cocktailGroup order by c.name]]></query> </named-query> And called from CocktailOps.scala: 120: val cocktails = Model.createNamedQuery[Cocktail]( "findCocktailsByGroup", "cocktailGroup" -> "Originals").findAll Using Enumv: trait Enumv { this: Enumeration => private var nameDescriptionMap = scala.collection.mutable.Map[String, String]() def Value(name: String, desc: String) : Value = { nameDescriptionMap += (name -> desc) new Val(name) } def getDescriptionOrName(ev: this.Value) = { try { nameDescriptionMap(""+ev) } catch { case e: NoSuchElementException => ev.toString } } def getNameDescriptionList = this.elements.toList.map( v => (v.toString, getDescriptionOrName(v) ) ).toList } And EnumvType: abstract class EnumvType(val et: Enumeration with EnumTrait) extends UserType { val SQL_TYPES = Array({Types.VARCHAR}) override def sqlTypes() = SQL_TYPES override def returnedClass = classOf[et.Value] override def equals(x: Object, y: Object): Boolean = { return x == y } override def hashCode(x: Object) = x.hashCode override def nullSafeGet(resultSet: ResultSet, names: Array[String], owner: Object): Object = { val value = resultSet.getString(names(0)) if (resultSet.wasNull()) return null else { return et.valueOf(value) } } override def nullSafeSet(statement: PreparedStatement, value: Object, index: Int): Unit = { if (value == null) { statement.setNull(index, Types.VARCHAR) } else { val en = value.toString statement.setString(index, en) } } override def deepCopy(value: Object): Object = value override def isMutable() = false override def disassemble(value: Object) = value.asInstanceOf[Serializable] override def assemble(cached: Serializable, owner: Object): Serializable = cached override def replace(original: Object, target: Object, owner: Object) = original } Which gets me this error: Exception occured while processing /drinks/ Message: javax.persistence.PersistenceException: org.hibernate.PropertyAccessException: could not set a field value by reflection setter of com.xxx.model.Cocktail.cocktailGroup org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:630) org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:75) com.xxx.model.ScalaQuery.getResultList(JPA.scala:82) com.xxx.model.ScalaQuery.findAll(JPA.scala:77) com.xxx.snippet.CocktailOps.originals(CocktailOps.scala:120) I have tried everything I can think of. This used to work before the recent switch to 2.7.3. Can anyone spot the problem? Thanks. Website down. Am really screwed here. Chas. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---