Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

TopicDAO and selectByUserByLimit()

 
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
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?

Thanks.
Carlos S. Zamudio


[originally posted on jforum.net by cszamudio]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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]
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic