Is this kludgy? Yes, but you don't have to worry about it ever not working
unless the EJB spec changes. The EJB Spec requires that all entities of the
same type of a finder get synchronized with the database before the finder
executes. (See section 9.6.4).
Add the "finder" workaround to the comments section of the bug you
submitted.
IMHO, this is not the best long term solution. I think "flush" should be
added as a jboss method, but that's just my opinion. I'm pretty new to
JBoss myself and I'm waiting for some others to chime in their advice. I'll
repost this question later if I get no responses.
Bill
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]On Behalf Of David
> Esposito
> Sent: Monday, June 18, 2001 1:16 PM
> To: [EMAIL PROTECTED]
> Subject: RE: [JBoss-dev] ejbStore() delay seems to be a serious problem
>
>
> My fault ... I forgot to copy the client lib directory over from the build
> directory ...
>
> Ok, so that seems to be a workaround ... Here's what I did:
>
> Changed my setRecord in my EntityBean to do something like this:
>
> public void setRecord(CreditCardRecord rec)
> {
> this.member_company_id = rec.member_company_id;
> this.cardholder_name = rec.cardholder_name;
> this.billing_address_id = rec.billing_address_id;
>
> //Force the changes out to the DB immediately
> try{flush();}
> catch(Exception e){throw new EJBException("Unable to write
> bean's contents
> to persistent storage!" + e);}
>
> }
>
> Then I implemented a flush() and getID() method in my EntityBean:
>
> public void flush() throws RemoteException, FinderException
> {
> ((CreditCardHome)context.getEJBHome()).findByPrimaryKey(getID());
> }
>
> public Integer getID(){return this.credit_card_id;}
>
> It seems to have worked ... I ran several tests and it looks like the
> Container triggers the ejbStore() when it encounters the
> findByXXX call ...
>
> Is this a good long-term solution? It seems a little kludgy ...
>
> If this is the final solution, would you like for me to document it?
>
> -Dave
>
> > -----Original Message-----
> > From: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED]]On Behalf Of David
> > Esposito
> > Sent: Monday, June 18, 2001 12:40 PM
> > To: [EMAIL PROTECTED]
> > Subject: RE: [JBoss-dev] ejbStore() delay seems to be a serious problem
> >
> >
> > >
> > > Doesn't work??!! Are you sure you have the latest JBoss from
> > > source? I put
> > > this "ejbStore on ejbFind" in last week . Anyways, don't
> > forget, ejbStore
> > > will ONLY be called on entities of the same type of the finder
> > > and that are
> > > within the same transaction.
> >
> > Sorry 'bout that ... I hadn't downloaded the latest source ...
> I just did
> > that, compiled it, and now i'm getting this for ALL of my beans ...
> >
> > [Member] [com.blah.ejb.member.MemberPK@d0] getRecord()
> > [Member] TRANSACTION ROLLBACK EXCEPTION:null; nested exception is:
> > java.lang.NoSuchMethodError
> > [Member] java.lang.NoSuchMethodError
> > [Member] at
> > org.jboss.ejb.plugins.EntityInstanceCache.setKey(EntityInstanceCac
> > he.java:95
> > )
> > [Member] at
> > org.jboss.ejb.plugins.AbstractInstanceCache.get(AbstractInstanceCa
> > che.java:1
> > 66)
> > [Member] at
> >
> org.jboss.ejb.plugins.EntityInstanceCache.get(EntityInstanceCache.java:60)
> > [Member] at
> > org.jboss.ejb.plugins.EntityInstanceInterceptor.invoke(EntityInsta
> > nceInterce
> > ptor.java:148)
> > [Member] at
> > org.jboss.ejb.plugins.TxInterceptorCMT.invokeNext(TxInterceptorCMT
> > .java:133)
> > [Member] at
> > org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInter
> > ceptorCMT.
> > java:298)
> > [Member] at
> > org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:99)
> > [Member] at
> > org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityIntercept
> > or.java:12
> > 7)
> > [Member] at
> > org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:195)
> > [Member] at
> > org.jboss.ejb.EntityContainer.invoke(EntityContainer.java:349)
> > [Member] at
> > org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker.invoke(JRMP
> > ContainerI
> > nvoker.java:390)
> > [Member] at
> > org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker.invoke(JRMP
> > ContainerI
> > nvoker.java:467)
> > [Member] at
> > org.jboss.ejb.plugins.jrmp.interfaces.GenericProxy.invokeContainer
> > (GenericPr
> > oxy.java:335)
> > [Member] at
> > org.jboss.ejb.plugins.jrmp.interfaces.EntityProxy.invoke(EntityPro
> > xy.java:13
> > 3)
> > [Member] at $Proxy75.getRecord(Unknown Source)
> > [Member] at
> >
> com.blah.servlets.UserHomeServlet.serviceRequest(UserHomeServlet.java:139)
> >
> > What's going on here? Am I missing some libs (JARs) somewhere?
> >
> >
> > >
> > > Shouldn't be that hard to do, just a question whether or not
> > its something
> > > Mr. Fleury wants within JBoss. Personnally, I think something
> > like flush
> > > should be added. Or maybe a better name ejbFlush or
> > jbossFlush. I may be
> > > able to implement it if I can find the time this week and we
> > can patch it,
> > > BUT...We're coming up against a launch date as well!!!
> > >
> >
> > Mr. Fleury, pretty please with sugar on top, can we have a flush
> > feature ...
> > pleeeeeez ... ;)
> >
> > >
> > > > Should I add this to the "bug database" (even though it's not
> > a bug, per
> > > > say) ?...
> > > >
> > >
> > > Personally I think it is a bug. It can cause some nasty problems,
> > > especially with your CASCADE DELETE scenario! Imagine hitting that in
> > > production??!!
> >
> > Ok, I just added it ..
> >
> > -Dave
> >
> >
> > _______________________________________________
> > Jboss-development mailing list
> > [EMAIL PROTECTED]
> > http://lists.sourceforge.net/lists/listinfo/jboss-development
>
>
> _______________________________________________
> Jboss-development mailing list
> [EMAIL PROTECTED]
> http://lists.sourceforge.net/lists/listinfo/jboss-development
>
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-development