The Problem:  java.lang.NullPointerException at mainPackagePaketverwaltung.Datenbank.savePaket(Datenbank.java:58) at mainPackagePaketverwaltung.MainPV$12.actionPerformed(MainPV.java:507)   The Cause:  This is the Line (58):  myStatement.executeUpdate("INSERT INTO Relation VALUES(NULL, '"+ PaketID +"', '"+ atodb.getArtikelID() + "', '"+ atodb.getMenge() +"')");   From what i understand this should create a new line in the Database because the NULL/Primary_Key is set to Auto_Increment, but after one runt it errors out.  That should not happen bc with each run a new line would be made by the Auto_Increment.  More Info:  PaketID is a INT  atodb.getArtikelID is a INT  atodb.getMenge is a INT  All DB Fields are INT,s
129
What are Null Pointer Exceptions (java.lang.NullPointerException) and what causes them?  What methods/tools can be used to determine the cause so that you stop the exception from causing the program to terminate prematurely?
4404
Im getting above error when i was trying to run my test class. In my test class i will create an Account, Contact. And this contact id will be used in my original code to create Community user.  I noticed following help article from SFDC. But couldn't figure out how to achieve.   Here they asked to create User on the Test class and Runas this user. But in my case, the community user will be created in the code. Please share any thoughts.  Here is the detailed exception,     System.DmlException: Insert failed. First exception on row 0; first   error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, caused by:   System.DmlException: Insert failed. First exception on row 11; first   error: UNKNOWN_EXCEPTION, portal account owner must have a role: []
91753
In a mysqli prepared statement, a NULL gets turned into '' (in the case of a string) or 0 (in the case of an integer). I would like to store it as a true NULL.  Is there any way of doing this?
55667
I've created a table in MySQL:  CREATE TABLE actions ( A_id int NOT NULL AUTO_INCREMENT, type ENUM('rate','report','submit','edit','delete') NOT NULL, Q_id int NOT NULL, U_id int NOT NULL, date DATE NOT NULL, time TIME NOT NULL, rate tinyint(1), PRIMARY KEY (A_id), CONSTRAINT fk_Question FOREIGN KEY (Q_id) REFERENCES questions(P_id), CONSTRAINT fk_User FOREIGN KEY (U_id) REFERENCES users(P_id));   This created the table I wanted just fine (although a "DESCRIBE actions;" command showed me that the foreign keys were keys of type MUL, and I'm not sure what this means).  However, when I try to enter a Q_id or a U_id that does not exist in the questions or users tables, MySQL still allows these values.  What did I do wrong?  How can I prevent a table with a foreign key from accepting invalid data?  UPDATE 1  If I add TYPE=InnoDB to the end, I get an error:     ERROR 1005 (HY000): Can't create table './quotes/actions.frm' (errno: 150)   Why might that happen?  UPDATE 2  I'm told that it's important to enforce data integrity with functional foreign keys, but also that InnoDB should not be used with MySQL.  What do you recommend?
65148
Using OpenSUSE leap 15.1 10.2.29-lp151.2.9.1-x86_64 from vendor OpenSUSE (installed)  CREATE TABLE testtab2(     my_id2 INT AUTO_INCREMENT,     name2 VARCHAR(10),     comment2 VARCHAR(20),     PRIMARY KEY (my_id2) );   testtab.txt:  |Roger |hurray   | |George|today    | |Paul  |yesterday| |John  |last year| |Ringo |tomorrow |   LOAD DATA LOCAL INFILE 'testtab.txt' INTO TABLE testtab FIELDS TERMINATED BY '|';   works fine with linenumbers (my_id) 1-5  INSERT INTO testtab (name,comment) VALUES ('Beatles','band');   this gets linenumber (my_id) 8 - should be 6.  If testtab.txt have 8 records and using INSERT INTO 1 record this gets linenr (my_id) 16. This happens in other tables too - one moved from 199 to 256.  Anyone who can solve the problem?
79049
I am working on plugin to Drupal Commerce, and I started getting this error:   DatabaseTransactionOutOfOrderException: in DatabaseConnection-&gt;rollback() (line 1058 of /Library/WebServer/Documents/includes/database/database.inc).   Can anyone shed some light on what this error means? If I install a fresh drupal and reinstall my plugin, is that likely to clear things up?   Any advice?   Thanks!
120685
It seems to me that a lot of my debugging time is spent chasing down null-reference exceptions in complex statements. For instance:  For Each game As IHomeGame in _GamesToOpen.GetIterator()   Why, when I get a NullReferenceException, can I get the line number in the stack trace, but not the name of the object that equals null. In other words, why:  Object reference not set to an instance of an object.   instead of  _GamesToOpen is not set to an instance of an object.   or  Anonymous object returned by _GamesToOpen.GetIterator() is null.   or  game was set to null.   Is this strictly a design choice, meant to protect the anonymity of the code or is there a compelling reason in compiler design not to include this information in the debug-time exception?
69078
I've got a table that has several columns, But I need to insert data into two columns of that table. I need to add data into those columns, from a select statement.  Would it be something like:  INSERT INTO dm.billables_links (billable_id, mobiuser_id) SELECT billable_id FROM junk.wm_260_billables2 WHERE info ilike '%Alisha%' SELECT id FROM public.ja_mobiusers WHERE name_first LIKE 'Alisha%' AND name_last LIKE 'Dson%'   It has to be in the same transaction because the mobiuser_id must go to the selected billable_id on the first select.  How can I do that?     1 - Select billable_id from dm.billable       2 - Select mobiuser_id from   ja_mobiusers       3 - Insert the billable_id and the mobiuser_id to the   dm.billables_links table.   I've a CONSTRAINT on the target table: (That's why I need to get it done at the same time. So I won't get errors like:      ERROR:  new row for relation "billables_links" violates check   constraint "cc_one_and_only_one_target"   ALTER TABLE dm.billables_links   ADD CONSTRAINT cc_one_and_only_one_target CHECK ((("customer_id" IS NOT NULL)::integer + ("role_id" IS NOT NULL)::integer + ("mobiuser_id" IS NOT NULL)::integer) = 1);   This is related to my previous question - Which I've asked to be deleted because have done the wrong question and it has been confused.   UPDATE 1: This is an example of what I need  1 - select the billable_id: (SELECT1)  SELECT billable_id FROM junk.wm_260_billables2 WHERE info ilike '%Alisha%'   2 - select the mobiuser_id: (SELECT2)  SELECT id FROM public.ja_mobiusers WHERE name_first LIKE 'Alisha%' AND name_last LIKE 'Dadryl%'   3 - Insert those two data into the dm.billables_links table (EXAMPLE):  INSERT INTO dm.billables_links (billable_id, mobiuser_id) VALUES (**SELECT1**, **SELECT2**);
42684
I know there is a question  but I checked its answers and it didn't help. I'm just learning developing modules for Drupal so maybe it's something really stupid but I have no idea...  My hook (in testModule4.install):  function testModule4_update_7001() {  $schema['testModule4_table'] = array(     'description' =&gt; 'TODO: Description',     'fields' =&gt; array(         'main_id' =&gt; array(             'description' =&gt; 'TODO: Description.',             'type' =&gt; 'serial',             'not null' =&gt; TRUE,         ),         'settings' =&gt; array(             'description' =&gt; 'TODO: Description',             'type' =&gt; 'text',             'not null' =&gt; FALSE,         ),         'uid' =&gt; array(             'description' =&gt; 'TODO: Description',             'type' =&gt; 'int',             'not null' =&gt; FALSE,         ),         'created' =&gt; array(             'description' =&gt; 'TODO: Description',             'type' =&gt; 'int',             'not null' =&gt; FALSE,         ),         'changed' =&gt; array(             'description' =&gt; 'TODO: Description',             'type' =&gt; 'int',             'not null' =&gt; FALSE,         ),     ),     'primary key' =&gt; array('main_id'), );  db_create_table('testModule4_table', $schema['testModule4_table']);  }   My module is working just fine. The schema_version of module in database is 0 but update.php just cannot see it. What can be the cause of that? :/ I was trying clearing cache and reenabling a module but without success. I just don't know where to search for source of the problem. If you need more data, just comment :/ .  Edit:  I created simple module:  testModule.module:  &lt;?php   function testModule_myform($delta = "") {      $form['something'] = array(         '#type' =&gt; 'markup',         '#markup' =&gt; 'Something',     );     return $form; }    /**  * Implements hook_menu();  */  function testModule_menu() {     $items["test/test"] = array(         'title' =&gt; 'testModule',         'description' =&gt; 'TODO: Description',         'page callback' =&gt; 'drupal_get_form',         'page arguments' =&gt; array('testModule_myform'),         'access callback' =&gt; TRUE,      );     return $items; }   testModule.info:  name = testModule description = Test module for Drupal experiments. package = CustomTest core = 7.x   testModule.install:  function testModule_update_7001() {     drupal_set_message('It works!');     print 'Show something!'; }   And it still ignores this hook... Is it officially a Drupal bug and I need to reinstall the whole Drupal? >_&lt;
57540
I'm trying to update an account list and I need to get the Ids when the update fails.  I use the getId() method but for accounts which fail I get null.  It's an update so my account already has an Id.  Is it normal ? If it is, how can I get the Ids list of non-updated accounts ?  Here is my code :  List&lt;Account&gt; accountsList = [select Id from Account];  for(Account a : accountsList) {     a.Name = 'Test', }  List&lt;Database.SaveResult&gt; res = Database.update(accountsList, false);  for (Database.SaveResult s : res) {     if (!s.isSuccess()) {         system.debug(s.getId()); // I get null here      }  }
105415
This is the test method i have writtenfor batch apex ProductUpdate  .Even if i have a single callout to Database.Executebatch()  I am getting the following error.  Please help !  @isTest (seeAllData=true) global class testbatchProductUpdate  {     public static testMethod  void  pBatchUpdate()     {          /** Product to meet the Criteria in test class **/          Product2 p = new Product2();         p.Name = 'Test Product';         p.Effective_Date__c = Date.Today();         //p.CurrencyIsoCode= 'USD';         p.Material_status__c='status';         insert p;          /** Product to meet the Criteria in test class **/           test.startTest();         batchProductUpdate bpu = new batchProductUpdate();         database.Executebatch(bpu);         test.stopTest();     }  }      Error :  System.UnexpectedException: No more than one executeBatch can be called from within a testmethod. Please make sure the iterable   returned from your start method matches the batch size, resulting in   one executeBatch invocation.", Failure Stack Trace: "External entry   point"
96022
I had the following exception thrown at me when trying to process more than one selected records via a custom button in the list view.    Class Code  global class MerchandiseInventoryClass {      webservice static void ConverttoInventory(String[] merchandise_id)    {        //Convert Merchandise collection into Inventory Collection...         Merchandise__c[] merchandise_collection = [SELECT ID,Author__c,Book_Title__c,Edition__c,Publisher__c,Total_Merchandise_QtyTotal_Qty__c,Status__c FROM Merchandise__c WHERE ID = :merchandise_id];          Inventory__c i = new Inventory__c(); //Line 1        List&lt;Inventory__c&gt; newInventory = new List&lt;Inventory__c&gt;();        for(Merchandise__c m : merchandise_collection )        {            if(m.Status__c !='Fully Converted')            {            i.Author__c = m.Author__c ;            i.Book_Title__c = m.Book_Title__c;            i.Edition__c = m.Edition__c;            i.Publisher__c = m.Publisher__c;            i.Qty_Available__c = m.Total_Merchandise_QtyTotal_Qty__c;            i.Merchandise__c = m.Id;            m.Uninventoried_Qty__c = 0;            m.Status__c = 'Fully Converted';            newInventory.add(i);            }        }        insert newInventory;        update merchandise_collection;    }  }   By moving the Line 1 to within the for loop solved the issue for me.  Thanks to this post (refer the Best Answer in that post)    What puzzles me is that WHY i have to instantiate "i" for every iteration within the loop.  Why the list collection ("newInventory") is complaining that are duplicate elements and why should it even confuse in the first place when I am performing an "insert" even ?
85919
While cloning record i am getting the below error in the 1st line of the code, the SOQL. Can anyone help me with that.  XX_Segment__c desc1 = [select  Id, XXX_New_Keyword_Description__r.Description__c from XX_Segment__c where Availability_Forecast_XXX__c =:id1]; String s= desc1.XXX_New_Keyword_Description__r.Description__c; s= s.substring(0,3); String s1 = s+'%';   Regards
119160
This Trigger is on lead (Before Insert, Before Update) and it errors (System.NullPointerException: Attempt to de-reference a null object). I'm getting this error when i'm posting "Web to Lead". However i do have the right ORG iD and Record type id included on the xml file:   &lt;input type=hidden name="oid" value="xxxxxxxxxxxxx"&gt; &lt;input type=hidden name="recordType" id="recordType" value="zzzzzzzzzzzzzzzzzz"&gt;    trigger IAAILeadTrigger on Lead (before insert, before update){ //BEGIN: S-444340 T-561808 - Process only IAA Remarketing Recordtype data     Map&lt;ID,Schema.RecordTypeInfo&gt; rt_Map = Lead.sObjectType.getDescribe().getRecordTypeInfosById();      //Looks up the branches based on the Lead PostalCode     if(trigger.isBefore){          for(Lead ld : trigger.new){                      if (rt_map.get(ld.recordTypeID).getName().containsIgnoreCase('IAA Remarketing') )                if( trigger.isInsert ||                    (trigger.isUpdate &amp;&amp; ld.Branch__c == null) ||                   (trigger.isUpdate &amp;&amp; ld.PostalCode != trigger.oldMap.get(ld.id).PostalCode)               ){                   leads.add(ld);               }           }           }                 //Only check the leads that are in the lead list and NOT the full trigger.new list         if(!leads.isEmpty()){             LeadController.GetLeadBranches(leads);           }     }  }
20599
I am receiving apex errors with the following code:   public with sharing class AddExistingSpecsExt {      public Specifications__c loadedSpec { get; private set; }  public AddExistingSpecsExt() {     String specId = ApexPages.currentPage().getParameters().get('id');     if (String.isBlank(specId)) return;      List&lt;Specifications__c&gt; candidates = [         SELECT Id, Name, Product__c FROM Specifications__c WHERE Id = :specId LIMIT 1     ];     if (!candidates.isEmpty()) loadedSpec = candidates[0]; }     public PageReference associate () {          Specifications__c candidates = new Specifications__c ( Id = Specifications__c.Product__c, Name = Specifications__c.Id);          try {             Database.update(candidates);         } catch (Exception error) {             ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, 'Error while associating.' + error.getMessage()));         }          PageReference page = new PageReference('/' + candidates);          return page.setRedirect(true);     }      public PageReference cancel () {         PageReference page = new PageReference('/' + Null);         return page.setRedirect(true);             }  }   Attempting to add records to a related list through a custom button and small vf page.   The Error is Line 16      Invalid initial expression type for field Specifications__c.Id, expecting: Id   Any help?
123269
Inspired by a StackOverflow question ().  Is there a DBMS that actually supports the = NULL syntax?
90792
I have a couple tables in which I created an object ID as either an Int or Bigint, and in both cases, they seem to autoincrement by 10 (ie, the first insert is object ID 1, the second is object ID 11, the third is object ID 21, etc).  Two questions:   Why does it do that? Is that a problem?