This is the bean where the error is :
| package org.jstock.ejb;
| import java.rmi.RemoteException;
| import java.util.Collection;
|
| import javax.ejb.CreateException;
| import javax.ejb.EJBException;
| import javax.ejb.EntityBean;
| import javax.ejb.EntityContext;
| import javax.ejb.FinderException;
| import javax.ejb.RemoveException;
| import javax.naming.Context;
| import javax.naming.NamingException;
|
| import org.jstock.interfaces.Category;
| import org.jstock.interfaces.CategoryLocal;
| import org.jstock.interfaces.CategoryLocalHome;
| import org.jstock.util.Connexion;
|
|
| /**
| *
| * CMP Bean representing a product category
| *
| * @ejb.bean
| * description="Category"
| * local-jndi-name="CategoryLocal"
| * jndi-name="Category"
| * name="Category"
| * primkey-field="categoryId"
| * type="CMP"
| * cmp-version = "2.x"
| * view-type="both"
| *
| * @ejb.persistence
| * table-name = "Category"
| *
| * @ejb.transaction
| * type = "Required"
| *
| * @ejb.finder
| * signature = "java.util.Collection findAllSons(java.lang.Integer
categoryId)"
| * query = "SELECT OBJECT(obj)
| * FROM Category AS c,
| * IN (c.sonCategories) AS obj
| * WHERE obj.fatherCategory.categoryId = ?1"
| *
| * @ejb.finder
| * signature = "java.util.Collection findAll()"
| * query = "SELECT OBJECT(obj)
| * FROM Category AS obj"
| *
| * @jboss.persistence
| *
| */
|
| public abstract class CategoryBean implements EntityBean {
|
| /**
| *
| * @param name
| * @return
| * @throws CreateException
| *
| * @ejb.create-method
| *
| */
| public Integer ejbCreate(String name)
| throws CreateException{
| this.setName(name);
| return null;
| }
| public void ejbPostCreate(String name){}
|
|
| /**
| *
| * @return
| *
| * @ejb.pk-field
| *
| * @ejb.persistence
| * column-name = "categoryId"
| * jdbc-type = "INTEGER"
| * sql-type = "INTEGER"
| *
| * @jboss.persistence
| * not-null = "false"
| * auto-increment = "true"
| */
| public abstract Integer getCategoryId();
|
| public abstract void setCategoryId(Integer categoryId);
|
| /**
| *
| * @return
| *
| * @ejb.interface-method
| *
| * @ejb.persistence
| * column-name = "name"
| * jdbc-type = "VARCHAR"
| * sql-type = "VARCHAR(15)"
| *
| */
| public abstract String getName();
| /**
| * @ejb.interface-method
| */
| public abstract void setName(String name);
|
| /**
| *
| * @return
| *
| * @ejb.interface-method
| *
| * @ejb.persistence
| * column-name = "description"
| * jdbc-type = "VARCHAR"
| * sql-type = "VARCHAR(255)"
| *
| */
| public abstract String getDescription();
| /**
| * @ejb.interface-method
| */
| public abstract void setDescription(String description);
|
| /**
| *
| * @return
| *
| * @ejb.interface-method
| *
| * @ejb.relation
| * name = "CategoryFather_CategorySon"
| * role-name = "Son_has_Father"
| *
| * @ejb.transaction
| * type = "Mandatory"
| *
| * @jboss.relation
| * fk-column = "father_categoryId"
| * related-pk-field = "categoryId"
| */
| public abstract CategoryLocal getFatherCategory();
|
| /**
| * @ejb.interface-method
| */
| public abstract void setFatherCategory(CategoryLocal category);
|
| /**
| *
| * @param category
| *
| * @ejb.interface-method
| *
| */
| public void setFatherCategory(Category category){
| try{
| Integer iPk = (Integer) category.getPrimaryKey();
| Context jndiContext = (Context)
Connexion.getInitialContext();
|
| CategoryLocalHome catHomeLocal =
| (CategoryLocalHome)
jndiContext.lookup("CategoryLocal");
|
|
this.setFatherCategory(catHomeLocal.findByPrimaryKey(iPk));
|
| }catch(RemoteException re){
| re.printStackTrace();
| }catch(NamingException ne){
| ne.printStackTrace();
| }catch(FinderException fe){
| fe.printStackTrace();
| }
| }
|
| /**
| *
| * @return
| *
| * @ejb.interface-method
| *
| * @ejb.relation
| * name = "CategoryFather_CategorySon"
| * role-name = "Father_has_Sons"
| *
| */
| public abstract Collection getSonCategories();
|
| public abstract void setSonCategories(Collection categories);
|
| /**
| *
| * @return
| *
| * @ejb.interface-method
| *
| * @ejb.relation
| * name="Product_Category"
| * role-name = "Category_has_Products"
| *
| */
| public abstract Collection getProducts();
|
| /**
| *
| * @param products
| *
| * @ejb.interface-method
| *
| */
| public abstract void setProducts(Collection products);
|
|
|
|
| public String toString(){
| System.out.println(getName());
| return getName();
| }
|
| /* (non-Javadoc)
| * @see javax.ejb.EntityBean#ejbActivate()
| */
| public void ejbActivate() throws EJBException, RemoteException {
| // TODO Auto-generated method stub
|
| }
|
| /* (non-Javadoc)
| * @see javax.ejb.EntityBean#ejbLoad()
| */
| public void ejbLoad() throws EJBException, RemoteException {
| // TODO Auto-generated method stub
|
| }
|
| /* (non-Javadoc)
| * @see javax.ejb.EntityBean#ejbPassivate()
| */
| public void ejbPassivate() throws EJBException, RemoteException {
| // TODO Auto-generated method stub
|
| }
|
| /* (non-Javadoc)
| * @see javax.ejb.EntityBean#ejbRemove()
| */
| public void ejbRemove()
| throws RemoveException, EJBException, RemoteException {
| // TODO Auto-generated method stub
|
| }
|
| /* (non-Javadoc)
| * @see javax.ejb.EntityBean#ejbStore()
| */
| public void ejbStore() throws EJBException, RemoteException {
| // TODO Auto-generated method stub
|
| }
|
| /* (non-Javadoc)
| * @see javax.ejb.EntityBean#setEntityContext(javax.ejb.EntityContext)
| */
| public void setEntityContext(EntityContext arg0)
| throws EJBException, RemoteException {
| // TODO Auto-generated method stub
|
| }
|
| /* (non-Javadoc)
| * @see javax.ejb.EntityBean#unsetEntityContext()
| */
| public void unsetEntityContext() throws EJBException, RemoteException {
| // TODO Auto-generated method stub
|
| }
| }
|
|
When I deploy this, jboss complains about an XML error in jbosscmp-jdbc .
Anyone has an idea ?
View the original post :
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3835705#3835705
Reply to the post :
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3835705
-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g.
Take an Oracle 10g class now, and we'll give you the exam FREE.
http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click
_______________________________________________
JBoss-Development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development