Custom finder with dependent objects
phvramans Sep 8, 2001 4:25 AMWhen I use dependent objects in custom finder methods I get the following problem.i.e the finder gives me the problem.
I have attached all the files required.Please help me out.
Remote
========
package com.hyperlevel.ejb.useraccount;
import java.rmi.RemoteException;
import javax.ejb.*;
import com.hyperlevel.ejb.utility.*;
/**
* Title: AccountInfo.java
* Description: The Remote Interface for the Entity Bean used in Registration Process and maintaining Player Information.
* Copyright: Copyright (c) Applabs
* Company: Applabs
* @author Venkataraman
* @version 1.0
* Modified by :
* Date :
* Description :
*/
public interface AccountInfo extends EJBObject {
/* Gets the BillingAddress,AccountBal,H1CreditBal,CreditcardInfo
*
*/
public PlayerBilling getBilling()
throws RemoteException;
/**
* Sets the BillingAddress,AccountBal,H1CreditBal,CreditcardInfo
*
*/
public void setBilling(PlayerBilling billing)
throws RemoteException;
file://Interfaces to be added to update the Fields Left in PlayerAccount
public void deposit(double amount)
throws RemoteException;
public void withdraw(double amount)
throws RemoteException;
public void credit(double amount)
throws RemoteException;
public void creditHL(double amount)
throws RemoteException;
public void debit(double amount)
throws RemoteException;
public double getLossLimit()
throws RemoteException;
public void setLossLimit(double amount)
throws RemoteException;
public double getDepositLimit()
throws RemoteException;
public void setDepositLimit(double amount)
throws RemoteException;
}
===================================
Bean
====================================
package com.hyperlevel.ejb.useraccount;
import javax.ejb.EntityBean;
import javax.ejb.EntityContext;
import java.rmi.RemoteException;
import com.hyperlevel.ejb.utility.*;
/**
* Title: AccountInfoBean.java
* Description: The Entity Bean used in Registration Process and maintaining Player * Information.
*
* Copyright: Copyright (c) Applabs
* Company: Applabs
* @author Venkataraman
* @version 1.0
* Modified by :
* Date :
* Description :
*/
public class AccountInfoBean
implements EntityBean
{
EntityContext ctx;
public String username;
public Double accountBal;
public Double h1CreditBal;
public CreditCardInfo ccinfo;
public PostalAddr postalAddr;
private PlayerBilling billing;
public boolean isDirty;
/**
* Returns whether the EJBean has been modified or not.
*
* This method must be public for the container to be able to invoke it.
*
* @return boolean isDirty
*/
public boolean isModified() {
return isDirty;
}
/**
* Sets the EJBean's modified flag.
*
* @param flag Modified Flag
*/
public void setModified(boolean flag) {
isDirty = flag;
}
/**
* Create an instance of a Class.
*/
public String ejbCreate (String username,
PlayerBilling billing)
{
this.username = username;
setBilling(billing);
return null;
}
public void ejbPostCreate(String username,PlayerBilling billing) { }
public PlayerBilling getBilling()
{
if (billing == null)
{
billing = new PlayerBilling();
billing.setccinfo(ccinfo);
billing.seth1CreditBal(h1CreditBal.doubleValue());
billing.setaccountBal(accountBal.doubleValue());
billing.setbillingAddr(postalAddr);
}
return billing;
}
public void setBilling(PlayerBilling billing)
{
this.ccinfo = billing.getccinfo();
this.postalAddr = billing.getbillingAddr();
this.h1CreditBal = new Double(billing.geth1CreditBal());
this.accountBal = new Double(billing.getaccountBal());
}
public void deposit(double amount)
throws RemoteException
{
this.accountBal = new Double(accountBal.doubleValue() + amount);
setModified(true) ;
}
public void withdraw(double amount)
throws RemoteException
{
this.accountBal = new Double(accountBal.doubleValue() - amount);
setModified(true) ;
}
public void credit(double amount)
throws RemoteException{}
public void creditHL(double amount)
throws RemoteException{}
public void debit(double amount)
throws RemoteException{}
public double getLossLimit()
throws RemoteException{return 0;}
public void setLossLimit(double amount)
throws RemoteException{}
public double getDepositLimit()
throws RemoteException{return 0 ;}
public void setDepositLimit(double amount)
throws RemoteException{}
public void setEntityContext(EntityContext ctx) { this.ctx = ctx; }
public void unsetEntityContext() { ctx = null; }
public void ejbActivate() {}
public void ejbPassivate()
{
billing = null;
}
public void ejbLoad()
{
billing = null;
}
public void ejbStore() { }
public void ejbRemove() { }
}
===============================
HOME
================================
package com.hyperlevel.ejb.useraccount;
import javax.ejb.EJBHome;
import javax.ejb.CreateException;
import javax.ejb.FinderException;
import java.rmi.RemoteException;
import java.util.Collection;
import com.hyperlevel.ejb.utility.*;
/**
* Title: AccountInfoHome.java
* Description: The Remote Interface for the Entity Bean used in Registration
* Process and maintaining Player Information.
*
* Copyright: Copyright (c) Applabs
* Company: Applabs
* @author Venkataraman
* @version 1.0
* Modified by :
* Date :
* Description :
*/
public interface AccountInfoHome
extends EJBHome
{
public AccountInfo create(String username,
PlayerBilling billing )
throws CreateException, RemoteException;
public AccountInfo findByPrimaryKey(String username)
throws FinderException, RemoteException;
public Collection findCcno(String ccno)
throws FinderException, RemoteException;
}
======================================
JAWS
==================================
<ejb-name>AccountInfoBean</ejb-name>
<table-name>PLAYERACCOUNT</table-name>
<remove-table>false</remove-table>
<cmp-field>
<field-name>username</field-name>
<column-name>user_c_name</column-name>
</cmp-field>
<cmp-field>
<field-name>ccinfo.expMonth</field-name>
<column-name>expmonth</column-name>
</cmp-field>
<cmp-field>
<field-name>ccinfo.expYear</field-name>
<column-name>expyear</column-name>
</cmp-field>
<cmp-field>
<field-name>ccinfo.ccn</field-name>
<column-name>credit_c_cardno</column-name>
</cmp-field>
<cmp-field>
<field-name>ccinfo.cchash</field-name>
<column-name>credit_c_cardhash</column-name>
<java-type>String</java-type>
<jdbc-type>VARCHAR</jdbc-type>
<sql-type>VARCHAR(50)</sql-type>
</cmp-field>
<cmp-field>
<field-name>ccinfo.type</field-name>
<column-name>card_c_type</column-name>
</cmp-field>
<cmp-field>
<field-name>accountBal</field-name>
<column-name>account_dl_balance</column-name>
</cmp-field>
<cmp-field>
<field-name>h1CreditBal</field-name>
<column-name>hyper_dl_crlevel</column-name>
</cmp-field>
findCcno
ccinfo.cchash = {0}
================================
EJB-JAR
===============================
Used for UserAccount
<ejb-name>AccountInfoBean</ejb-name>
com.hyperlevel.ejb.useraccount.AccountInfoHome
com.hyperlevel.ejb.useraccount.AccountInfo
<ejb-class>com.hyperlevel.ejb.useraccount.AccountInfoBean</ejb-class>
<persistence-type>Container</persistence-type>
<prim-key-class>java.lang.String</prim-key-class>
False
<cmp-field><field-name>username</field-name></cmp-field>
<cmp-field><field-name>ccinfo</field-name></cmp-field>
<cmp-field><field-name>accountBal</field-name></cmp-field>
<cmp-field><field-name>h1CreditBal</field-name></cmp-field>
<primkey-field>username</primkey-field>
==========================================
The stack trace
=========================================
---------------------------------------------------------------------------------------------
Stack Trace
-------------------
[UserAccount] javax.ejb.FinderException: Find failed
[UserAccount] at org.jboss.ejb.plugins.jaws.jdbc.JDBCFinderCommand.execute(JDB
CFinderCommand.java:105)
[UserAccount] at org.jboss.ejb.plugins.jaws.jdbc.JDBCFindEntitiesCommand.execu
te(JDBCFindEntitiesCommand.java:153)
[UserAccount] at org.jboss.ejb.plugins.jaws.JAWSPersistenceManager.findEntitie
s(JAWSPersistenceManager.java:144)
[UserAccount] at org.jboss.ejb.plugins.CMPPersistenceManager.findEntities(CMPP
ersistenceManager.java:308)
[UserAccount] at org.jboss.ejb.EntityContainer.find(EntityContainer.java:489)
[UserAccount] at java.lang.reflect.Method.invoke(Native Method)
[UserAccount] at org.jboss.ejb.EntityContainer$ContainerInterceptor.invokeHome
(EntityContainer.java:765)
[UserAccount] at org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invoke
Home(EntitySynchronizationInterceptor.java:224)
[UserAccount] at org.jboss.ejb.plugins.EntityInstanceInterceptor.invokeHome(En
tityInstanceInterceptor.java:87)
[UserAccount] at org.jboss.ejb.plugins.TxInterceptorCMT.invokeNext(TxIntercept
orCMT.java:135)
[UserAccount] at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(Tx
InterceptorCMT.java:307)
[UserAccount] at org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxIntercept
orCMT.java:86)
[UserAccount] at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(Security
Interceptor.java:103)
[UserAccount] at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogIntercepto
r.java:106)
[UserAccount] at org.jboss.ejb.EntityContainer.invokeHome(EntityContainer.java
:342)
[UserAccount] at org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker.invoke
Home(JRMPContainerInvoker.java:437)
[UserAccount] at org.jboss.ejb.plugins.jrmp.interfaces.HomeProxy.invokeHome(Ho
meProxy.java:237)
[UserAccount] at org.jboss.ejb.plugins.jrmp.interfaces.HomeProxy.invoke(HomePr
oxy.java:182)
[UserAccount] at $Proxy31.findCcno(Unknown Source)
[UserAccount] at com.hyperlevel.ejb.useraccount.UserAccountBean.openDeposit(Us
erAccountBean.java:106)
[UserAccount] at java.lang.reflect.Method.invoke(Native Method)
[UserAccount] at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.
invoke(StatelessSessionContainer.java:543)
[UserAccount] at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.inv
oke(StatelessSessionInstanceInterceptor.java:87)
[UserAccount] at org.jboss.ejb.plugins.TxInterceptorCMT.invokeNext(TxIntercept
orCMT.java:133)
[UserAccount] at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(Tx
InterceptorCMT.java:481)
[UserAccount] at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCM
T.java:99)
[UserAccount] at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInte
rceptor.java:128)
[UserAccount] at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.ja
va:195)
[UserAccount] at org.jboss.ejb.StatelessSessionContainer.invoke(StatelessSessi
onContainer.java:286)
[UserAccount] at org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker.invoke
(JRMPContainerInvoker.java:483)
[UserAccount] at org.jboss.ejb.plugins.jrmp.interfaces.GenericProxy.invokeCont
ainer(GenericProxy.java:335)
[UserAccount] at org.jboss.ejb.plugins.jrmp.interfaces.StatelessSessionProxy.i
nvoke(StatelessSessionProxy.java:123)
[UserAccount] at $Proxy8.openDeposit(Unknown Source)
[UserAccount] at _0002fDeposit_0005fsubmit_00031_0002ejspDeposit_0005fsubmit1_
jsp_7._jspService(_0002fDeposit_0005fsubmit_00031_0002ejspDeposit_0005fsubmit1_j
sp_7.java:317)
[UserAccount] at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.jav
a:119)
[UserAccount] at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
[UserAccount] at org.apache.jasper.servlet.JspServlet$JspCountedServlet.servic
e(JspServlet.java:130)
[UserAccount] at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
[UserAccount] at org.apache.jasper.servlet.JspServlet$JspServletWrapper.servic
e(JspServlet.java:282)
[UserAccount] at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServle
t.java:429)
[UserAccount] at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:
500)
[UserAccount] at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
[UserAccount] at org.apache.tomcat.core.ServletWrapper.doService(ServletWrappe
r.java:405)
[UserAccount] at org.apache.tomcat.core.Handler.service(Handler.java:287)
[UserAccount] at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.
java:372)
[UserAccount] at org.apache.tomcat.core.ContextManager.internalService(Context
Manager.java:812)
[UserAccount] at org.apache.tomcat.core.ContextManager.service(ContextManager.
java:758)
[UserAccount] at org.apache.tomcat.service.http.HttpConnectionHandler.processC
onnection(HttpConnectionHandler.java:213)
[UserAccount] at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoi
nt.java:416)
[UserAccount] at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadP
ool.java:501)
[UserAccount] at java.lang.Thread.run(Thread.java:484)
[Default] javax.transaction.TransactionRolledbackException: null; nested excepti
on is:
javax.ejb.EJBException
k trace
==============================================
Thanks
Raman