« Return to Thread: Grails/GORM + getter without setter

Re: Grails/GORM + getter without setter

by Matthias Quasthoff-2 :: Rate this Message:

Reply to Author | View in Thread

Chris, thanks but groovyc will the complain about the return type, which
is defined as URI by the RDFResource interface. Is there a way to work
around this? (Nevertheless I'm happy with the transients solution).

Cheers
Matthias

Chris Chen schrieb:

> You can also just do declare the method as a "def" and don't need to
> worry about transients at all.
>
> def getURI() {
>   ...
> }
>
> This will not be recognized as a hibernate property method.
>
> -chris
>
> On Mar 11, 2008, at 4:37 AM, Matthias Quasthoff wrote:
>
>> Just found out:
>>
>> class User implements hpi.its.util.afterglow.semantics.RDFResource {
>>    static transients = [ 'URI' ]
>>    ...
>>    public java.net.URI getURI() {
>>       urlService.createURI(this)
>>    }
>> }
>>
>> works fine. :)
>>
>> Matthias
>>
>>
>> Matthias Quasthoff schrieb:
>>> Hi all,
>>> I'd like a domain class implement some Java interface:
>>>> class User implements hpi.its.util.afterglow.semantics.RDFResource
>>>> {     ...
>>>>    public java.net.URI getURI() {
>>>>        urlService.createURI(this)
>>>>    }
>>>> }
>>> But now, Hibernate complains there is no setter:
>>>> Error creating bean with name 'sessionFactory': Invocation of init
>>>> method failed; nested exception is
>>>> org.hibernate.PropertyNotFoundException: Could not find a setter for
>>>> property URI in class User:
>>> How can one specify that GORM should ignore getURI? Is there
>>> something else I'm missing?
>>> Thanks for your help,
>>> Matthias
>>> ---------------------------------------------------------------------
>>> To unsubscribe from this list, please visit:
>>>   http://xircles.codehaus.org/manage_email
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>   http://xircles.codehaus.org/manage_email
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>
>


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


 « Return to Thread: Grails/GORM + getter without setter