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

Re: Grails/GORM + getter without setter

by Chris Chen :: Rate this Message:

Reply to Author | View in Thread

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


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