From: youjun g. <you...@ya...> - 2009-12-22 16:22:09
|
Dear All, Upon working on the unit test I found lots of "null" in table "submission"/column "user_id", which cause null point exception on test suite. Hilmar and Rutger, the table may need to be reloaded. Youjun |
From: Hilmar L. <hl...@ne...> - 2009-12-22 16:45:06
|
What is supposed to be in this column? I gather that if null values are in the column, then the data model actually permits this value to be missing. If the application code assumes that it is always present, then either it is making a wrong assumption and needs to be fixed, or the data model is wrong in that it ought to be mandating a value for the column. Which of the two is the case? -hilmar On Dec 22, 2009, at 11:21 AM, youjun guo wrote: > Dear All, > > Upon working on the unit test I found lots of "null" in table > "submission"/column "user_id", which cause null point exception on > test suite. > > Hilmar and Rutger, the table may need to be reloaded. > > Youjun > > -- =========================================================== : Hilmar Lapp -:- Durham, NC -:- informatics.nescent.org : =========================================================== |
From: youjun g. <you...@ya...> - 2009-12-22 18:27:31
|
I checked with Bill and he get a solution. The column should not be null. It is very likely in our code, given a submission we want to retrieve the info of the submitter so a call like User user=submission.getSubmitter() if this returns null, then user.getXXX() will cause a null pointer.exception Youjun On Tue, Dec 22, 2009 at 11:44 AM, Hilmar Lapp <hl...@ne...> wrote: > What is supposed to be in this column? I gather that if null values are in > the column, then the data model actually permits this value to be missing. > If the application code assumes that it is always present, then either it is > making a wrong assumption and needs to be fixed, or the data model is wrong > in that it ought to be mandating a value for the column. > > Which of the two is the case? > > -hilmar > > On Dec 22, 2009, at 11:21 AM, youjun guo wrote: > > Dear All, > > Upon working on the unit test I found lots of "null" in table > "submission"/column "user_id", which cause null point exception on test > suite. > > Hilmar and Rutger, the table may need to be reloaded. > > Youjun > > > > > -- > =========================================================== > : Hilmar Lapp -:- Durham, NC -:- informatics.nescent.org : > =========================================================== > > > > |
From: William P. <wil...@ya...> - 2009-12-22 18:17:59
|
On Dec 22, 2009, at 11:44 AM, Hilmar Lapp wrote: > What is supposed to be in this column? I gather that if null values are in the column, then the data model actually permits this value to be missing. If the application code assumes that it is always present, then either it is making a wrong assumption and needs to be fixed, or the data model is wrong in that it ought to be mandating a value for the column. The problem is because our TB1->TB2 migration violates constraints for normal operation. Under normal operation, each submission has an owner_id, a FK to the users table. But since data that are migrated to TB2 lacks a submitter, this FK remains null. I propose that I create a special new user who will serve as a placeholder for the migrated data, and then just update the submission table, replacing NULL with the ID of this special user. bp |
From: Hilmar L. <hl...@ne...> - 2009-12-22 23:11:11
|
On Dec 22, 2009, at 1:17 PM, William Piel wrote: > I propose that I create a special new user who will serve as a > placeholder for the migrated data, and then just update the > submission table, replacing NULL with the ID of this special user. That sounds good to me; can we also put a not-null constraint on the column (and/or into the hibernate mapping if it's not already there) afterwards so that future violations are prevented? -hilmar -- =========================================================== : Hilmar Lapp -:- Durham, NC -:- informatics.nescent.org : =========================================================== |
From: William P. <wil...@ya...> - 2009-12-23 05:14:25
|
On Dec 22, 2009, at 6:11 PM, Hilmar Lapp wrote: > That sounds good to me I've gone ahead with that. I created a user with the username "tb1" and email tb...@tr..., which happens to have generated a user_id of 14150. (why so big? I don't know). Then for the submission table I replaced user_id = NULL with user_id = 14150. Seems to work, in that when I log in as tb1, I see all of the migrated tb1 studies. Youjun can tell us if the relevant unit tests are now succeeding. bp |