Hi,

I am using JBoss-4.0.3.
Shortly my scenarion:

Table definitions:
----------------------------
-- Categories
----------------------------
  id   integer not null 
name   varchar(50) not null --> books:category

--------------------------------
-- Books
--------------------------------
      id   integer not null 
   title   varchar(50) not null
category   integer not null 


The CMP Entity beans:

/* Categories */
...
/**
 * @ejb.interface-method
 *
 * @ejb.relation name="CategoriesBooks"
 *    role-name="CategoryHasBooks"
 *    target-ejb="BooksBean"
 *    target-role-name="CategoryOfBook"
 *
 * @jboss.relation fk-column="category"
 *     related-pk-field="id"
 *
 */
public abstract Collection getBooks();
/** @ejb.interface-method  */
public abstract void setBooks(Collection c);


/* Books */
...
/**
 * @ejb.interface-method
 *
 * @ejb.relation name="CategoriesBooks"
 *    role-name="CategoryOfBook"
 *    target-ejb="CategoriesBean"
 *    target-role-name="CategoryHasBooks"
 *    target-multiple="yes"
 *
 * @jboss.relation fk-column="id"
 *     related-pk-field="id"
 *
 */
public abstract Collection getCategories();
/**  @ejb.interface-method */
public abstract void setCategories(Collection c);


The output looks like this:

[CategoriesSFBean]   ejbCreate
[CategoriesBean#findByPrimaryKey] Executing SQL: SELECT t0_CategoriesBean.id 
FROM categories t0_CategoriesBean WHERE t0_CategoriesBean.id=?
[CategoriesBean] Executing SQL: SELECT name FROM categories WHERE (id=?)
[CategoriesBean] load relation SQL: SELECT category FROM 
categoriesbean_books_booksbean_categories WHERE (id=?)

But my goal is to see all the books that belong to one (specified) category. 
What should I modify to have something like this:

SELECT id, title, category FROM categoriesbean_books_booksbean_categories WHERE 
(category=?)

?

----
Laszlo



View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3924983#3924983

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3924983


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to