JiveJdon Community Forums
在线223人 Home | 论坛 | 培训咨询 | 精华 | 查搜 | 注册 | 登陆 |
首页 » 论坛 » J2EE/JavaEE/JEE/EJB/JSF等技术讨论
???en_US.forumThreadPrev.name??? 上一主题
Go back to the topic listing   返回主题列表
???en_US.forumThreadNext.name??? 下一主题
这个主题共有 1 回复 / 1 页 [ ]  发表新帖子  回复该主题贴
programboy

发表文章: 14
注册时间: 2003年08月19日 22:02
给他发消息
jboss中使用cmr的问题 发表: 2003年08月19日 22:19 回复
我在把一个项目从weblogic移植到jboss中时遇到了一个非常不理解的问题就是我在一个cmp中使用另一个cmp中的方法时,通过cmr字段映射总会抛出NullPointerException,但是这个使用在weblogic中非常正确
代码如下:
我在 User,UserBean 中都申明了getOrganization()
在UserBean中的一个方法使用
public UserModel getUserModel () throws RemoteException
{
_logger.debug("into the getUserModel .");
UserModel model = new UserModel ();
//_logger.debug("the id "+this.getId());
model.setId (this.getId ());
//_logger.debug("the login "+this.getLogin());
model.setLogin (this.getLogin ());
//_logger.debug("the UserName "+this.getUserName());
model.setUserName (this.getUserName ());
//_logger.debug("the Password "+this.getPassword());
model.setPassword (this.getPassword ());
//_logger.debug("the lastmodifiendate "+this.getLastModifiedDate());
model.setLastModifiedDate (this.getLastModifiedDate ());
//_logger.debug("the createdate "+this.getCreateDate());
model.setCreateDate (this.getCreateDate ());
//model.setStatus (this.getStatus ());
//_logger.debug("the Address "+this.getAddress());
model.setAddress (this.getAddress ());
//_logger.debug("the Usercode "+this.getUserCode());
model.setUserCode (this.getUserCode ());
//_logger.debug("the sex "+this.getSex());
model.setSex (this.getSex ());
//_logger.debug("the phone "+this.getPhone());
model.setPhone (this.getPhone ());
//_logger.debug("the workcardno "+this.getWorkCardNo());
model.setWorkCardNo (this.getWorkCardNo ());
//_logger.debug("the birthday "+this.getBirthday());
model.setBirthday (this.getBirthday ());
//_logger.debug("the email "+this.getEmail());
model.setEmail (this.getEmail ());
//_logger.debug("the cardid "+this.getCardId());
model.setCardId (this.getCardId ());
//_logger.debug("the dutycode "+this.getDutyCode());
model.setDutyCode (this.getDutyCode ()); //新加 职称
//_logger.debug("the knowledgecode "+this.getKnowledgeCode());
model.setKnowledgeCode (this.getKnowledgeCode ()); //新加 文化程度
//_logger.debug("the isvalid "+this.getIsValid());
model.setIsValid (this.getIsValid ()); //是否有效 (改为字符)
//_logger.debug("the organizationcode "+this.getOrganizationCode());
model.setOrganizationCode (this.getOrganizationCode ()); //税务机构代码
//_logger.debug("the checkworkno "+this.getCheckWorkNo());
model.setCheckWorkNo (this.getCheckWorkNo ()); //税务检查证号
//_logger.debug("the rightmodify "+this.getRightModify());
model.setRightModify (this.getRightModify ()); //权限修改

if(this.getOrganization()==null)
_logger.debug("the organization is null");
else
_logger.debug("get orgid"+this.getOrganization().getId());

if (this.getOrganization () != null) model.setOrgId (this.getOrganization ().getId ());
//model.setOrgId(new Integer(41));

return model;
}

EJB-jar中是这样定义的
<ejb-relation>
<ejb-relation-name>organization-users</ejb-relation-name>

<ejb-relationship-role>
<ejb-relationship-role-name>
organization-has-users
</ejb-relationship-role-name>
<multiplicity>One</multiplicity>
<relationship-role-source>
<ejb-name>OrganizationEJB</ejb-name>
</relationship-role-source>
<cmr-field>
<cmr-field-name>users</cmr-field-name>
<cmr-field-type>java.util.Collection</cmr-field-type>
</cmr-field>
</ejb-relationship-role>

