Issue 225 in dblinq2007: InsertOnSubmit/SubmitChanges fails with cryptic exception if there is no primary key

41 views
Skip to first unread message

dblin...@googlecode.com

unread,
Apr 6, 2010, 9:03:26 AM4/6/10
to dblin...@googlegroups.com
Status: Accepted
Owner: ashmind
Labels: Component-DbLinq

New issue 225 by ashmind: InsertOnSubmit/SubmitChanges fails with cryptic
exception if there is no primary key
http://code.google.com/p/dblinq2007/issues/detail?id=225

What steps will reproduce the problem?
1. Create a table without a primary key (I used sqlite).
2. Use DBMetal to reflect the table in code as entity
3. InsertOnSubmit new instance of the entity
4. Call SubmitChanges

What is the expected output? What do you see instead?

Expected some kind of reasonable "no primary key" error on step 2 or 4.
Got:
[ArgumentNullException: Value cannot be null.
Parameter name: key]
System.ThrowHelper.ThrowArgumentNullException(ExceptionArgument
argument) +44
System.Collections.Generic.Dictionary`2.FindEntry(TKey key) +7457585
System.Collections.Generic.Dictionary`2.TryGetValue(TKey key, TValue&
value) +16
DbLinq.Data.Linq.Implementation.EntityTracker.FindByIdentity(IdentityKey
identityKey) +24
DbLinq.Data.Linq.Implementation.EntityTracker.RegisterToWatch(Object
entity, IdentityKey identityKey) +35
DbLinq.Data.Linq.DataContext.MoveToAllTrackedEntities(Object entity,
Boolean insert) +156
DbLinq.Data.Linq.DataContext.InsertEntity(Object entity, QueryContext
queryContext) +68
DbLinq.Data.Linq.DataContext.SubmitChangesImpl(ConflictMode failureMode)
+574
DbLinq.Data.Linq.DataContext.SubmitChanges(ConflictMode failureMode)
+151
DbLinq.Data.Linq.DataContext.SubmitChanges() +9

--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings

dblin...@googlecode.com

unread,
Apr 6, 2010, 9:07:46 AM4/6/10
to dblin...@googlegroups.com
Updates:
Status: New
Owner: ---

Comment #1 on issue 225 by ashmind: InsertOnSubmit/SubmitChanges fails with

cryptic exception if there is no primary key
http://code.google.com/p/dblinq2007/issues/detail?id=225

Fixed owner/status.

dblin...@googlecode.com

unread,
May 18, 2010, 4:49:48 AM5/18/10
to dblin...@googlegroups.com

Comment #2 on issue 225 by alantang888: InsertOnSubmit/SubmitChanges fails
with cryptic exception if there is no primary key
http://code.google.com/p/dblinq2007/issues/detail?id=225

How to fix?? i got same problem.
Thanks a lot.

--
dblinq-bugs maillist - dblin...@googlegroups.com
http://groups.google.com/group/dblinq-bugs

dblin...@googlecode.com

unread,
Aug 13, 2010, 8:03:33 AM8/13/10
to dblin...@googlegroups.com

Comment #3 on issue 225 by sdoraiswamy: InsertOnSubmit/SubmitChanges fails
with cryptic exception if there is no primary key
http://code.google.com/p/dblinq2007/issues/detail?id=225

Hello! I am still getting this problem with build 0.20.1. How do I fix it?

dblin...@googlecode.com

unread,
Oct 1, 2010, 2:56:35 PM10/1/10
to dblin...@googlegroups.com

Comment #4 on issue 225 by funnykiat: InsertOnSubmit/SubmitChanges fails
with cryptic exception if there is no primary key
http://code.google.com/p/dblinq2007/issues/detail?id=225

just create a primary key field for each of your table during your table
creation.

dblin...@googlecode.com

unread,
Feb 14, 2011, 3:34:22 PM2/14/11
to dblin...@googlegroups.com

Comment #5 on issue 225 by pilichow...@gmail.com:
InsertOnSubmit/SubmitChanges fails with cryptic exception if there is no
primary key
http://code.google.com/p/dblinq2007/issues/detail?id=225

I can confirm it (with PostgreSQL) but I don't agree with original poster
stating "Expected some kind of reasonable "no primary key" error on step 2
or 4.".

This would be wrong as well. There is not a bug about message but behaviour
-- inserting records into table without primary key is valid operation and
it should work. Plain and simple.

The other story is corner case with update, when there is no chance to find
out what record (! singular) you are referring to.


dblin...@googlecode.com

unread,
Jun 16, 2011, 8:48:12 AM6/16/11
to dblin...@googlegroups.com

Comment #6 on issue 225 by daniel.t...@gmail.com:
InsertOnSubmit/SubmitChanges fails with cryptic exception if there is no
primary key
http://code.google.com/p/dblinq2007/issues/detail?id=225

I had the same issue and found out that one of my object properties had a
private setter. Once I changed the setter to public, this error went away.

dblin...@googlecode.com

unread,
May 13, 2013, 9:43:12 AM5/13/13
to dblin...@googlegroups.com

Comment #7 on issue 225 by deepakrs...@gmail.com:
InsertOnSubmit/SubmitChanges fails with cryptic exception if there is no
primary key
http://code.google.com/p/dblinq2007/issues/detail?id=225

I had the same issue and found that primary key which I initially had was
dbgenerated which I later changed. But the file was still having
DBGenerated: true.

--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings
Reply all
Reply to author
Forward
0 new messages