Re: Entity bean can not remove itself

2006-07-17 Thread mahu2425
Hi David,

I already filed a jira for this. The id is: GERONIMO-2166

The crash of the server occurs when calling remove(). Calling ejbRemove() ha no 
effect (see jira).

BTW, is there a ways to reanimate the server if it starts up saying GBean 
destroyed. In addition I think it's not possible to remove of ghost timer, 
isn't it?

Best regards,

Markus


 I haven't studied the specs on this yet.
 
 Sun's example clearly shows the entity bean calling ejbRemove() from  
 a business method in the entity bean itself.  I would definitely  
 expect this to have undefined behavior since it is a lifecycle method  
 intended to be called from remove on one of the interfaces.  However,  
 I haven't looked for a definitive statement in the spec yet, and I  
 suspect there isn't one.
 
 I would expect that calling remove on the appropriate interface,  
 after marking the entity bean reentrant, should work.  It's not clear  
 to me if you have tried this yet, could you clarify?
 
 In any case crashing the server as a result of calling ejbRemove()  
 directly seems to me to be a bug.  Could you file a jira for this  
 with as many details as possible?
 
 many thanks,
 david jencks

Schnell und einfach ohne Anschlusswechsel zur Lycos DSL Flatrate wechseln und 3 
Monate kostenlos ab effektiven 5,21 EUR pro Monat im ersten Jahr surfen.
http://www.lycos.de/startseite/online/dsl/index.html?prod=DSLtrackingID=email_footertxt

AW: Entity bean can not remove itself

2006-07-12 Thread Ueberbach, Michael
Hello Markus,

following the spec ejbRemove will be called by the container if the client 
wants to remove the entity (normally by calling the remove method on the 
interface of the entity bean). In case of BMP one has to code the database 
access (deleting the corresponding row) inside the ejbRemove method. So calling 
the ejbRemove from another method of the bean itself should remove the entity 
(including its persistence) in this case. It would be strange if in case of CMP 
the effect would not be the same.

regards,
Michael


