I'm using Lift mapper on a smaller project. On a larger project -- which 
I expect to grow to as many as 100 tables in the database -- I am using 
JPA. I'm also using it because I want to know how it works. A lot of the 
work I do is pretty database intensive, with complex data models. One 
such site has ~120 tables with complex hierarchies.

I do like the mapper, and if it could act as a front end for JPA, that 
would be nice.

Chas.

David Pollak wrote:
> 
> 
> Charles F. Munat wrote:
>> I thought about that. Essentially, that's what Hibernate is supposed to 
>> do, though. It only saves the integer value. (At least, that's what 
>> @Enumerated(EnumType.ORDINAL) is supposed to mean, if I understand it 
>> correctly.)
>>
>>   
> Hibernate understands Java enumerations which are different from Scala 
> enumerations.
> 
> Just out of curiosity... why are you using JPA?  Most of the issues 
> you've been having with JPA are solved in Lift's Mapper.
> 
>> I'm still curious as to why the code I have doesn't work, but if no one 
>> else knows, then I guess I'll have to do it manually as you suggest.
>>
>> Thanks.
>>
>> Chas.
>>
>> David Pollak wrote:
>>   
>>> Rather than storing the Gender enumeration in the RDBMS, I'd suggest 
>>> storing the Int value of the enumeration.
>>>
>>>    @Column{val name="gender"}
>>>    var genderInt : Int = _
>>>
>>>
>>>     def gender: Gender = Gender(genderInt)
>>>     def gender_=(what: Gender.Value) = ....
>>>
>>>
>>>
>>> Charles F. Munat wrote:
>>>     
>>>> I'm still trying to get a Gender enumeration to work with JPA. The 
>>>> problem now seems to be on the JPA end (I'm using the JPADemo code that 
>>>> Derek provided).
>>>>
>>>> I get the following error:
>>>> javax.persistence.PersistenceException: org.hibernate.MappingException: 
>>>> Could not determine type for: scala.Enumeration$Value, for columns: 
>>>> [org.hibernate.mapping.Column(gender)]
>>>>
>>>> Here is the relevant code:
>>>>
>>>>
>>>> @serializable
>>>> object Gender extends Enumeration {
>>>>    type Gender = Value
>>>>    val Unknown = Value(0, "Unknown")
>>>>    val Male = Value(1, "Male")
>>>>    val Female = Value(2, "Female")
>>>> }
>>>>
>>>> import Gender._
>>>>
>>>> @Entity
>>>> @Table{val name = "USERS"}
>>>> class User {
>>>>    @Id
>>>>    @GeneratedValue{val strategy = GenerationType.AUTO}
>>>>    var id : Long = _
>>>>
>>>>    @Column{val name="NAME_LAST"}
>>>>    var nameLast : String = ""
>>>>
>>>>    @Column{val name="NAME_FIRST"}
>>>>    var nameFirst : String = ""
>>>>
>>>>    var username : String = ""
>>>>
>>>>    @Column{val name="EMAIL_ADDRESS"}
>>>>    var emailAddress : String = ""
>>>>
>>>>    @Enumerated(EnumType.ORDINAL)
>>>>    var gender : Gender = _
>>>>
>>>> ...
>>>> }
>>>>
>>>> Also, where is the best place to put the Gender enumeration so that it 
>>>> is visible both in the persistence project and in the webapp?
>>>>
>>>> Thanks for any and all help.
>>>>
>>>> Chas.
>>>>
>>>>   
>>>>       
>>>     
>>
>>
>>   
> 
> > 

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

Reply via email to