I've run into a problem extracting the topics for a particular user. I'm calling:
TopicDAO topicDAO = DataAccessDriver.getInstance().newTopicDAO();
int userTopics = topicDAO.countUserTopics(userId);
List topicList = topicDAO.selectByUserByLimit(userId, 0,userTopics);
I know the userId is valid.
The topicDAO object is successfully created. However, I'm getting a NULL exception from getting the topic count and then the selectBy statement. I can't seem to track this down in the code to see the actual SQL generated. I'm using ORACLE as the database backend, which I'm wondering whether this is handled differenty than the other databases.
Any hints on how to debug this?
Carlos S. Zamudio
[originally posted on jforum.net by cszamudio]
Migrated From Jforum.net
posted 7 years ago
As usual, just the act of posting a question seems to illuminates the answer.
My problem was that I did not have an active User Session when I invoked the TopicDAO selects. Since I am developing web services around some of JForum, the web service is not running within a user context. The part of the SQL query that was failing, was establishing the forums that the query user had access to. My only solution so far is to run the same SQL query, but omit the user context info. [originally posted on jforum.net by cszamudio]