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 [email protected]
> 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 [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