musicBean.javapackage music.ejb;import java.rmi.RemoteException;import javax.ejb.CreateException;
import javax.ejb.EJBException;
import javax.ejb.EntityBean;
import javax.ejb.EntityContext;
import javax.ejb.RemoveException;
import java.util.Collection;/**
* @ejb.bean name="Music"
* display-name="Name for Music"
* description="Description for Music"
* jndi-name="ejb/Music"
* type="CMP"
* cmp-version="2.x"
* view-type="local"
* primkey-field = "content"
* @ejb.persistence table-name = "musicnews" read-only = "false"
* @jboss.persistence create-table = "true" remove-table = "false" datasource = "java:MySqlDS" datasource-mapping = "mySQL"
* @ejb.finder signature = "Collection findAll()" unchecked = "true" query = "select object(g) from Music g"
*
*/
public abstract class MusicBean implements EntityBean { public MusicBean() {
super();
// TODO 自动生成构造函数存根
}
private EntityContext etx;
public void setEntityContext(EntityContext ctx)
throws EJBException,
RemoteException {
etx = ctx;
// TODO 自动生成方法存根 } public void unsetEntityContext() throws EJBException, RemoteException {
// TODO 自动生成方法存根 } public void ejbRemove()
throws RemoveException,
EJBException,
RemoteException {
// TODO 自动生成方法存根 } public void ejbActivate() throws EJBException, RemoteException {
// TODO 自动生成方法存根 } public void ejbPassivate() throws EJBException, RemoteException {
// TODO 自动生成方法存根 } public void ejbLoad() throws EJBException, RemoteException {
// TODO 自动生成方法存根 } public void ejbStore() throws EJBException, RemoteException {
// TODO 自动生成方法存根 } /**
* Create method
* @ejb.create-method view-type = "local"
*/
public String ejbCreate(String content, int flag, int newsid)
throws javax.ejb.CreateException {
// TODO Auto-generated method stub
System.out.println("ejbCreate0...");
setContent(content);
setFlag(flag);
setNewsid(newsid);
System.out.println("ejbCreate1...");
return content;
}
/**
* Post Create method
*/
public void ejbPostCreate(String content, int flag, int newsid)
throws javax.ejb.CreateException {
// TODO Auto-generated method stub
}
/**
* Getter for CMP Field newsid
*
* @ejb.pk-field
* @ejb.persistent-field
* @ejb.interface-method view-type="local"
*/
public abstract int getNewsid(); /**
* Setter for CMP Field newsid
*
* @ejb.interface-method view-type="local"
*/
public abstract void setNewsid(int value); /**
* Getter for CMP Field content
*
*
* @ejb.persistent-field
* @ejb.interface-method view-type="local"
*/
public abstract String getContent(); /**
* Setter for CMP Field content
*
* @ejb.interface-method view-type="local"
*/
public abstract void setContent(String value); /**
* Getter for CMP Field flag
*
*
* @ejb.persistent-field
* @ejb.interface-method view-type="local"
*/
public abstract int getFlag(); /**
* Setter for CMP Field flag
*
* @ejb.interface-method view-type="local"
*/
public abstract void setFlag(int value); /**
* @ejb.create-method
* @return
*
*/
public String ejbCreate() throws javax.ejb.CreateException {
System.out.println("ejbCreate...");
// TODO Auto-generated method stub
return null;
}
/**
* Post Create method
*/
public void ejbPostCreate() throws javax.ejb.CreateException { // TODO Auto-generated method stub
} /**
* Business method
* @ejb.interface-method view-type = "local"
*/
public String busstest() {
// TODO Auto-generated method stub
return null;
}
}
MusicLocalHome.java
/*
* Generated by XDoclet - Do not edit!
*/
package music.interfaces;/**
* Local home interface for Music.
*/
public interface MusicLocalHome
extends javax.ejb.EJBLocalHome
{
public static final String COMP_NAME="java:comp/env/ejb/MusicLocal";
public static final String JNDI_NAME="MusicLocal"; public music.interfaces.MusicLocal create(java.lang.String content , int flag , int newsid)
throws javax.ejb.CreateException; public music.interfaces.MusicLocal create()
throws javax.ejb.CreateException; public java.util.Collection findAll()
throws javax.ejb.FinderException; public music.interfaces.MusicLocal findByPrimaryKey(java.lang.String pk)
throws javax.ejb.FinderException;}musicLocal.java
/*
* Generated by XDoclet - Do not edit!
*/
package music.interfaces;/**
* Local interface for Music.
*/
public interface MusicLocal
extends javax.ejb.EJBLocalObject
{
/**
* Getter for CMP Field newsid
*/
public int getNewsid( ) ; /**
* Setter for CMP Field newsid
*/
public void setNewsid( int value ) ; /**
* Getter for CMP Field content
*/
public java.lang.String getContent( ) ; /**
* Setter for CMP Field content
*/
public void setContent( java.lang.String value ) ; /**
* Getter for CMP Field flag
*/
public int getFlag( ) ; /**
* Setter for CMP Field flag
*/
public void setFlag( int value ) ; /**
* Business method
*/
public java.lang.String busstest( ) ;}
import javax.ejb.EJBException;
import javax.ejb.EntityBean;
import javax.ejb.EntityContext;
import javax.ejb.RemoveException;
import java.util.Collection;/**
* @ejb.bean name="Music"
* display-name="Name for Music"
* description="Description for Music"
* jndi-name="ejb/Music"
* type="CMP"
* cmp-version="2.x"
* view-type="local"
* primkey-field = "content"
* @ejb.persistence table-name = "musicnews" read-only = "false"
* @jboss.persistence create-table = "true" remove-table = "false" datasource = "java:MySqlDS" datasource-mapping = "mySQL"
* @ejb.finder signature = "Collection findAll()" unchecked = "true" query = "select object(g) from Music g"
*
*/
public abstract class MusicBean implements EntityBean { public MusicBean() {
super();
// TODO 自动生成构造函数存根
}
private EntityContext etx;
public void setEntityContext(EntityContext ctx)
throws EJBException,
RemoteException {
etx = ctx;
// TODO 自动生成方法存根 } public void unsetEntityContext() throws EJBException, RemoteException {
// TODO 自动生成方法存根 } public void ejbRemove()
throws RemoveException,
EJBException,
RemoteException {
// TODO 自动生成方法存根 } public void ejbActivate() throws EJBException, RemoteException {
// TODO 自动生成方法存根 } public void ejbPassivate() throws EJBException, RemoteException {
// TODO 自动生成方法存根 } public void ejbLoad() throws EJBException, RemoteException {
// TODO 自动生成方法存根 } public void ejbStore() throws EJBException, RemoteException {
// TODO 自动生成方法存根 } /**
* Create method
* @ejb.create-method view-type = "local"
*/
public String ejbCreate(String content, int flag, int newsid)
throws javax.ejb.CreateException {
// TODO Auto-generated method stub
System.out.println("ejbCreate0...");
setContent(content);
setFlag(flag);
setNewsid(newsid);
System.out.println("ejbCreate1...");
return content;
}
/**
* Post Create method
*/
public void ejbPostCreate(String content, int flag, int newsid)
throws javax.ejb.CreateException {
// TODO Auto-generated method stub
}
/**
* Getter for CMP Field newsid
*
* @ejb.pk-field
* @ejb.persistent-field
* @ejb.interface-method view-type="local"
*/
public abstract int getNewsid(); /**
* Setter for CMP Field newsid
*
* @ejb.interface-method view-type="local"
*/
public abstract void setNewsid(int value); /**
* Getter for CMP Field content
*
*
* @ejb.persistent-field
* @ejb.interface-method view-type="local"
*/
public abstract String getContent(); /**
* Setter for CMP Field content
*
* @ejb.interface-method view-type="local"
*/
public abstract void setContent(String value); /**
* Getter for CMP Field flag
*
*
* @ejb.persistent-field
* @ejb.interface-method view-type="local"
*/
public abstract int getFlag(); /**
* Setter for CMP Field flag
*
* @ejb.interface-method view-type="local"
*/
public abstract void setFlag(int value); /**
* @ejb.create-method
* @return
*
*/
public String ejbCreate() throws javax.ejb.CreateException {
System.out.println("ejbCreate...");
// TODO Auto-generated method stub
return null;
}
/**
* Post Create method
*/
public void ejbPostCreate() throws javax.ejb.CreateException { // TODO Auto-generated method stub
} /**
* Business method
* @ejb.interface-method view-type = "local"
*/
public String busstest() {
// TODO Auto-generated method stub
return null;
}
}
MusicLocalHome.java
/*
* Generated by XDoclet - Do not edit!
*/
package music.interfaces;/**
* Local home interface for Music.
*/
public interface MusicLocalHome
extends javax.ejb.EJBLocalHome
{
public static final String COMP_NAME="java:comp/env/ejb/MusicLocal";
public static final String JNDI_NAME="MusicLocal"; public music.interfaces.MusicLocal create(java.lang.String content , int flag , int newsid)
throws javax.ejb.CreateException; public music.interfaces.MusicLocal create()
throws javax.ejb.CreateException; public java.util.Collection findAll()
throws javax.ejb.FinderException; public music.interfaces.MusicLocal findByPrimaryKey(java.lang.String pk)
throws javax.ejb.FinderException;}musicLocal.java
/*
* Generated by XDoclet - Do not edit!
*/
package music.interfaces;/**
* Local interface for Music.
*/
public interface MusicLocal
extends javax.ejb.EJBLocalObject
{
/**
* Getter for CMP Field newsid
*/
public int getNewsid( ) ; /**
* Setter for CMP Field newsid
*/
public void setNewsid( int value ) ; /**
* Getter for CMP Field content
*/
public java.lang.String getContent( ) ; /**
* Setter for CMP Field content
*/
public void setContent( java.lang.String value ) ; /**
* Getter for CMP Field flag
*/
public int getFlag( ) ; /**
* Setter for CMP Field flag
*/
public void setFlag( int value ) ; /**
* Business method
*/
public java.lang.String busstest( ) ;}
解决方案 »
- JDBC问题,定时器执行查询方法时的问题
- struts2的错误
- 有人会使用 dhtmlxTree吗 他有个方法是loadXMLString() 谁能给个例子
- 请问一个熟悉Spring的人士可以从事哪些工作,请多多指教!
- 急急急 头疼死了~struts
- 学习ssh 事务管理,有配置事务管理器,但是没有指定哪个类需要事务管理,但是service 中的事务还是可以执行,不解,求大声帮帮忙
- 放分100,在装tomcat时候遇到的奇怪问题`````````
- 能否使用J2EE使非java程序之间能够互相传递信息?
- 《J2EE技术内幕》怎么样啊?花50元买的
- 为什么 ServletContextListener 不受spring管理
- 一个rmi问题:服务器对象的激活示例,运行ProductActivator.class报错
- 求救:关于求一个已知元素名的元素的父元素(在线等)
程序到这儿的时候出错,而本身,create()并没有添加任何的代码.
给你推荐一个 JAVA高手Q群 18349943
你可以试验修改为:
public String ejbCreate()
throws javax.ejb.CreateException {
// TODO Auto-generated method stub
System.out.println("ejbCreate0...");
setContent("11");
setFlag(12);
setNewsid(13);
System.out.println("ejbCreate1...");
return content;
}但是只能自行执行一次,因为相应的记录已经创建了
原文地址http://www.jboss.com/?module=bb&op=viewtopic&p=3882728
1] Edit conf/jboss-service.xml and make CallByvalue as 'true' in NamingService as below <mbean code="org.jboss.naming.NamingService"
name="jboss:service=Naming"
xmbean-dd="resource:xmdesc/NamingService-xmbean.xml"> 2] Edit deploy/ear-deployer.xml, and set Isloated and CallByvalue as true 3]Edit deploy\jbossweb-tomcat55.sar\META-INF\jboss-service.xml , and set Java2ClassLoadingCompilance and UseJbossWebLoader attributes as false 有的时间可能需要调整
Java2ClassLoadingCompilance and UseJbossWebLoader attributes as true才能正确执行,你应当根据你的程序来测试调整一下就可以了