java - Issue in calling DAO method from Service -


i have dao has method this:

class abcservice  {   private abcdao isntance;   public void getstuff()   {     instance.getqueryresult();   } } 

now if method called anywhere give nullpointerexception instance calls query method. still code in use in project long time , think twice before calling incorrect. there way code can accessed. standard practice?

if have setter isntance, need call before calling getstuff. standard (although needed fields should set inside constructor.


Comments

Popular posts from this blog

android - getbluetoothservice() called with no bluetoothmanagercallback -

sql - ASP.NET SqlDataSource, like on SelectCommand -

ios - Undefined symbols for architecture armv7: "_OBJC_CLASS_$_SSZipArchive" -