• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Getting existing data with CMP

 
Chicken Farmer ()
Posts: 1932
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Trying to build a system that allows you to view all the current available books in a database, and allows you to check books out. The database has fields for isbn, title, author, and availability (which can be either "yes" or "no").
Having a problem getting data from my Entity. I'm running JBoss and MySQL. Things deploy fine, application runs.
However, when I get a session bean that calls findAllAvailableBooks on the entity home, that method is returning 0 data members.
I have the following configured as the ejb-ql for that method:

Books is the name of the table, but also the name of the abstract schema. I don't ever call create, since I don't want them to create books, I want it to read from the existing database.
I've used the BMP version, and it works, so I know the mysql-service.xml file is working correctly, but of course there you can specify the table in your SQL statements. With ejb-ql, I'm not sure how to do that.
My setEntityContext is being called, so I know it's hitting the bean at some point.
Any suggestions? Let me know if you need more info.
Thanks!
Jason
[ March 27, 2003: Message edited by: jason adam ]
 
jason adam
Chicken Farmer ()
Posts: 1932
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Wow, after much searching I found the wonderful

tag. Would be nice if this was used more often in the books and tutorials I've been using, but at least I know now!
I'm guessing it is a JBoss thing to create a table based on the ejb-name defined, since I went ahead and did a few creates and it automagically created a table named bookentity (the value specified in ejb-name) within my database.
Fun fun fun!
reply
    Bookmark Topic Watch Topic
  • New Topic