Re: Batch updates require a single primay key?

66 views
Skip to first unread message

Maxime Lévesque

unread,
Apr 20, 2011, 4:56:34 PM4/20/11
to squeryl-co...@googlegroups.com

It's most certainly a bug, there isn't a case of batch update with a composite PK in the test suite which isn't good.
I would need to do some debugging to give you useful info on this, it is definitely a ticket worthy issue...

ML

On Wed, Apr 20, 2011 at 4:38 PM, David Whittaker <da...@iradix.com> wrote:
This line: https://github.com/max-l/Squeryl/blob/master/src/main/scala/org/squeryl/Table.scala#L179 seems to require that batch updates only be done on KeyedEntities where the primary key is a field (the left value).  I just tried doing a batch update on a KeyedEntity[CompositeKey....] and it blew up on me.  It doesn't seem like a single column primary key should be necessary but I'm not that familiar with the code and I'm having a bit of trouble following what happens next.  It seems like the primary key data is filtered from the updated field list only to be re-added before the list is flattened.  Can anyone point me in the right direction?  

David Whittaker

unread,
Apr 20, 2011, 4:38:17 PM4/20/11
to squeryl-co...@googlegroups.com

David Whittaker

unread,
Apr 20, 2011, 5:20:08 PM4/20/11
to squeryl-co...@googlegroups.com
Ok, created: https://www.assembla.com/spaces/squeryl/tickets/44-batch-update-cannot-be-performed-on-keyedentity%5Bcompositekey---%5D.  I'll dig a bit deeper myself when I've got a moment.

2011/4/20 Maxime Lévesque <maxime....@gmail.com>

Maxime Lévesque

unread,
Apr 20, 2011, 5:21:22 PM4/20/11
to squeryl-co...@googlegroups.com

Ok, here's what's happening :

the primaryKey field is of type : Option[Either[FieldMetaData,Method]]

but the code expects it only to be a
 Option[Left[FieldMetaData,None]]

when the PK is a composite, the Method (java.lang.reflect) is not None, we get a Right

so the code doesn't support the Method case


2011/4/20 Maxime Lévesque <maxime....@gmail.com>

David Whittaker

unread,
Apr 20, 2011, 5:27:48 PM4/20/11
to squeryl-co...@googlegroups.com
Hey Max,

That's what I assumed was happening, I just couldn't figure out why it needed to know the primary key in the first place.  It seems to filter out the primary key from the field meta data after it extracts it, then it adds it right back in.

2011/4/20 Maxime Lévesque <maxime....@gmail.com>
Reply all
Reply to author
Forward
0 new messages