I was wondering if anyone has encountered problems by making the remote object extend both the EJBLocalObject and EJBObject interface. Technically it seems like one could create the following:
public interface Customer extends EJBObject, EJBLocalObject { ... }
This would then allow:
public interface CustomerHome extends EJBHome, EJBLocalHome {
public Customer create()...
public Customer findByPrimaryKey()...
}
Basically, I'm trying to make the code flexible without creating "extra" classes. Any thoughts or experience on this approach?
-
Coding an EJB for Local & Remote access (7 messages)
- Posted by: Natalie L
- Posted on: August 28 2002 12:20 EDT
Threaded Messages (7)
- Coding an EJB for Local & Remote access by J2EE DISCUSSION ANIL LINGUTLA on August 28 2002 15:52 EDT
- Coding an EJB for Local & Remote access by vishal jain on August 29 2002 01:11 EDT
- Coding an EJB for Local & Remote access by vishal jain on August 29 2002 01:22 EDT
- Coding an EJB for Local & Remote access by Owen Fellows on August 29 2002 06:52 EDT
-
Coding an EJB for Local & Remote access by Natalie L on August 29 2002 03:36 EDT
-
Coding an EJB for Local & Remote access by hoi tsang on August 29 2002 05:12 EDT
- Coding an EJB for Local & Remote access by Angel Marquez on August 30 2002 04:49 EDT
-
Coding an EJB for Local & Remote access by hoi tsang on August 29 2002 05:12 EDT
- Coding an EJB for Local & Remote access by vishal jain on August 29 2002 01:22 EDT
-
Coding an EJB for Local & Remote access[ Go to top ]
- Posted by: J2EE DISCUSSION ANIL LINGUTLA
- Posted on: August 28 2002 15:52 EDT
- in response to Natalie L
mutltiple inheritance!!!! -
Coding an EJB for Local & Remote access[ Go to top ]
- Posted by: vishal jain
- Posted on: August 29 2002 01:11 EDT
- in response to Natalie L
Local beans methods can be invoked only by the clients located in the same JVM as that of the bean. Your home interface extends both EJBHome and EJBLocalHome interface. In the create and finder methods you are returning Customer bean's component interface. Again in the component(remote) interface you r extending EJBObject and EJBLocalObject so how the container will understand what exactly is to be returned?
When a remote client connects to your bean since remote interface is extending both EJBObject and EJBLocalObject will always get exceptions. -
Coding an EJB for Local & Remote access[ Go to top ]
- Posted by: vishal jain
- Posted on: August 29 2002 01:22 EDT
- in response to vishal jain
For more information regarding the above please refer EJBSpecification 2.0 document chapter 5 local and remote client views. The specification says that although it is possible to provide both local and remote client views for an entity bean, typically the or the other should be provided.
The specification further says that entity beans that have container managed relationships with other entity beans must be accessed in the same local scope as the related entity beans.
If u want to provide both the viwes i.e. local and remote then better write separate interfaces. -
Coding an EJB for Local & Remote access[ Go to top ]
- Posted by: Owen Fellows
- Posted on: August 29 2002 06:52 EDT
- in response to vishal jain
Are there any good examples or using Local Interfaces for Relationships in EJB2.0.
Also if you have a one to one relationship how should you implement the constructer so you can pass the related object in on creation.
Any ideas, Owen -
Coding an EJB for Local & Remote access[ Go to top ]
- Posted by: Natalie L
- Posted on: August 29 2002 15:36 EDT
- in response to vishal jain
Vishal,
I just went and read the spec and it does say it is not usual to provide a bean as both remote but local; however, it didn't say defining it as both is not recommended. If a local client access the bean, then the local remote/home will be used, and if a remote client access the bean, then the remote remote/home interfaces will be used. The container should be able to differenciate between which one to use...based on the request and the deployment descriptor mapping.
Natalie -
Coding an EJB for Local & Remote access[ Go to top ]
- Posted by: hoi tsang
- Posted on: August 29 2002 17:12 EDT
- in response to Natalie L
how if you specifying an ejb for each in the ejb-jar (1 for remote, 1 for local) but both bean use the same class?
i suggest create a business interface to specify all the methods needed, and create a local and remote where each will extends the business interface...
-
Coding an EJB for Local & Remote access[ Go to top ]
- Posted by: Angel Marquez
- Posted on: August 30 2002 04:49 EDT
- in response to hoi tsang
No way, the solution is to separate them. The Remote bean is compiled with stubs/skels for remote interchange and marshall, the local does not.