I tried that before and I got compilation errors, but this time I did a
"maven clean test" and it all compiled and tested fine. I must have had some
artifact in my targets dir :(

Thanks again for the help!

Derek

On Thu, Oct 2, 2008 at 9:28 PM, Oliver <[EMAIL PROTECTED]> wrote:

>
>
> On Thu, Oct 2, 2008 at 11:07 PM, Derek Chen-Becker <[EMAIL PROTECTED]>wrote:
>
>> OK, I've run into problems again now that I'm trying to actually use the
>> enumerations. In my book class I have the variable defined as:
>>
>>   @Type{val `type` = "com.foo.jpaweb.model.GenreType"}
>>   var genre = Genre.unknown
>>
>
> Enumv.Value(name: String, desc: String) should be returning a type of Value
> (Val is the implementation). I'll fix this, or you can.
>
>>
>> [WARNING]  found   : com.foo.jpaweb.model.Genre.Value
>> [WARNING]  required: com.foo.jpaweb.model.Genre.Val
>>
>> I tried changing the variable definition to
>>
>> var genre : Genre.Value = Genre.unknown
>>
>> But then I get a runtime error when I run my unit tests:
>>
>> java.lang.NoSuchMethodError:
>> com.foo.jpaweb.model.Book.genre_$eq(Lscala/Enumeration$Val;)V
>>
>
> I don't get this error, can you supply me the test code?
>
>
>>
>> It appears that setting genre to Genre.unknown makes its type "Genre.Val"
>> instead of "Genre.Value", but I have no idea how to fix it at this point.
>>
>> Thanks,
>>
>> Derek
>>
>>
>>
>>
>> On Wed, Oct 1, 2008 at 11:38 PM, Derek Chen-Becker <[EMAIL PROTECTED]
>> > wrote:
>>
>>> Doh. I missed where you had extended it. It works now that I'm using it
>>> correctly (imagine that!)
>>>
>>> Thanks much,
>>>
>>> Derek
>>>
>>>
>>> On Wed, Oct 1, 2008 at 5:08 PM, Oliver <[EMAIL PROTECTED]> wrote:
>>>
>>>> You have to extend it - I did it at the top of the model, but it
>>>> probably makes sense to create a separate file(s).
>>>> So Gender would have a corresponding type
>>>> class GenderType extends EnumvType(Gender) {}
>>>>
>>>> and then you can use
>>>>   @Type{val `type`="com.foo.jpaweb.model.GenderType"}
>>>>
>>>> I hadn't coded a user type in Scala before either and I couldn't find a
>>>> way to generically do all enumerations as one user type - Scala is just too
>>>> strict.
>>>>
>>>> hope that helps
>>>>
>>>> Oliver
>>>>
>>>> On Thu, Oct 2, 2008 at 6:58 AM, Derek Chen-Becker <
>>>> [EMAIL PROTECTED]> wrote:
>>>>
>>>>> Hmmm. Oliver, I'm working on using the UserType you wrote now, but when
>>>>> I try to test it, I'm getting this error:
>>>>>
>>>>> org.hibernate.MappingException: Cannot instantiate custom type:
>>>>> com.foo.jpaweb.model.EnumvType
>>>>>
>>>>> At first I thought this was because EnumvType was abstract, but
>>>>> changing that didn't do anything. I've set the property on the Book class
>>>>> as:
>>>>>
>>>>>   @Type{val `type` = "com.foo.jpaweb.model.EnumvType"}
>>>>>   var genre = Genre.unknown
>>>>>
>>>>> Is the not correct? Any ideas? I've only ever used Hibernate Types that
>>>>> were written in Java, so I wasn't sure if that might also be an issue...
>>>>>
>>>>> Derek
>>>>>
>>>>>
>>>>> On Mon, Sep 22, 2008 at 8:29 AM, Derek Chen-Becker <
>>>>> [EMAIL PROTECTED]> wrote:
>>>>>
>>>>>> Looks good. In keeping with the theme of a Library catalog I'm going
>>>>>> to rework "Gender" as "Genre" and add things like Mystery, Horror, 
>>>>>> Comedy,
>>>>>> Childrens' , etc. I think I can just put the Money on as a purchase 
>>>>>> price.
>>>>>>
>>>>>> Thanks,
>>>>>>
>>>>>> Derek
>>>>>>
>>>>>> On Sun, Sep 21, 2008 at 1:19 AM, Oliver Lambert <[EMAIL PROTECTED]>wrote:
>>>>>>
>>>>>>> Hi,
>>>>>>>
>>>>>>> I've extended the JPA Demo project to include hibernate mappings for
>>>>>>> Money and Enumerations.
>>>>>>> The example money is Australian, but its simple enough to add other
>>>>>>> currencies.
>>>>>>> The example enumeration is for Gender - I've mapped the name of the
>>>>>>> enumeration rather than
>>>>>>> the ordinal value and extended it to include a description field,
>>>>>>> valueOf method and list of name value pairs.
>>>>>>>
>>>>>>> Hope its of use
>>>>>>> Oliver
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> On 21/09/2008, at 1:40 PM, Jorge Ortiz wrote:
>>>>>>>
>>>>>>> >
>>>>>>> > On Sat, Sep 20, 2008 at 9:14 AM, Oliver Lambert <[EMAIL PROTECTED]>
>>>>>>> > wrote:
>>>>>>> >>
>>>>>>> >> I need this too so I might have a go at implementing it. Does lift
>>>>>>> >> persist
>>>>>>> >> enumerations (cant see a mapper it)
>>>>>>> >
>>>>>>> > There's a MappedEnum class in MappedInt.scala
>>>>>>>
>>>>>>> Thanks for this - I should have looked more
>>>>>>> >
>>>>>>> >
>>>>>>> > --j
>>>>>>> >
>>>>>>> > >
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>
>>
>> >>
>>
>
> --~--~---------~--~----~------------~-------~--~----~
> 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
> [EMAIL PROTECTED]<[EMAIL PROTECTED]>
> For more options, visit this group at
> http://groups.google.com/group/liftweb?hl=en
> -~----------~----~----~----~------~----~------~--~---
>
>

--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to