Apache Geronimo 机器修理店应用示例,第 3 部分: EJB:Bean 管理的持久性和容器管理的持久性
2010-04-16 00:00:00 来源:WEB开发网 public Integer ejbCreate(SparePartKey key)
throws CreateException
{
this.partID = key.partID;
this.description = key.description;
this.price = key.price;
this.horsePower = key.horsePower;
try
{
openConnection();
insertRow();
closeConnection();
} // end try
catch (Exception e)
{
throw new CreateException("ejbCreate: " + e.getMessage());
} // end catch
return new Integer(key.partID);
} // end ejbCreate
public void ejbPostCreate(SparePartKey key)
{
} // end ejbPostCreate
public Integer ejbFindByPrimaryKey(Integer primaryKey)
throws FinderException
{
boolean resultFlag;
try
{
openConnection();
resultFlag = selectByPrimaryKey(primaryKey);
closeConnection();
} // end try
catch (Exception e)
{
throw new EJBException("ejbFindByPrimaryKey: " + e.getMessage());
} // end catch
if (resultFlag)
{
return primaryKey;
}
else
{
throw new ObjectNotFoundException
("Row for id: (" + primaryKey.intValue() + ") not found.");
} // end if
} // end ejbFindByPrimaryKey
public Collection ejbFindByAll()
throws FinderException
{
Collection result = null;
try
{
openConnection();
result = selectAll();
closeConnection();
} // end try
catch (Exception e)
{
throw new EJBException("ejbFindByAll: " + e.getMessage());
} // end catch
if (result.isEmpty())
{
throw new ObjectNotFoundException("No rows found.");
}
else
{
return result;
} // end if
} // end ejbFindByAll
- ››apache设置域名绑定 以及绑定不起作用的排查
- ››apache rewrite将指定URL转向指定的几个服务器
- ››apache配置文件httpd.comf部分参数说明
- ››Apache+Mysql+PHP+phpMyAdmin+Mac OS X 10.7 Lion...
- ››apache+tomcat负载均衡_项目实例
- ››apache mysql php 源码编译使用
- ››Apache添加mod_aspdotnet.so支持ASP.NET配置指南
- ››Apache中改变php.ini的路径
- ››Apache2.2与Tomcat6整合及虚拟主机配置
- ››Apache+php+mysql在windows下的安装与配置图解
- ››Apache+Subversion完美结合,CentOS下实现版本控制...
- ››Apache HTTPServer2.2.16 发布
更多精彩
赞助商链接