📄 myitembean.java
字号:
/*
* Created on 2004-9-17
*
* To change the template for this generated file go to
* Window - Preferences - Java - Code Generation - Code and Comments
*/
package com.ejbstudy;
import javax.ejb.EntityBean;
/**
* @ejb.bean name="MyItem"
* jndi-name="MyItemBean"
* type="CMP"
* primkey-field="id"
* schema="mySchema"
* cmp-version="2.x"
*
*--
* This is needed for JOnAS.
* If you are not using JOnAS you can safely remove the tags below.
* @jonas.bean ejb-name="MyItem"
* jndi-name="MyItemBean"
* @jonas.jdbc-mapping jndi-name="java:/MySqlDS" jdbc-table-name="item"
* --
*
* @ejb.persistence
* table-name="item"
*
* @ejb.finder
* query="SELECT OBJECT(a) FROM mySchema as a"
* signature="java.util.Collection findAll()"
*
*--
* This is needed for JOnAS.
* If you are not using JOnAS you can safely remove the tags below.
* @jonas.finder-method-jdbc-mapping method-name="findAll"
* jdbc-where-clause=""
* @jonas.jdbc-mapping jndi-name="java:/MySqlDS"
* jdbc-table-name="item"
*
*--
*
**/
public abstract class MyItemBean implements EntityBean {
public String ejbCreate(String id,Integer quanti,Double price,String description,String supplierid)throws javax.ejb.CreateException{
if(id==null)throw new javax.ejb.CreateException("The itemid is required");
setId(id);
setQuantity(quanti);
setPrice(price);
setDescription(description);
setSupplierid(supplierid);
return id;
}
/**
* The ejbCreate method.
*
* @ejb.create-method
*/
public java.lang.String ejbCreate() throws javax.ejb.CreateException {
// EJB 2.0 spec says return null for CMP ejbCreate methods.
// TODO: YOU MUST INITIALIZE THE FIELDS FOR THE BEAN HERE.
// setMyField("Something");
return null;
}
/**
* The container invokes this method immediately after it calls ejbCreate.
*
*/
public void ejbPostCreate() throws javax.ejb.CreateException {
}
/**
* Returns the id
* @return the id
*
* @ejb.persistent-field
* @ejb.persistence
* column-name="itemid"
* sql-type="varchar"
* @ejb.pk-field
* @ejb.interface-method
*
* --
* This is needed for JOnAS.
* If you are not using JOnAS you can safely remove the tags below.
* @jonas.cmp-field-jdbc-mapping field-name="id"
* jdbc-field-name="itemid"
*
--
*/
public abstract java.lang.String getId();
/**
* Sets the id
*
* @param java.lang.String the new id value
*
* @ejb.interface-method
*/
public abstract void setId(java.lang.String id);
/**
* Returns the supplierid
* @return the supplierid
*
* @ejb.persistent-field
* @ejb.persistence
* column-name="supplierid"
* sql-type="varchar"
*
* @ejb.interface-method
*
* --
* This is needed for JOnAS.
* If you are not using JOnAS you can safely remove the tags below.
* @jonas.cmp-field-jdbc-mapping field-name="supplierid"
* jdbc-field-name="supplierid"
*
--
*/
public abstract java.lang.String getSupplierid();
/**
* Sets the supplierid
*
* @param java.lang.String the new supplierid value
*
* @ejb.interface-method
*/
public abstract void setSupplierid(java.lang.String supplierid);
/**
* Returns the description
* @return the description
*
* @ejb.persistent-field
* @ejb.persistence
* column-name="description"
* sql-type="varchar"
*
* @ejb.interface-method
*
* --
* This is needed for JOnAS.
* If you are not using JOnAS you can safely remove the tags below.
* @jonas.cmp-field-jdbc-mapping field-name="description"
* jdbc-field-name="description"
*
--
*/
public abstract java.lang.String getDescription();
/**
* Sets the description
*
* @param java.lang.String the new description value
*
* @ejb.interface-method
*/
public abstract void setDescription(java.lang.String description);
/**
* Returns the quantity
* @return the quantity
*
* @ejb.persistent-field
* @ejb.persistence
* column-name="quantity"
* sql-type="int"
*
* @ejb.interface-method
*
* --
* This is needed for JOnAS.
* If you are not using JOnAS you can safely remove the tags below.
* @jonas.cmp-field-jdbc-mapping field-name="quantity"
* jdbc-field-name="quantity"
*
--
*/
public abstract java.lang.Integer getQuantity();
/**
* Sets the quantity
*
* @param java.lang.Integer the new quantity value
*
* @ejb.interface-method
*/
public abstract void setQuantity(java.lang.Integer quantity);
/**
* Returns the price
* @return the price
*
* @ejb.persistent-field
* @ejb.persistence
* column-name="price"
* sql-type="decimal"
*
* @ejb.interface-method
*
* --
* This is needed for JOnAS.
* If you are not using JOnAS you can safely remove the tags below.
* @jonas.cmp-field-jdbc-mapping field-name="price"
* jdbc-field-name="price"
*
--
*/
public abstract java.lang.Double getPrice();
/**
* Sets the price
*
* @param java.lang.Double the new price value
*
* @ejb.interface-method
*/
public abstract void setPrice(java.lang.Double price);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -