I _REALLY_ Need help please!
I have 2 common errors when saving Entities.
1. java.lang.IllegalArgumentException: argument type mismatch
2. java.lang.ClassCastException (don't have stack right now.....)
So I seem to get into the ejbCreate fully, but then I get an error in the
postCreate before I even print anything!
CreditApplicationManagerBean: (Where the error occurs):
****************************************************************************
****************************************************************************
*******************************
public CreditApplicationDto conclude( CreditApplicationDto
pCreditApplicationDto )
throws EJBException {
....
// Business Card Product....
BusinessCardLocalHome businessCardLocalHome =
BusinessCardUtil.getLocalHome();
log.info( "businessCardDto: " +
pCreditApplicationDto.getBusinessCardDto().toString() );
>>>>ERROR LINE >>>>>>>BusinessCardLocal businessCardLocal =
businessCardLocalHome.create( pCreditApplicationDto.getBusinessCardDto() );
if( log.isInfoEnabled() ) {
log.info( "=============================================" );
log.info( "pCreditApplicationDto.getBusinessCardDto(): " +
pCreditApplicationDto.getBusinessCardDto().toString() );
//log.info( "businessCardLocal.toString():" +
businessCardLocal.toString() );
log.info( "=============================================" );
}
......
BusinessCardBean:ejbCreate(...):
****************************************************************************
****************************************************************************
******************************* public java.lang.String ejbCreate(
com.wf.bd.ice.product.BusinessCardDto pBusinessCardDto )
throws javax.ejb.EJBException, javax.ejb.CreateException
{
if( log.isInfoEnabled() ) {
log.info( "=============================================" );
log.info( "ejbCreate( com.wf.bd.ice.product.pBusinessCardDto
pBusinessCardDto )" );
log.info( "pBusinessCardDto: " + pBusinessCardDto.toString() );
}
setProductPK( BusinessCardUtil.generateGUID(pBusinessCardDto) );
if( log.isInfoEnabled() ) {
log.info( "setProductPK(
BusinessCardUtil.generateGUID(pBusinessCardDto) )" );
log.info( "getBusinessCard PK: " + getProductPK() );
log.info( "=============================================" );
}
return null;
}
BusinessCardBean:ejbPostCreate(...):
****************************************************************************
****************************************************************************
*******************************
public void ejbPostCreate( com.wf.bd.ice.product.BusinessCardDto
pBusinessCardDto )
throws javax.ejb.EJBException, javax.ejb.CreateException
{
/*
Update the EJB as the CMR information cannot be set at create time:
java.lang.IllegalStateException: A CMR field cannot be set in
ejbCreate;
this should be done in the ejbPostCreate method instead [EJB 2.0
Spec. 10.5.2].
*/
if( log.isInfoEnabled() ) {
log.info( "=============================================" );
log.info( "ejbPostCreate( com.wf.bd.ice.product.BusinessCardDto
pBusinessCardDto )" );
log.info( "pBusinessCardDto: " + pBusinessCardDto.toString() );
}
setBusinessCardDto( pBusinessCardDto );
setProductType( "BUS_CARD" );
if( log.isInfoEnabled() ) {
log.info( "getBusinessCardDto().toString(): " +
getBusinessCardDto().toString() );
log.info( "=============================================" );
}
}
StackTrace:
****************************************************************************
****************************************************************************
*******************************
[INFO] BusinessCard_ev1n9i__WebLogic_CMP_RDBMS -
-=============================================
[INFO] BusinessCard_ev1n9i__WebLogic_CMP_RDBMS - -ejbCreate(
com.wf.bd.ice.product.pBusinessCardDto pBusinessCardDto )
[INFO] BusinessCard_ev1n9i__WebLogic_CMP_RDBMS - -pBusinessCardDto:
{productPK=null applicationId=null productType=null cardBrand=MC
productCode=null piCodenull couponCode=ABC requestAmount=20000
businessName=null automaticPayment=M automaticPaymentAccountFK=null
electronicTransfer=null electronicTransferAccounFK=null
creditProtection=null overdraftProtection=null
overdraftProtectionAccountFK=null lineIncrease=true businessMiles=null}
[INFO] BusinessCard_ev1n9i__WebLogic_CMP_RDBMS - -setProductPK(
BusinessCardUtil.generateGUID(pBusinessCardDto) )
[INFO] BusinessCard_ev1n9i__WebLogic_CMP_RDBMS - -getBusinessCard PK:
0a6d00e57f00000101a826c5b0982402
[INFO] BusinessCard_ev1n9i__WebLogic_CMP_RDBMS -
-=============================================
[ERROR] CreditApplicationManager_9j600a_Impl - -Error performing
CreditApplicationManager.conclude( CreditApplicationDto )
<javax.ejb.EJBException: EJB Exception::
java.lang.IllegalArgumentException: argument type mismatch
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at
weblogic.ejb20.cmp.rdbms.RDBMSPersistenceManager.scalarFinder(RDBMSPersisten
ceManager.java:294)
at
weblogic.ejb20.manager.BaseEntityManager.scalarFinder(BaseEntityManager.java
:1575)
at
weblogic.ejb20.manager.BaseEntityManager.localScalarFinder(BaseEntityManager
.java:1559)
at
com.wf.bd.ice.creditapplication.CreditApplication_rwkuka__WebLogic_CMP_RDBMS
.getBusinessCard(CreditApplication_rwkuka__WebLogic_CMP_RDBMS.java:655)
at
com.wf.bd.ice.creditapplication.CreditApplication_rwkuka__WebLogic_CMP_RDBMS
.__WL_setRestBusinessCard(CreditApplication_rwkuka__WebLogic_CMP_RDBMS.java:
727)
at
com.wf.bd.ice.product.BusinessCard_ev1n9i__WebLogic_CMP_RDBMS.__WL_postSetCr
editApplicationCMP_businessCard(BusinessCard_ev1n9i__WebLogic_CMP_RDBMS.java
:1139)
at
com.wf.bd.ice.product.BusinessCard_ev1n9i__WebLogic_CMP_RDBMS.ejbPostCreate(
BusinessCard_ev1n9i__WebLogic_CMP_RDBMS.java:4516)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at weblogic.ejb20.manager.DBManager.create(DBManager.java:1261)
at
weblogic.ejb20.manager.DBManager.localCreate(DBManager.java:1100)
at
weblogic.ejb20.internal.EntityEJBLocalHome.create(EntityEJBLocalHome.java:17
1)
at
com.wf.bd.ice.product.BusinessCard_ev1n9i_LocalHomeImpl.create(BusinessCard_
ev1n9i_LocalHomeImpl.java:95)
at
com.wf.bd.ice.creditapplication.CreditApplicationManagerBean.conclude(Credit
ApplicationManagerBean.java:146)
at
com.wf.bd.ice.creditapplication.CreditApplicationManager_9j600a_EOImpl.concl
ude(CreditApplicationManager_9j600a_EOImpl.java:98)
at
com.wf.bd.ice.delegates.CreditApplicationServicesDelegate.conclude(CreditApp
licationServicesDelegate.java:57)
at
com.wf.bd.ice.creditapplication.CreditApplicationActions.conclude(CreditAppl
icationActions.java:305)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at
org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:
280)
at
org.apache.struts.actions.LookupDispatchAction.execute(LookupDispatchAction.
java:252)
at
com.wf.bd.ice.struts.BaseLookupDispatchAction.execute(BaseLookupDispatchActi
on.java:222)
at
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProces
sor.java:484)
at
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at
com.wf.bd.ice.struts.ExtendedActionServlet.process(ExtendedActionServlet.jav
a:44)
at
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(Servle
tStubImpl.java:971)
at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
:402)
at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
:305)
at
weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(W
ebAppServletContext.java:6350)
at
weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubjec
t.java:317)
at
weblogic.security.service.SecurityManager.runAs(SecurityManager.java:118)
at
weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletCo
ntext.java:3635)
at
weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java
:2585)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)
The
com.wf.bd.ice.creditapplication.CreditApplication_rwkuka__WebLogic_CMP_RDBMS
.getBusinessCard(CreditApplication_rwkuka__WebLogic_CMP_RDBMS.java:655)
error location:
****************************************************************************
****************************************************************************
*******************************
try {
__WL_businessCard_field_ =
(com.wf.bd.ice.product.BusinessCardLocal)__WL_businessCard_bm.localScalarFin
der(
__WL_businessCard_finder_,new Object[]{__WL_ctx.getPrimaryKey()});
}
catch (InternalException ie) {
if (ie.detail!=null && ie.detail instanceof
ObjectNotFoundException)
__WL_businessCard_field_ = null;
else
throw ie;
}
CreditApplicationBean.java:
****************************************************************************
****************************************************************************
*******************************
package com.wf.bd.ice.creditapplication;
import com.wf.bd.ice.business.BusinessLocal;
import com.wf.bd.ice.banker.BankerLocal;
import com.wf.bd.ice.product.BusinessCardLocal;
import com.wf.bd.ice.product.BusinessLineLocal;
import com.wf.bd.ice.product.SecuredCardLocal;
import com.wf.bd.ice.product.EquipmentExpressLocal;
import com.wf.bd.ice.sequence.SequenceManagerHome;
import com.wf.bd.ice.sequence.SequenceManagerUtil;
import com.wf.bd.ice.sequence.SequenceManager;
import java.util.Collection;
import java.util.Date;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
* The Entity bean represents a CreditApplication Entity
*
* @author Mick Knutson
*
* @ejb.bean
* name="CreditApplication"
* display-name="CreditApplication Entity for ICE"
* cmp-version="2.x"
* type="CMP"
* view-type="local"
*
local-jndi-name="local/com.wf.bd.ice.creditapplication.CreditApplicationLoca
l"
* primkey-field="applicationId"
* schema="CreditApplication"
*
* @ejb.pk class="java.lang.Long"
*
* @ejb.value-object
* name="CreditApplication"
* extends="com.wf.bd.ice.creditapplication.AbstractCreditApplication"
*
* @struts.form
* name="Action"
* extends="org.apache.struts.validator.ValidatorForm"
* include-pk="true"
* include-all="true"
*
* @ejb.util
* generate="physical"
*
* @ejb.transaction
* type="Required"
*
* @ejb.transaction-type
* type="Container"
*
* @ejb.permission unchecked="true"
*
* @weblogic.data-source-name ${weblogic.datasource}
*
* @ejb.persistence
* table-name="V_ICE_APPLICATION"
**/
public abstract class CreditApplicationBean implements javax.ejb.EntityBean
{
/** Our own Session Context. */
private javax.ejb.EntityContext myEntityCtx;
/** The <code>Log</code> instance for this application. */
private Log log = LogFactory.getLog( this.getClass() );
//
-------------------------------------------------------------------------
// Properties (Getters/Setters)
//
-------------------------------------------------------------------------
/**
* Retrieve the CreditApplication's sequenceName for use as a
primaryKey.
*
* @ejb.pk-field
* @ejb.interface-method
* @ejb.persistence column-name="applicationId"
**/
public abstract java.lang.Long getApplicationId();
/**
* No interface method for setCreditApplicationId(..). See page 130 of
the EJB 2.0 specification:
* "Once the primary key for an entity bean has been set, the Bean
Provider must
* not attempt to change it by use of set accessor methods on the
primary key
* cmp-fields. The Bean provider should therefore not expose the set
accessor
* methods for the primary key cmp-fields in the component interface of
the
* entity bean.". A work around would be to remove and then an re-create
the bean.
*/
public abstract void setApplicationId( java.lang.Long pApplicationId );
/**
* Manage the CreditApplication's originationSource
*
* @ejb.interface-method
* @ejb.persistence column-name="originationSource"
**/
public abstract String getOriginationSource();
public abstract void setOriginationSource( String pOriginationSource );
/**
* Manage the CreditApplication's dateApplicationReceived
* TODO: Might need to make the Date a java.sql.Date
*
* @ejb.interface-method
* @ejb.persistence column-name="dateApplicationReceived"
**/
public abstract Date getDateApplicationReceived();
public abstract void setDateApplicationReceived( Date
pDateApplicationReceived );
/**
* Manage the CreditApplication's applicationCompletionDate
*
* @ejb.interface-method
* @ejb.persistence column-name="applicationCompletionDate"
*
**/
public abstract Date getApplicationCompletionDate();
public abstract void setApplicationCompletionDate( Date
pApplicationCompletionDate );
//
-------------------------------------------------------------------------
// Relationship Methods
//
-------------------------------------------------------------------------
/**
* Get Business for this CreditApplication.
* This is a one (CreditApplication) to one (Business) relationship.
* We can get a BusinessDto in the creditApplicationDto.getBusiness()
method.
* We can also setBusiness( pBusiness )
*
* @ejb.interface-method view-type="local"
*
* @ejb.value-object
* compose="com.wf.bd.ice.business.BusinessDto"
* compose-name="BusinessDto"
* members="com.wf.bd.ice.business.BusinessLocal"
* members-name="Business"
* relation="external"
*
* @ejb.relation
* name="CreditApplication-Business"
* role-name="CreditApplication-has-Business"
* target-ejb="Business"
* target-role-name="Business-belongs_to-CreditApplication"
* target-cascade-delete="yes"
*
* TODO: We may be required to add an additional column
* to the Business view to support the 1 -- 1
* relationship of the Business and CreditApplication
*
* @weblogic.target-column-map
* foreign-key-column="applicationId"
* key-column="applicationId"
*/
public abstract com.wf.bd.ice.business.BusinessLocal getBusiness();
/**
* @ejb.interface-method
**/
public abstract void setBusiness( com.wf.bd.ice.business.BusinessLocal
pBusinessLocal );
/**
* Get Banker for this CreditApplication.
* This is a one (CreditApplication) to one (Banker) relationship.
* We can get a BankerDto in the creditApplicationDto.getBanker()
method.
* We can also setBanker( pBanker )
*
* @ejb.interface-method view-type="local"
*
* @ejb.value-object
* compose="com.wf.bd.ice.banker.BankerDto"
* compose-name="BankerDto"
* members="com.wf.bd.ice.banker.BankerLocal"
* members-name="Banker"
* relation="external"
*
* @ejb.relation
* name="CreditApplication-Banker"
* role-name="CreditApplication-has-Banker"
* target-ejb="Banker"
* target-role-name="Banker-belongs_to-CreditApplication"
* target-cascade-delete="yes"
*
* TODO: We may be required to add an additional column
* to the Business view to support the 1 -- 1
* relationship of the Banker and CreditApplication
*
* @weblogic.target-column-map
* foreign-key-column="bankerId"
* key-column="applicationId"
*/
public abstract com.wf.bd.ice.banker.BankerLocal getBanker();
/**
* @ejb.interface-method view-type="local"
**/
public abstract void setBanker( com.wf.bd.ice.banker.BankerLocal
pBankerLocal );
/**
* Get BusinessCard product for this CreditApplication.
* This is a one (CreditApplication) to one (BusinessCard)
relationship.
* We can get a BusinessCardDto in the
creditApplicationDto.getBusinessCard() method.
* We can also setBusinessCard( pBusinessCard )
*
* @ejb.interface-method view-type="local"
*
* @ejb.value-object
* compose="com.wf.bd.ice.product.BusinessCardDto"
* compose-name="BusinessCardDto"
* members="com.wf.bd.ice.product.BusinessCardLocal"
* members-name="BusinessCard"
* relation="external"
*
* @ejb.relation
* name="CreditApplication-BusinessCard"
* role-name="CreditApplication-has-BusinessCard"
* target-ejb="BusinessCard"
* target-role-name="BusinessCard-belongs_to-CreditApplication"
* target-cascade-delete="yes"
*
* TODO: We may be required to add an additional column
* to the Business view to support the 1 -- 1
* relationship of the BusinessCard and CreditApplication
*
* @weblogic.target-column-map
* foreign-key-column="productPK"
* key-column="applicationId"
*/
public abstract com.wf.bd.ice.product.BusinessCardLocal
getBusinessCard();
/**
* @ejb.interface-method view-type="local"
**/
public abstract void setBusinessCard(
com.wf.bd.ice.product.BusinessCardLocal pBusinessCardLocal );
/**
* Get BusinessLine for this CreditApplication.
* This is a one (CreditApplication) to one (BusinessLine)
relationship.
* We can get a BusinessLineDto in the
creditApplicationDto.getBusinessLine() method.
* We can also setBusinessLine( pBusinessLine )
*
* @ejb.interface-method view-type="local"
*
* @ejb.value-object
* compose="com.wf.bd.ice.product.BusinessLineDto"
* compose-name="BusinessLineDto"
* members="com.wf.bd.ice.product.BusinessLineLocal"
* members-name="BusinessLine"
* relation="external"
*
* @ejb.relation
* name="CreditApplication-BusinessLine"
* role-name="CreditApplication-has-BusinessLine"
* target-ejb="BusinessLine"
* target-role-name="BusinessLine-belongs_to-CreditApplication"
* target-cascade-delete="yes"
*
* TODO: We may be required to add an additional column
* to the Business view to support the 1 -- 1
* relationship of the BusinessLine and CreditApplication
*
* @weblogic.target-column-map
* foreign-key-column="productPK"
* key-column="applicationId"
*/
public abstract com.wf.bd.ice.product.BusinessLineLocal
getBusinessLine();
/**
* @ejb.interface-method view-type="local"
**/
public abstract void setBusinessLine(
com.wf.bd.ice.product.BusinessLineLocal pBusinessLineLocal );
/**
* Get EquipmentExpress for this CreditApplication.
* This is a one (CreditApplication) to one (EquipmentExpress)
relationship.
* We can get a EquipmentExpressDto in the
creditApplicationDto.getEquipmentExpress() method.
* We can also setEquipmentExpress( pEquipmentExpress )
*
* @ejb.interface-method view-type="local"
*
* @ejb.value-object
* compose="com.wf.bd.ice.product.EquipmentExpressDto"
* compose-name="EquipmentExpressDto"
* members="com.wf.bd.ice.product.EquipmentExpressLocal"
* members-name="EquipmentExpress"
* relation="external"
*
* @ejb.relation
* name="CreditApplication-EquipmentExpress"
* role-name="CreditApplication-has-EquipmentExpress"
* target-ejb="EquipmentExpress"
* target-role-name="EquipmentExpress-belongs_to-CreditApplication"
* target-cascade-delete="yes"
*
* TODO: We may be required to add an additional column
* to the Business view to support the 1 -- 1
* relationship of the EquipmentExpress and CreditApplication
*
* @weblogic.target-column-map
* foreign-key-column="productPK"
* key-column="applicationId"
*/
public abstract com.wf.bd.ice.product.EquipmentExpressLocal
getEquipmentExpress();
/**
* @ejb.interface-method view-type="local"
**/
public abstract void setEquipmentExpress(
com.wf.bd.ice.product.EquipmentExpressLocal pEquipmentExpressLocal );
/**
* Get SecuredCard for this CreditApplication.
* This is a one (CreditApplication) to one (SecuredCard) relationship.
* We can get a SecuredCardDto in the
creditApplicationDto.getSecuredCard() method.
* We can also setSecuredCard( pSecuredCard )
*
* @ejb.interface-method view-type="local"
*
* @ejb.value-object
* compose="com.wf.bd.ice.product.SecuredCardDto"
* compose-name="SecuredCardDto"
* members="com.wf.bd.ice.product.SecuredCardLocal"
* members-name="SecuredCard"
* relation="external"
*
* @ejb.relation
* name="CreditApplication-SecuredCard"
* role-name="CreditApplication-has-SecuredCard"
* target-ejb="SecuredCard"
* target-role-name="SecuredCard-belongs_to-CreditApplication"
* target-cascade-delete="yes"
*
* TODO: We may be required to add an additional column
* to the Business view to support the 1 -- 1
* relationship of the Banker and CreditApplication
*
* @weblogic.target-column-map
* foreign-key-column="productPK"
* key-column="applicationId"
*/
public abstract com.wf.bd.ice.product.SecuredCardLocal getSecuredCard();
/**
* @ejb.interface-method view-type="local"
**/
public abstract void setSecuredCard(
com.wf.bd.ice.product.SecuredCardLocal pSecuredCardLocal );
/**
* Get all Guarantor's for this CreditApplication.
* This is a one (CreditApplication) to many (Guarantors) relationship.
* We can get a Collection of GuarantorDto's in the
* creditApplicationDto.getGuarantors() method.
* We can also setGuarantors( pGuarantors )
*
* @ejb.interface-method view-type="local"
*
* @ejb.relation
* name="CreditApplication-Guarantor"
* role-name="CreditApplication-has-Guarantors"
* target-ejb="Guarantor"
* target-role-name="Guarantor-belongs_to-CreditApplication"
* target-cascade-delete="yes"
*
* @weblogic.target-column-map
* foreign-key-column="guarantorPK"
* key-column="applicationId"
*
* @ejb.value-object
* compose="com.wf.bd.ice.guarantor.GuarantorDto"
* compose-name="Guarantor"
* members="com.wf.bd.ice.guarantor.GuarantorLocal"
* members-name="Guarantor"
* relation="external"
* type="java.util.Collection"
*/
public abstract Collection getGuarantors();
/**
* @ejb.interface-method view-type="local"
**/
public abstract void setGuarantors( Collection pGuarantors );
//
-------------------------------------------------------------------------
// DTO Methods
//
-------------------------------------------------------------------------
/**
* Manage the CreditApplication's DTO/Form object
*
* @ejb.interface-method
**/
public abstract com.wf.bd.ice.creditapplication.CreditApplicationDto
getCreditApplicationDto();
/**
* Manage the CreditApplication's DTO/Form object
*
* @ejb.interface-method
**/
public abstract void setCreditApplicationDto(
com.wf.bd.ice.creditapplication.CreditApplicationDto pCreditApplicationDto
);
//
-------------------------------------------------------------------------
// Framework Callbacks
//
-------------------------------------------------------------------------
/**
* Create a TestEntity based on the supplied TestEntity Value Object.
*
* @param pCreditApplicationDto The name used to create the
CreditApplication.
*
* @throws javax.ejb.EJBException If no new unique ID could be retrieved
this will
* rollback the transaction because there is no
* hope to try again
* @throws javax.ejb.CreateException Because we have to do so (EJB
spec.)
*
* @ejb.interface-method view-type="local"
* @ejb.create-method view-type="local"
**/
public java.lang.Long ejbCreate(
com.wf.bd.ice.creditapplication.CreditApplicationDto pCreditApplicationDto )
throws javax.ejb.EJBException, javax.ejb.CreateException {
try {
if( log.isInfoEnabled() ) {
log.info( "=============================================" );
log.info( "ejbCreate(
com.wf.bd.ice.creditapplication.CreditApplicationDto pCreditApplicationDto
)" );
log.info( "pGuarantorDto: " +
pCreditApplicationDto.toString() );
}
SequenceManagerHome sequenceManagerHome =
SequenceManagerUtil.getHome();
SequenceManager sequenceManager = sequenceManagerHome.create();
setApplicationId( pCreditApplicationDto.getPrimaryKey() );
//setApplicationId( sequenceManager.getNextNumber(
pCreditApplicationDto.getClass().getName() ) );
if( log.isInfoEnabled() ) {
log.info( "setApplicationId(
pCreditApplicationDto.getPrimaryKey() );" );
log.info( "getApplicationId: " + getApplicationId() );
log.info( "=============================================" );
}
}
catch( Exception e ) {
System.err.println( e.getMessage() );
}
return null;
}
/**
* String Value of this CreditApplication Entity
*
* @ejb.interface-method
*
**/
public String toString() {
try {
return ( getCreditApplicationDto().toString() );
}
catch( Exception e ) {
return "";
}
}
//
-------------------------------------------------------------------------
// EJB Callbacks
//
-------------------------------------------------------------------------
/**
* EJB Post Create method
* @param pCreditApplicationDto
* @throws javax.ejb.EJBException
* @throws javax.ejb.CreateException
*/
public void ejbPostCreate(
com.wf.bd.ice.creditapplication.CreditApplicationDto pCreditApplicationDto )
throws javax.ejb.EJBException, javax.ejb.CreateException {
/*
Update the EJB as the CMR information cannot be set at create time:
java.lang.IllegalStateException: A CMR field cannot be set in
ejbCreate;
this should be done in the ejbPostCreate method instead [EJB 2.0
Spec. 10.5.2].
*/
if( log.isInfoEnabled() ) {
log.info( "=============================================" );
log.info( "ejbPostCreate(
com.wf.bd.ice.creditapplication.CreditApplicationDto pCreditApplicationDto
)" );
log.info( "pCreditApplicationDto: " +
pCreditApplicationDto.toString() );
}
setCreditApplicationDto( pCreditApplicationDto );
if( log.isInfoEnabled() ) {
//log.info( "getCreditApplicationDto().toString(): " +
getCreditApplicationDto().toString() );
log.info( "=============================================" );
}
}
public void setEntityContext( javax.ejb.EntityContext lContext ) {
myEntityCtx = lContext;
}
public void unsetEntityContext() {
myEntityCtx = null;
}
public void ejbActivate() {
}
public void ejbPassivate() {
}
public void ejbLoad() {
}
public void ejbStore() {
}
public void ejbRemove()
throws javax.ejb.RemoveException {
}
} //The End...
BusinessCardBean.java:
****************************************************************************
****************************************************************************
*******************************
package com.wf.bd.ice.product;
import java.util.Collection;
import com.wf.bd.ice.account.BankAccountLocal;
import com.wf.bd.ice.account.BankAccountDto;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
* The Entity bean represents a BusinessCard Entity
*
* @author Eileen Smith
*
* @ejb.bean
* name="BusinessCard"
* display-name="BusinessCard Entity for ICE"
* cmp-version="2.x"
* type="CMP"
* view-type="local"
* local-jndi-name="local/com.wf.bd.ice.product.BusinessCardLocal"
* primkey-field="productPK"
* schema="BusinessCard"
*
* @ejb.pk
* class="java.lang.String"
*
* @ejb.value-object
* name="BusinessCard"
* implements="com.wf.bd.ice.product.ICardProductDto"
*
* @struts.form
* name="Action"
* extends="org.apache.struts.validator.ValidatorForm"
* include-pk="true"
* include-all="true"
*
* @ejb.util
* generate="physical"
*
* @ejb.transaction
* type="Required"
*
* @ejb.transaction-type
* type="Container"
*
* @ejb.permission
* unchecked="true"
*
* @weblogic.data-source-name ${weblogic.datasource}
*
* @ejb.persistence
* table-name="T_ICE_APPLICATIONPRODUCT"
**/
public abstract class BusinessCardBean implements javax.ejb.EntityBean
{
/** Our own Session Context. */
private javax.ejb.EntityContext myEntityCtx;
/** The <code>Log</code> instance for this application. */
private Log log = LogFactory.getLog( this.getClass() );
//
-------------------------------------------------------------------------
// Properties (Getters/Setters)
//
-------------------------------------------------------------------------
/**
* Retrieve the BusinessCard's businessCardPK for use as a primaryKey.
*
* @ejb.pk-field
* @ejb.interface-method
* @ejb.persistence column-name="productPK"
**/
public abstract java.lang.String getProductPK();
/**
* No interface method for setBusinessCardPK(..). See page 130 of the
EJB 2.0 specification:
* "Once the primary key for an entity bean has been set, the Bean
Provider must
* not attempt to change it by use of set accessor methods on the
primary key
* cmp-fields. The Bean provider should therefore not expose the set
accessor
* methods for the primary key cmp-fields in the component interface of
the
* entity bean.". A work around would be to remove and then an re-create
the bean.
*/
public abstract void setProductPK( java.lang.String pProductPK );
/**
* Manage the BusinessCard's applicationId
*
* @ejb.interface-method
* @ejb.persistence column-name="applicationId"
**/
public abstract java.lang.Long getApplicationId();
public abstract void setApplicationId( java.lang.Long pApplicationId );
/**
* Manage the BusinessCard's productType
*
* @ejb.interface-method
* @ejb.persistence column-name="productType"
*
**/
public abstract java.lang.String getProductType();
/**
* Manage the BusinessCard's productType
*
* @ejb.persistence column-name="productType"
*
**/
public abstract void setProductType( java.lang.String pCroductType );
/**
* Manage the BusinessCard's cardBrand
*
* @ejb.interface-method
* @ejb.persistence column-name="cardBrand"
*
**/
public abstract java.lang.String getCardBrand();
public abstract void setCardBrand( java.lang.String pCardBrand );
/**
* Manage the BusinessCard's productCode
*
* @ejb.interface-method
* @ejb.persistence column-name="productCode"
*
**/
public abstract java.lang.String getProductCode();
/**
* Manage the BusinessCard's productCode
*
* @ejb.persistence column-name="productCode"
*
**/
public abstract void setProductCode( java.lang.String pProductCode );
/**
* Manage the BusinessCard's piCode
*
* @ejb.interface-method
* @ejb.persistence column-name="piCode"
**/
public abstract java.lang.String getPiCode();
/**
* Manage the BusinessCard's piCode
*
* @ejb.persistence column-name="piCode"
**/
public abstract void setPiCode( java.lang.String pPiCode );
/**
* Manage the BusinessCard's couponCode
*
* @ejb.interface-method
* @ejb.persistence column-name="couponCode"
**/
public abstract java.lang.String getCouponCode();
public abstract void setCouponCode( java.lang.String pCouponCode );
/**
* Manage the BusinessCard's requestAmount
*
* @ejb.interface-method
* @ejb.persistence column-name="requestAmount"
**/
public abstract long getRequestAmount();
public abstract void setRequestAmount( long pRequestAmount );
/**
* Manage the BusinessCard's businessName
*
* @ejb.interface-method
* @ejb.persistence column-name="businessName"
**/
public abstract java.lang.String getBusinessName();
public abstract void setBusinessName( java.lang.String pBusinessName );
/**
* Manage the BusinessCard's automaticPayment
*
* @ejb.interface-method
* @ejb.persistence column-name="automaticPayment"
**/
public abstract java.lang.String getAutomaticPayment();
public abstract void setAutomaticPayment( java.lang.String
pAutomaticPayment );
/**
* Manage the BusinessCard's automaticPayment
*
* @ejb.interface-method
* @ejb.persistence column-name="automaticPaymentAccountFK"
**/
public abstract java.lang.String getAutomaticPaymentAccountFK();
public abstract void setAutomaticPaymentAccountFK( java.lang.String
pAutomaticPaymentAccountFK );
/**
* Manage the BusinessCard's electronicTransfer
*
* @ejb.interface-method
* @ejb.persistence column-name="electronicTransfer"
**/
public abstract java.lang.String getElectronicTransfer();
public abstract void setElectronicTransfer( java.lang.String
pElectronicTransfer );
/**
* Manage the BusinessCard's electronicTransfer
*
* @ejb.interface-method
* @ejb.persistence column-name="electronicTransferAccountFK"
**/
public abstract java.lang.String getElectronicTransferAccountFK();
public abstract void setElectronicTransferAccountFK( java.lang.String
pElectronicTransferAccountFK );
/**
* Manage the BusinessCard's creditProtection
*
* @ejb.interface-method
* @ejb.persistence column-name="creditProtection"
**/
public abstract java.lang.String getCreditProtection();
public abstract void setCreditProtection( java.lang.String
pCreditProtection );
/**
* Manage the BusinessCard's overdraftProtection
*
* @ejb.interface-method
* @ejb.persistence column-name="overdraftProtection"
**/
public abstract java.lang.String getOverdraftProtection();
public abstract void setOverdraftProtection( java.lang.String
pOverdraftProtection );
/**
* Manage the BusinessCard's overdraftProtection
*
* @ejb.interface-method
* @ejb.persistence column-name="overdraftProtectionAccountFK"
**/
public abstract java.lang.String getOverdraftProtectionAccountFK();
public abstract void setOverdraftProtectionAccountFK( java.lang.String
pOverdraftProtectionAccountFK );
/**
* Manage the BusinessCard's lineIncrease
*
* @ejb.interface-method
* @ejb.persistence column-name="lineIncrease"
**/
public abstract java.lang.String getLineIncrease();
public abstract void setLineIncrease( java.lang.String pLineIncrease );
/**
* Manage the BusinessCard's businessMiles
*
* @ejb.interface-method
* @ejb.persistence column-name="businessMiles"
**/
public abstract java.lang.String getBusinessMiles();
public abstract void setBusinessMiles( java.lang.String pBusinessMiles
);
//
-------------------------------------------------------------------------
// DTO Methods
//
-------------------------------------------------------------------------
/**
* Manage the BusinessCard's DTO/Form object
*
* @ejb.interface-method
* @ejb.transaction
* type="Supports"
**/
public abstract com.wf.bd.ice.product.BusinessCardDto
getBusinessCardDto();
/**
* Manage the BusinessCard's DTO/Form object
*
* @ejb.interface-method
* @ejb.transaction
* type="Supports"
**/
public abstract void setBusinessCardDto(
com.wf.bd.ice.product.BusinessCardDto pBusinessCardDto );
/**
* Manage the BankAccount's DTO/Form object
*
* This method needs to be implemented because Product EJB's use it
to access
* the BankAccountDto object for the AutomaticPaymentAccount
object.
*
* @ --ejb.interface-method
**/
//public abstract BankAccountDto getAutomaticPaymentAccountDto();
/**
* @ --ejb.interface-method
**/
//public abstract void setAutomaticPaymentAccountDto( BankAccountDto
pBankAccountDto );
//
-------------------------------------------------------------------------
// Relationship Methods
//
-------------------------------------------------------------------------
/**
* This is a one (BusinessCard) to one (BankAccount) relationship.
* We can get a BankerDto in the
BusinessCardDto.getAutomaticPaymentAccount() method.
* We can also setAutomaticPaymentAccount( pBankAccount )
*
* @ejb.interface-method
* view-type="local"
*
* @ejb.value-object
* compose="com.wf.bd.ice.account.AutomaticPaymentAccountDto"
* compose-name="AutomaticPaymentAccountDto"
* members="com.wf.bd.ice.account.BankAccountLocal"
* members-name="AutomaticPaymentAccount"
* relation="external"
*
* @ejb.relation
* name="BusinessCard-AutomaticPaymentBankAccount"
* role-name="BusinessCard-has-AutomaticPaymentAccount"
* target-ejb="BankAccount"
*
target-role-name="AutomaticPaymentAccount-belongs_to-BusinessCard"
* target-cascade-delete="yes"
*
* @weblogic.column-map
* foreign-key-column="automaticPaymentAccountFK"
* key-column="bankAccountPK"
**/
public abstract com.wf.bd.ice.account.BankAccountLocal
getAutomaticPaymentAccount();
public abstract void setAutomaticPaymentAccount(
com.wf.bd.ice.account.BankAccountLocal pAutomaticPaymentAccount );
/**
* This is a one (BusinessCard) to one (BankAccount) relationship.
* We can get a ElectronicTransferAccountDto in the
ElectronicTransferAccountDto.getElectronicTransferAccount() method.
* We can also setElectronicTransferAccount(
pElectronicTransferAccount )
*
* @ejb.interface-method
* view-type="local"
*
* @ejb.value-object
* compose="com.wf.bd.ice.account.ElectronicTransferAccountDto"
* compose-name="ElectronicTransferAccountDto"
* members="com.wf.bd.ice.account.BankAccountLocal"
* members-name="ElectronicTransferAccount"
* relation="external"
*
* @ejb.relation
* name="BusinessCard-ElectronicTransferAccount"
* role-name="BusinessCard-has-ElectronicTransferAccount"
* target-ejb="BankAccount"
*
target-role-name="ElectronicTransferAccount-belongs_to-BusinessCard"
* target-cascade-delete="yes"
*
* @weblogic.column-map
* foreign-key-column="electronicTransferAccountFK"
* key-column="bankAccountPK"
**/
public abstract com.wf.bd.ice.account.BankAccountLocal
getElectronicTransferAccount();
public abstract void setElectronicTransferAccount(
com.wf.bd.ice.account.BankAccountLocal pElectronicTransferAccount );
/**
* This is a one (BusinessCard) to one (BankAccount) relationship.
* We can get a BankerDto in the
BusinessCardDto.getOverdraftProtectionAccount() method.
* We can also setOverdraftProtectionAccount( pBankAccount )
*
* @ejb.interface-method
* view-type="local"
*
* @ejb.value-object
* compose="com.wf.bd.ice.account.OverdraftProtectionAccountDto"
* compose-name="OverdraftProtectionAccountDto"
* members="com.wf.bd.ice.account.BankAccountLocal"
* members-name="OverdraftProtectionAccount"
* relation="external"
*
* @ejb.relation
* name="BusinessCard-OverdraftProtectionAccount"
* role-name="BusinessCard-has-OverdraftProtectionAccount"
* target-ejb="BankAccount"
*
target-role-name="OverdraftProtectionAccount-belongs_to-BusinessCard"
* target-cascade-delete="yes"
*
* @weblogic.column-map
* foreign-key-column="overdraftProtectionAccountFK"
* key-column="bankAccountPK"
**/
public abstract com.wf.bd.ice.account.BankAccountLocal
getOverdraftProtectionAccount();
public abstract void setOverdraftProtectionAccount(
com.wf.bd.ice.account.BankAccountLocal pOverdraftProtectionAccount );
/**
* Get all Card's for this BusinessCard.
* This is a one (BusinessCard) to many (Cards) relationship.
* We can get a Collection of CardDto's in the
* BusinessCardDto.getCards() method.
* We can also setCards( pCards )
*
* @ --ejb.interface-method
* view-type="local"
*
* @ --ejb.relation
* name="BusinessCard-Card"
* role-name="BusinessCard-has-Cards"
* target-ejb="Card"
* target-role-name="Card-belongs_to-BusinessCard"
* target-cascade-delete="yes"
*
* @ --weblogic.target-column-map
* foreign-key-column="cardPK"
* key-column="productPK"
*
* @ --ejb.value-object
* compose="com.wf.bd.ice.card.CardDto"
* compose-name="CardDto"
* members="com.wf.bd.ice.card.CardLocal"
* members-name="Card"
* relation="external"
* type="java.util.Collection"
*
**/
//public abstract Collection getCards();
//public abstract void setCards( Collection pCards );
//
-------------------------------------------------------------------------
// Framework Callbacks
//
-------------------------------------------------------------------------
/**
* Create a TestEntity based on the supplied TestEntity Value Object.
*
* @param pBusinessCardDto The name used to create the BusinessCard.
*
* @throws javax.ejb.EJBException If no new unique ID could be retrieved
this will
* rollback the transaction because there is no
* hope to try again
* @throws javax.ejb.CreateException Because we have to do so (EJB
spec.)
*
* @ejb.interface-method view-type="local"
* @ejb.create-method view-type="local"
**/
public java.lang.String ejbCreate( com.wf.bd.ice.product.BusinessCardDto
pBusinessCardDto )
throws javax.ejb.EJBException, javax.ejb.CreateException
{
if( log.isInfoEnabled() ) {
log.info( "=============================================" );
log.info( "ejbCreate( com.wf.bd.ice.product.pBusinessCardDto
pBusinessCardDto )" );
log.info( "pBusinessCardDto: " + pBusinessCardDto.toString() );
}
setProductPK( BusinessCardUtil.generateGUID(pBusinessCardDto) );
if( log.isInfoEnabled() ) {
log.info( "setProductPK(
BusinessCardUtil.generateGUID(pBusinessCardDto) )" );
log.info( "getBusinessCard PK: " + getProductPK() );
log.info( "=============================================" );
}
return null;
}
/**
* java.lang.String Value of this CreditApplication Entity
*
* @ejb.interface-method
*
**/
public java.lang.String toString()
{
try
{
return ( getBusinessCardDto().toString() );
}
catch( Exception e )
{
return "";
}
}
//
-------------------------------------------------------------------------
// EJB Callbacks
//
-------------------------------------------------------------------------
/**
* EJB Post Create method
* @param pBusinessCardDto
* @throws javax.ejb.EJBException
* @throws javax.ejb.CreateException
*
*/
public void ejbPostCreate( com.wf.bd.ice.product.BusinessCardDto
pBusinessCardDto )
throws javax.ejb.EJBException, javax.ejb.CreateException
{
/*
Update the EJB as the CMR information cannot be set at create time:
java.lang.IllegalStateException: A CMR field cannot be set in
ejbCreate;
this should be done in the ejbPostCreate method instead [EJB 2.0
Spec. 10.5.2].
*/
if( log.isInfoEnabled() ) {
log.info( "=============================================" );
log.info( "ejbPostCreate( com.wf.bd.ice.product.BusinessCardDto
pBusinessCardDto )" );
log.info( "pBusinessCardDto: " + pBusinessCardDto.toString() );
}
setBusinessCardDto( pBusinessCardDto );
setProductType( "BUS_CARD" );
if( log.isInfoEnabled() ) {
log.info( "getBusinessCardDto().toString(): " +
getBusinessCardDto().toString() );
log.info( "=============================================" );
}
}
public void setEntityContext( javax.ejb.EntityContext lContext )
{
myEntityCtx = lContext;
}
public void unsetEntityContext()
{
myEntityCtx = null;
}
public void ejbActivate()
{
}
public void ejbPassivate()
{
}
public void ejbLoad()
{
}
public void ejbStore()
{
}
public void ejbRemove()
throws javax.ejb.RemoveException
{
}
} //The End...
-------------------------------------------------------
This SF.Net email is sponsored by: GNOME Foundation
Hackers Unite! GUADEC: The world's #1 Open Source Desktop Event.
GNOME Users and Developers European Conference, 28-30th June in Norway
http://2004/guadec.org
_______________________________________________
xdoclet-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-user