The moose likes JForum and the fly likes TopicDAO and selectByUserByLimit() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Products » JForum
Bookmark "TopicDAO and selectByUserByLimit()" Watch "TopicDAO and selectByUserByLimit()" New topic

TopicDAO and selectByUserByLimit()

Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
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
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
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]
I agree. Here's the link: http://aspose.com/file-tools
subject: TopicDAO and selectByUserByLimit()
Similar Threads
Can't delete user.
How difficult is it to add a "watch forum" function
Pls...Anybody help me...asap
Session problem
JNDI: Setting/Retrieving Parameters