I have a class where I connect to the DB (connection to the DB, fetching records works perfectly fine) and fetch two columns which I am trying to map to a User Object. Heres how my code looks:
Next I have a User class: A User has an Id, first_name, last_name and authorizations of type Authorizations (which is shown below)
Then, I have an Authorizations class which has a list of authorization of type Authorizations (shown below)
And finally my Authorization class has a String object_type and String function_name (which are actually the two columns fetched in the DB class). heres how the Authorization class looks like:
SO bascially I am trying to fetch those two records from the DB class and mapping it to the Authorization class members (object_type and function_name)
Once I do that I will call my User class and pass it to Betwixt to generate an XML document like this:
So in this entire process I am getting a Null Pointer Exception. I am pretty sure the DB class is fine, it connects to the DB fetches records, I think the problem is some where here: (in the Authorization class)
I am guessing there is something wrong the way I am mapping the way I am collecting the DB records into a List and then mapping each individual item of the list into members of the Authorization class.
Well, If somebody could look into the problem I am facing and also plz let me know if thers any different way of acheving this goal, would be more than helpful.
Thank you for your patience, and all help is greatly appreciated.
Looking forward to hear from all you gurus out there.
OK, so what is the stack trace. the Stack trace will actually tell you the exact line that the null pointer is coming from. Then look at the methods that you are calling on an object, and are you sure that there is actually an object there or just the variable is really null.
This isn't really an Object Relational Mapping question. ORM is products like Hibernate, JDO. You are using straight JDBC, so that rules out ORM.