-Ursprüngliche Nachricht-
Von: mahu2425 [mailto:[EMAIL PROTECTED]
Gesendet: Mittwoch, 12. Juli 2006 07:36
An: user@geronimo.apache.org
Betreff: Re: Entity bean can not remove itself


Hello Dain,

I couldn't find it in the specs either, but I think it makes sense, that an 
entity bean can remove itself.

An example, that an entity bean can remove itself is also given at Sun's J2EE 
tutorial:
http://java.sun.com/j2ee/1.4/docs/tutorial/doc/JMSJ2EEex3.html


I my opinion this feature should be added in the next version of Geronimo. I 
also found a few posts in the internet, that this problem occured on several 
other J2EE server and has been fixed there.


Best regards,

Markus

Benachrichtigung bei E-Mail Empfang! - 
http://mail.lycos.de/app/lycosinside/setupLI.exe


Re: Entity bean can not remove itself

2006-07-12 Thread David Jencks

I haven't studied the specs on this yet.

Sun's example clearly shows the entity bean calling ejbRemove() from  
a business method in the entity bean itself.  I would definitely  
expect this to have undefined behavior since it is a lifecycle method  
intended to be called from remove on one of the interfaces.  However,  
I haven't looked for a definitive statement in the spec yet, and I  
suspect there isn't one.


I would expect that calling remove on the appropriate interface,  
after marking the entity bean reentrant, should work.  It's not clear  
to me if you have tried this yet, could you clarify?


In any case crashing the server as a result of calling ejbRemove()  
directly seems to me to be a bug.  Could you file a jira for this  
with as many details as possible?


many thanks,
david jencks

On Jul 12, 2006, at 5:35 AM, mahu2425 wrote:


Hello Dain,

I couldn't find it in the specs either, but I think it makes sense,  
that an entity bean can remove itself.


An example, that an entity bean can remove itself is also given at  
Sun's J2EE tutorial:

http://java.sun.com/j2ee/1.4/docs/tutorial/doc/JMSJ2EEex3.html


I my opinion this feature should be added in the next version of  
Geronimo. I also found a few posts in the internet, that this  
problem occured on several other J2EE server and has been fixed there.



Best regards,

Markus

Benachrichtigung bei E-Mail Empfang! - http://mail.lycos.de/app/ 
lycosinside/setupLI.exe




Re: Entity bean can not remove itself

2006-07-11 Thread Dain Sundstrom
It has been a long time since I looked at this stuff, but I'm not  
sure an entity can remove itself.  The one thing I know for certain,  
is that calling the ejbRemove remove method has not effect on the  
entity state.  The ejbRemove method is a callback invoked by the  
entity container when the entity container has decided to remove the  
entity.  If you call this method directly, the entity container does  
not see this.


After reviewing the 2.1 spec, I can't see any where that specifies  
that entity can remove itself.  Every remove example, has another  
bean removing the target bean.  At the very least, I'd start by  
marking the entity as reentrant since a remove is conceivably  
reentrancy.  Then I'd try, entityContext.getEJB[Local]Object().remove()


-dain

On Jul 10, 2006, at 10:56 PM, D. Strauss wrote:


Hello, Markus

try this:

Way a (the Collection way):
java.util.CollectionEjbLocal c=ejbHome.findAll();
EjbLocal delBean=null;
for(EjbLocal l : c){
//find the bean you want to remove: for now, find the last one
delBean=l;
}
c.remove(delBean);

Way b (the usual way):
EjbLocal delBean=ejbHome.findByPrimaryKey(12);
delBean.remove();

Best regards

Dirk

mahu2425 schrieb:

Hello Dirk,

I'm not sure what you mean by collection version of ejbRemove().

Could you please explain it a little bit more?


Thank in advance,

Markus





Hello, Markus

now I get it ^^ (at least I think so)

So, to summarize it: you work with a CMP bean that is used by  
various
other beans (JMS in particular). After all things have been done  
I want

to remove the bean?

Using ejbRemove() is OK but you may want to use the Collection  
version
of ejbRemove. I think (if I remember correctly) that ejbRemove()  
always

crashed the EJB container. So I used the collection method. It is a
little bit difficult but it worked.

Give it a try and tell us if it works.

Best regards

Dirk


Schnell und einfach ohne Anschlusswechsel zur Lycos DSL Flatrate  
wechseln und 3 Monate kostenlos ab effektiven 5,21 EUR pro Monat  
im ersten Jahr surfen.
http://www.lycos.de/startseite/online/dsl/index.html? 
prod=DSLtrackingID=email_footertxt




Re: Entity bean can not remove itself

2006-07-10 Thread D. Strauss
Hello, Markus

try this:

Way a (the Collection way):
java.util.CollectionEjbLocal c=ejbHome.findAll();
EjbLocal delBean=null;
for(EjbLocal l : c){
//find the bean you want to remove: for now, find the last one
delBean=l;
}
c.remove(delBean);

Way b (the usual way):
EjbLocal delBean=ejbHome.findByPrimaryKey(12);
delBean.remove();

Best regards

Dirk

mahu2425 schrieb:
 Hello Dirk,
 
 I'm not sure what you mean by collection version of ejbRemove().
 
 Could you please explain it a little bit more?
 
 
 Thank in advance,
 
 Markus
 
 
 
 
 Hello, Markus

 now I get it ^^ (at least I think so)

 So, to summarize it: you work with a CMP bean that is used by various
 other beans (JMS in particular). After all things have been done I want
 to remove the bean?

 Using ejbRemove() is OK but you may want to use the Collection version
 of ejbRemove. I think (if I remember correctly) that ejbRemove() always
 crashed the EJB container. So I used the collection method. It is a
 little bit difficult but it worked.

 Give it a try and tell us if it works.

 Best regards

 Dirk
 
 Schnell und einfach ohne Anschlusswechsel zur Lycos DSL Flatrate wechseln und 
 3 Monate kostenlos ab effektiven 5,21 EUR pro Monat im ersten Jahr surfen.
 http://www.lycos.de/startseite/online/dsl/index.html?prod=DSLtrackingID=email_footertxt


Re: Entity bean can not remove itself

2006-07-06 Thread D. Strauss
Hello, Markus

now I get it ^^ (at least I think so)

So, to summarize it: you work with a CMP bean that is used by various
other beans (JMS in particular). After all things have been done I want
to remove the bean?

Using ejbRemove() is OK but you may want to use the Collection version
of ejbRemove. I think (if I remember correctly) that ejbRemove() always
crashed the EJB container. So I used the collection method. It is a
little bit difficult but it worked.

Give it a try and tell us if it works.

Best regards

Dirk

mahu2425 schrieb:
 Hello Dirk,
 
 in my scenario the entity bean stores some data from an ERP system. The data 
 is required for a number of steps (function calls, data for message driven 
 beans, etc.).
 
 After all (concurrent) tasks have been completed, the entity bean is no 
 longer required and can remove itself.
 
 The scenario is a little bit compareable to the one in Sun's J2EE tutorial:
 http://java.sun.com/j2ee/1.4/docs/tutorial/doc/JMSJ2EEex3.html
 
 So, what I need is just a ways to remove an entity bean. The special problem 
 here is that the entity bean needs to call it's own remove method.
 
 As I said in my first posting, I would prefer to call the remove() method 
 from the entity bean's remote interface instead of calling ejbRemove(), but 
 calling remove() seems to crash the server (the remove is done during a Timer 
 callback). It seems that Geronimo is struggeling between removing the bean 
 and completing the timer transaction (in fact is trys to roll it back). If 
 you try to restart the server after the crash you'll always get an exception 
 that a GBean has been destroyed. I never managed to get the server back to 
 work in this case (had to start with a new installation).
 
 So, I think there should be a possibility that an entity bean can remove 
 itself. It could be discussed whether is should call remove() or ejbRemove(). 
 Sun seems to prefer ejbRemove().
 
 
 Best regards,
 
 Markus
 
 
 
  Hello, Markus
  
  It's just a little bit difficult to understand why you (the user) should
  handle the instance of a bean :-/ That's the job of the EJB container
  (greetings to the OpenEJB people). Or can you post a scenario where you
  definitely need to remove an EJB? Share your idea :P
  
  AFAIK it's not your business to know too much of the EJB container and
  its EJB instances :P
  
  Best regards
  
  Dirk
 
 Benachrichtigung bei E-Mail Empfang! - 
 http://mail.lycos.de/app/lycosinside/setupLI.exe


Re: Entity bean can not remove itself

2006-07-04 Thread mahu2425
Hello Dirk,

in my scenario the entity bean stores some data from an ERP system. The data is 
required for a number of steps (function calls, data for message driven beans, 
etc.).

After all (concurrent) tasks have been completed, the entity bean is no longer 
required and can remove itself.

The scenario is a little bit compareable to the one in Sun's J2EE tutorial:
http://java.sun.com/j2ee/1.4/docs/tutorial/doc/JMSJ2EEex3.html

So, what I need is just a ways to remove an entity bean. The special problem 
here is that the entity bean needs to call it's own remove method.

As I said in my first posting, I would prefer to call the remove() method from 
the entity bean's remote interface instead of calling ejbRemove(), but calling 
remove() seems to crash the server (the remove is done during a Timer 
callback). It seems that Geronimo is struggeling between removing the bean and 
completing the timer transaction (in fact is trys to roll it back). If you try 
to restart the server after the crash you'll always get an exception that a 
GBean has been destroyed. I never managed to get the server back to work in 
this case (had to start with a new installation).

So, I think there should be a possibility that an entity bean can remove 
itself. It could be discussed whether is should call remove() or ejbRemove(). 
Sun seems to prefer ejbRemove().


Best regards,

Markus



  Hello, Markus
  
  It's just a little bit difficult to understand why you (the user) should
  handle the instance of a bean :-/ That's the job of the EJB container
  (greetings to the OpenEJB people). Or can you post a scenario where you
  definitely need to remove an EJB? Share your idea :P
  
  AFAIK it's not your business to know too much of the EJB container and
  its EJB instances :P
  
  Best regards
  
  Dirk

Benachrichtigung bei E-Mail Empfang! - 
http://mail.lycos.de/app/lycosinside/setupLI.exe

Re: Entity bean can not remove itself

2006-07-03 Thread D. Strauss
Hello, Markus

It's just a little bit difficult to understand why you (the user) should
handle the instance of a bean :-/ That's the job of the EJB container
(greetings to the OpenEJB people). Or can you post a scenario where you
definitely need to remove an EJB? Share your idea :P

AFAIK it's not your business to know too much of the EJB container and
its EJB instances :P

Best regards

Dirk

mahu2425 schrieb:
 Hello,
 
 has nobody an idea if this migh be a bug or if I'm doing anything wrong? I 
 really need this feature, that an entity bean can remove itself.
 
 Could anybody help me?   ;-)
 
 
 Best regards,
 
 Markus
 
 
 
  Hi there, 
  
  I have an entity bean (CMP) that uses the TimerService and includes 
  the TimedObject interface. When the callback function ejbTimeout(Timer 
 timer) 
  on the entity bean is executed, the bean should remove itself. 
  
  
  
  My code looks like: 
  
  public void ejbTimeout(Timer timer) {
ejbRemove();
  }


 I inserted a few debug statements and I'm sure that ejbTimeout() is 
 executed. Unfortunally the 
 bean will not be removed.

 Has anybody an idea what's going wrong or if this might be a bug? 

 I also tried to remove the bean using the remove() method from the remote 
 interface as well as
 removing it using the remove() method from the home interface. In both cases 
 an exception will be 
 thrown (transaction rolled back, could not remove timer) and the server will 
 be completly crash 
 (GBean DESTROYED message) and will no longer successfully startup at a 
 restart. So, calling remove() 
 seems to be a bad idea, but ejbRemove() doesn't work (the Sun J2EE tutorial 
 says ejbRemove() should 
 work).

 What can I do to let the entity bean remove itself?


 Greets, Markus
 
 Benachrichtigung bei E-Mail Empfang! - 
 http://mail.lycos.de/app/lycosinside/setupLI.exe