Problems with M3 hasOne association - Anyone using it?

View: New views
3 Messages — Rating Filter:   Alert me  

Problems with M3 hasOne association - Anyone using it?

by Lucas Teixeira :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello all,

I've just upgraded my application to Grails 1.2-M3 to use the hasOne association, but I'm having some problems.

In a simple association, I have that 1 "Unidade" has 1 "UnidadeSiteData" instance and I want to have the fk stored in the child class as it is written here: http://grails.org/doc/latest/ref/Domain%20Classes/hasOne.html

So, my child class is written like this:

class UnidadeSiteData {
   
    Unidade unidade
    (... other fields)
}

and my parent class, it is referring it this way:

class Unidade implements Taggable {

   (... other fields)
   static hasOne = [siteData:UnidadeSiteData]
}

But when I run the app, during the database update process, a column for this association is being created in the "Unidade" table, with a name "site_data_id" (WTF?)

Why is this happening? Is someone using the hasOne association?

I've tried to use the mappedBy closure to handle the association way but got the same problem.

Thanks in advance.

[]s,

Lucas Frare Teixeira .·.
- lucastex@...
- lucastex.com.br
- blog.lucastex.com
- twitter.com/lucastex

Re: Problems with M3 hasOne association - Anyone using it?

by Lucas Teixeira :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

is anybody using hasOne successfully ?

[]s,


Lucas Frare Teixeira .·.
- lucastex@...
- lucastex.com.br
- blog.lucastex.com
- twitter.com/lucastex


On Thu, Nov 5, 2009 at 9:55 PM, Lucas F. A. Teixeira <lucastex@...> wrote:
Hello all,

I've just upgraded my application to Grails 1.2-M3 to use the hasOne association, but I'm having some problems.

In a simple association, I have that 1 "Unidade" has 1 "UnidadeSiteData" instance and I want to have the fk stored in the child class as it is written here: http://grails.org/doc/latest/ref/Domain%20Classes/hasOne.html

So, my child class is written like this:

class UnidadeSiteData {
   
    Unidade unidade
    (... other fields)
}

and my parent class, it is referring it this way:

class Unidade implements Taggable {

   (... other fields)
   static hasOne = [siteData:UnidadeSiteData]
}

But when I run the app, during the database update process, a column for this association is being created in the "Unidade" table, with a name "site_data_id" (WTF?)

Why is this happening? Is someone using the hasOne association?

I've tried to use the mappedBy closure to handle the association way but got the same problem.

Thanks in advance.

[]s,

Lucas Frare Teixeira .·.
- lucastex@...
- lucastex.com.br
- blog.lucastex.com
- twitter.com/lucastex


Re: Re: Problems with M3 hasOne association - Anyone using it?

by Graeme Rocher-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Raise a JIRA with an example that reproduces the issue

Cheers

On Fri, Nov 6, 2009 at 4:51 PM, Lucas F. A. Teixeira <lucastex@...> wrote:

> is anybody using hasOne successfully ?
> []s,
>
> Lucas Frare Teixeira .·.
> - lucastex@...
> - lucastex.com.br
> - blog.lucastex.com
> - twitter.com/lucastex
>
>
> On Thu, Nov 5, 2009 at 9:55 PM, Lucas F. A. Teixeira <lucastex@...>
> wrote:
>>
>> Hello all,
>>
>> I've just upgraded my application to Grails 1.2-M3 to use the hasOne
>> association, but I'm having some problems.
>>
>> In a simple association, I have that 1 "Unidade" has 1 "UnidadeSiteData"
>> instance and I want to have the fk stored in the child class as it is
>> written here: http://grails.org/doc/latest/ref/Domain%20Classes/hasOne.html
>>
>> So, my child class is written like this:
>>
>> class UnidadeSiteData {
>>
>>     Unidade unidade
>>     (... other fields)
>> }
>>
>> and my parent class, it is referring it this way:
>>
>> class Unidade implements Taggable {
>>
>>    (... other fields)
>>    static hasOne = [siteData:UnidadeSiteData]
>> }
>>
>> But when I run the app, during the database update process, a column for
>> this association is being created in the "Unidade" table, with a name
>> "site_data_id" (WTF?)
>>
>> Why is this happening? Is someone using the hasOne association?
>>
>> I've tried to use the mappedBy closure to handle the association way but
>> got the same problem.
>>
>> Thanks in advance.
>>
>> []s,
>>
>> Lucas Frare Teixeira .·.
>> - lucastex@...
>> - lucastex.com.br
>> - blog.lucastex.com
>> - twitter.com/lucastex
>
>



--
Graeme Rocher
Head of Grails Development
SpringSource - A Division of VMware
http://www.springsource.com

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

    http://xircles.codehaus.org/manage_email