<ejb-relationship-role>
<ejb-relationship-role-name>
users-have-organization
</ejb-relationship-role-name>
<multiplicity>Many</multiplicity>
<relationship-role-source>
<ejb-name>UserEJB</ejb-name>
</relationship-role-source>
<cmr-field>
<cmr-field-name>organization</cmr-field-name>
</cmr-field>
</ejb-relationship-role>
</ejb-relation>

在jbosscmp-jdbc中的定义是
<ejb-relation>
<ejb-relation-name>organization-users</ejb-relation-name>
<foreign-k**-mapping/>
<ejb-relationship-role>
<ejb-relationship-role-name>organization-has-users</ejb-relationship-role-name>
<fk-constraint>true</fk-constraint>
<k**-fields>
<k**-field>
<field-name>id</field-name>
<column-name>orgid</column-name>
</k**-field>
</k**-fields>
</ejb-relationship-role>
<ejb-relationship-role>
<ejb-relationship-role-name>users-have-organization</ejb-relationship-role-name>
<fk-constraint>true</fk-constraint>
<k**-fields/>
</ejb-relationship-role>
</ejb-relation>

当我调用user中的getUserModel()时,到getOrganization()时就会抛null,不知道在这里有什么配置的问题,是不是在jboss中对EJB有什么特别的要求?
programboy

发表文章: 14
注册时间: 2003年08月19日 22:02
给他发消息
Re: jboss中使用cmr的问题 发表: 2003年08月19日 22:26 回复
重新写一下
EJB-jar中是这样定义的
<ejb-relation>
<ejb-relation-name>organization-users</ejb-relation-name>
<ejb-relationship-role>
<ejb-relationship-role-name>
organization-has-users
</ejb-relationship-role-name>
<multiplicity>One</multiplicity>
<relationship-role-source>
<ejb-name>OrganizationEJB</ejb-name>
</relationship-role-source>
<cmr-field>
<cmr-field-name>users</cmr-field-name>
<cmr-field-type>java.util.Collection</cmr-field-type>
</cmr-field>
</ejb-relationship-role>
<ejb-relationship-role>
<ejb-relationship-role-name>
users-have-organization
</ejb-relationship-role-name>
<multiplicity>Many</multiplicity>
<relationship-role-source>
<ejb-name>UserEJB</ejb-name>
</relationship-role-source>
<cmr-field>
<cmr-field-name>organization</cmr-field-name>
</cmr-field>
</ejb-relationship-role>
</ejb-relation>

在jbosscmp-jdbc中的定义是
<ejb-relation>
<ejb-relation-name>organization-users</ejb-relation-name>
<foreign-k**-mapping/>
<ejb-relationship-role>
<ejb-relationship-role-name>organization-has-users</ejb-relationship-role-name>
<fk-constraint>true</fk-constraint>
<k**-fields>
<k**-field>
<field-name>id</field-name>
<column-name>orgid</column-name>
</k**-field>
</k**-fields>
</ejb-relationship-role>
<ejb-relationship-role>
<ejb-relationship-role-name>users-have-organization</ejb-relationship-role-name>
<fk-constraint>true</fk-constraint>
<k**-fields/>
</ejb-relationship-role>
</ejb-relation>

当我调用user中的getUserModel()时,到getOrganization()时就会抛null,不知道在这里有什么配置的问题,是不是在jboss中对EJB有什么特别的要求?
这个主题有 1 回复 / 1 页 [ ]
???en_US.forumThreadPrev.name??? 上一主题
Go back to the topic listing   返回主题列表    返回页首  返回页首
???en_US.forumThreadNext.name??? 下一主题
热点TAG: AOP cache DDD EJB 集群 设计模式 Hibernate IOC JiveJdon OO RBAC Spring Struts
查询本论坛内 回复超过的热门帖子
快速发表回复
标题
 
粗体 斜体 下划线 插入图片 插入代码 插入url链接 插入附件
内容
 

解惑之道在J道 ,打造中国最具影响力的的企业软件社区
OpenSource JIVEJDON v3.0 Powered by JdonFramework Code © 2002-08 jdon.com

anti spam