Hi!

"Nortje, Andrew" wrote:
> What I do is I create an account if the account does not exist, for the
> given entity at a given institution. home.create() (insert into the
> database) creates a new account. All OK so far.
> 
> As can seen from the debug output a new account_id = 26 is created. Also
> ejbCreate() creates and returns a new PK with id =26 (Also in debug output).
> I then call account.getID() on the newly created account returned by
> home.create() and get id=0, and not id=26.
> 
> As can be seen from the debug output there is no ejbLoad() to be seen (I
> definitely have debug statement in ejbLoad() method). jBoss should create a
> new instance of the account bean first( ejbLoad() ) before doing the remote
> method call getID() on the newly created instance.

Nope, it should not. After ejbCreate/ejbPostCreate has been called on an
instance that instance is considered activated and synched with the DB
state, so no ejbLoad is necessary. If you check the EJB spec you will
see this in the state transition diagrams.

/Rickard

> I do have the following as well beans:
> Account (remote )
> AccountBean
> AccountHome
> ExternalAccount extends Account
> ExternalAccountBean extends AccountBean
> ExternalAccountHome does NOT extend AccountHome (methods need to return
> ExternalAccount not Account)
> AccountPK same for both types of accounts.
> 
> The getID() mehtod is only defined int Account, and AccountBean.
> 
> Any ideas folks.
> 
> [Account] New AccountBean
> [Account] ejbFind( long entityID, long financialInstitutionID  Account
> [Account] SQL:  Select * from Account where ENTITY_ID=0 AND
> FINAN_INSTIT_ID=1
> [Account] Did not find accounts. Creating...
> [ExternalAccount] New AccountBean
> [ExternalAccount] New AccountBean
> [ExternalAccount] ejbCreate(long, long) ExternalAccountBean
> [Person] ejbFindByPrimaryKey() called
> com.uni.entity.myaccount.PersonBean@587b85
> [Person] SQL: Select * from ENTITY where ENTITY_ID = 0
> [ExternalAccount] SQL:  Insert into Account (ACCOUNT_ID, ENTITY_ID,
> FINAN_INSTIT_ID, EXTERNAL_ACCOUNT_NUMBER, BALANCE )  values ( 26, 0, 1, '',
> 0 )
> [ExternalAccount] New AccountPK( accountID ) 26
> [ExternalAccount] ejbPostCreate( long entityID, long FinancialInstitutionID
> ) called 0, 1
> [Account] Create for account 0
> [Account] Create at institut 1
> [ExternalAccount] ################################# This account id is 0
> com.uni.account.ExternalAccountBean@622f2b
> [Account] ######################################33####33new account 0
> [ExternalAccount] ################################# This account id is 0
> com.uni.account.ExternalAccountBean@622f2b
> [Account] Transaction findInstitutionID() called
> [Account] SQL: Select FINAN_INSTIT_ID from ACCOUNT where  ACCOUNT_ID = 31
> [Account] TransactionFee find() called
> 
> --
> --------------------------------------------------------------
> To subscribe:        [EMAIL PROTECTED]
> To unsubscribe:      [EMAIL PROTECTED]
> List Help?:          [EMAIL PROTECTED]




--
--------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
List Help?:          [EMAIL PROTECTED]

Reply via email to