DBFlow icon indicating copy to clipboard operation
DBFlow copied to clipboard

primary key Long not valid?

Open Rainer-Lang opened this issue 11 years ago • 5 comments

@Column(columnType = Column.PRIMARY_KEY_AUTO_INCREMENT)
public Long id;

If I save a new object I get this:

Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'long java.lang.Long.longValue()' on a null object reference

Is this a bug or a feature? ;-)

Rainer-Lang avatar Mar 13 '15 16:03 Rainer-Lang

It appears to be a bug, can you send me the full stacktrace.

agrosner avatar Mar 14 '15 23:03 agrosner

Hi, is it possible to send you my classes via mail? 3 small files and some test-lines. There is also one other issue #28. And this also: #148

Rainer-Lang avatar Mar 15 '15 08:03 Rainer-Lang

@Rainer-Lang You've defined the primary key as a Long which can have a null value. If you define the key as long then it probably will work. ;)

petroski77 avatar Mar 15 '15 22:03 petroski77

I know that I can use "long" instead of "Long" (this works definitely). But this is not the same. As I think - Long should also work.

Rainer-Lang avatar Mar 16 '15 07:03 Rainer-Lang

@Rainer-Lang is correct, long should work too. Let me file this under 1.7.1

agrosner avatar Mar 16 '15 23:03 agrosner