This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
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

JavaRanch » Java Forums » Products » JForum
Bookmark "TopicDAO and selectByUserByLimit()" Watch "TopicDAO and selectByUserByLimit()" New topic

TopicDAO and selectByUserByLimit()

Migrated From
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 by cszamudio]
Migrated From
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 by cszamudio]
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: TopicDAO and selectByUserByLimit()
It's not a secret anymore!