associate() failing with squerylrecord

53 views
Skip to first unread message

Owen Fraser-Green

unread,
Feb 17, 2011, 6:39:54 PM2/17/11
to lif...@googlegroups.com
Hi,

I have a oneToMany association between to squerylrecord classes (User 1-M UserAction) and calling user.userActions.associate(userAction) throws the following error:

ERROR - Exception being returned to browser when processing /ajax_request/F1130731697040F3M/: Message: java.lang.RuntimeException: UserAction.user_id:java.lang.Long was invoked with value '1771' of type java.lang.Long on object of type myenergy.model.UserAction
java.lang.IllegalArgumentException: Can not set final net.liftweb.record.field.LongField field myenergy.model.UserAction.userId to java.lang.Long
        scala.Predef$.error(Predef.scala:58)
        org.squeryl.internals.FieldMetaData.set(FieldMetaData.scala:309)
        org.squeryl.dsl.QueryDsl$OneToManyRelationImpl$$anon$3.assign(QueryDsl.scala:528)
        org.squeryl.dsl.QueryDsl$OneToManyRelationImpl$$anon$3.associate(QueryDsl.scala:532)
        org.squeryl.dsl.StatefulOneToMany.associate(ManyToMany.scala:59)
...

Maybe I just missed something but It appears to me as though Squeryl is trying to do "userAction.userId = user.id" when it ought to be calling something like "userAction.userId(user.id)"

Cheers,
Owen

Michael Gottschalk

unread,
Feb 18, 2011, 7:37:26 AM2/18/11
to Lift
Hi Owen,

can you given a bit more details?
The mapped record classes and the schema definition?

Cheers,
Michael

Michael Gottschalk

unread,
Feb 18, 2011, 7:48:09 AM2/18/11
to Lift
Hi Owen,

I could already reproduce the problem myself.
I will try to fix it. Can you create a ticket on assembla?

As a workaround, you can just set the userId in the UserAction object
manually and then save the UserAction object.

Cheers,
Michael

On 18 Feb., 00:39, Owen Fraser-Green <o...@fraser-green.com> wrote:

Robert Szułczyński

unread,
Oct 9, 2011, 5:28:55 AM10/9/11
to lif...@googlegroups.com
Hi Michael,

Was anything done with this issue? I couldn't find any ticket on assembla, and I'm having the same problem as Owen described.
I know there is workaround, but it would be cool if associate work.

Cheers,
Robert

David Whittaker

unread,
Oct 9, 2011, 3:04:00 PM10/9/11
to lif...@googlegroups.com
Robert,

I don't see a ticket either.  I've been handling most of the Squeryl support lately.  Can you post a small example to Github so I can take a look?  http://www.assembla.com/spaces/liftweb/wiki/Posting_example_code

-Dave

2011/10/9 Robert Szułczyński <rszulc...@gmail.com>
--
Lift, the simply functional web framework: http://liftweb.net
Code: http://github.com/lift
Discussion: http://groups.google.com/group/liftweb
Stuck? Help us help you: https://www.assembla.com/wiki/show/liftweb/Posting_example_code

Ján Raska

unread,
Oct 9, 2011, 4:32:57 PM10/9/11
to lif...@googlegroups.com
Hi Dave,

I've mentioned the same bug in this thread https://groups.google.com/forum/#!searchin/liftweb/DDL$20DecimalField/liftweb/fQ0HupSGkXY/I9WxtGa4itQJ in my post from 11th August 2011. I've added an example of this issue into the example I've used for that DecimalField issue:  https://github.com/rusho/stringFkSquerylTest 

At line 62, there is a call for assign() method that causes an exception.

Jan

David Whittaker

unread,
Oct 9, 2011, 5:39:35 PM10/9/11
to lif...@googlegroups.com
Thanks  Ján.  I'll take a look and get back to you.

-Dave

Robert Szułczyński

unread,
Oct 9, 2011, 6:17:10 PM10/9/11
to lif...@googlegroups.com
Hi David, thanks for answer.

Ján already gave example, but here is mine (it's basically same as Jáns): https://github.com/rszulczynski/squerylrecord_associate_problem

Robert

David Whittaker

unread,
Oct 10, 2011, 2:30:15 PM10/10/11
to lif...@googlegroups.com
Thanks guys.  I'm working on a fix now, should be in Master soon.

Hi David, thanks for answer.

Ján already gave example, but here is mine (it's basically same as Jáns): https://github.com/rszulczynski/squerylrecord_associate_problem

Robert

--

David Whittaker

unread,
Oct 11, 2011, 5:23:27 PM10/11/11
to lif...@googlegroups.com
I just pushed the fix.  It should be in 2.4-SNAPSHOT builds shortly and I'd appreciate it if you could test it out.

Thanks,
Dave

Ján Raska

unread,
Oct 11, 2011, 6:03:55 PM10/11/11
to lif...@googlegroups.com
Hi Dave,

thanks for the fix, I've tested it out and it seems to run without problems so far 

Jan

Robert Szułczyński

unread,
Oct 12, 2011, 6:16:43 AM10/12/11
to lif...@googlegroups.com
It works great :)
Thanks David.

Robert
Reply all
Reply to author
Forward
0 new messages