An entity bean is a data object, not a business process object. Accessing an entity bean directly over the network is expensive, due to:
The stub
The skeleton
Marshaling/demarshaling
The network call
The EJB object interceptor
You can minimize these expensive calls to entity beans by wrapping them with session beans. The session beans perform bulk CRUD (create, read, update, delete) operations on behalf of remote clients. You can also wrap entity beans with other entity beans.
Since entity beans should not be called directly from remote clients, but rather should be called from objects located in the same process, we'd like to access entity beans in a high-performing way. Therefore,
Call entity beans through their local interfaces.
EJB 2.0 defines the local interface as a high-performing way to access an enterprise bean. The local interface removes most of the overhead associated with calling an EJB component. Local interfaces empower developers to make enterprise beans more fine-grained, and are perfect for accessing entity beans.
-
Use local interfaces with entities (35 messages)
- Posted by: Ed Roman
- Posted on: April 30 2001 12:36 EDT
Threaded Messages (35)
- Use local interfaces with entities by Satadru Roy on May 01 2001 20:34 EDT
- Use local interfaces with entities by Robert Nicholson on May 01 2001 21:04 EDT
- Use local interfaces with entities by Tony Brookes on May 02 2001 07:51 EDT
- Use local interfaces with entities by Ranit Mathur on November 21 2001 09:02 EST
- Use local interfaces with entities by Pradeep Balaji on November 29 2001 11:47 EST
- Use local interfaces with entities by Robert Nicholson on May 01 2001 21:04 EDT
- Use local interfaces with entities by Colin He on May 07 2001 13:54 EDT
- Use local interfaces with entities by David Wolfe on May 07 2001 22:20 EDT
- Use local interfaces with entities by Scott Boecker on May 10 2001 08:40 EDT
- Use local interfaces with entities by Ilamparithi Chithambaram on May 10 2001 11:09 EDT
- Use local interfaces with entities by Kevin Weller on May 10 2001 11:26 EDT
- Use local interfaces with entities by Cedric Beust on June 04 2001 11:59 EDT
- Use local interfaces with entities by Scott Boecker on May 10 2001 08:40 EDT
- Use local interfaces with entities by Nicholas Wilson on May 08 2001 11:18 EDT
- Use local interfaces with entities by Farooq Hameed on May 09 2001 01:33 EDT
-
Use local interfaces with entities by Tyler Jewell on May 09 2001 01:42 EDT
-
Use local interfaces with entities by Toby Reyelts on May 10 2001 11:40 EDT
- Use local interfaces with entities by Tyler Jewell on May 15 2001 02:17 EDT
- Use local interfaces with entities by Kishore Lal on October 20 2001 05:51 EDT
- Use local interfaces with entities by Kishore Lal on October 20 2001 05:51 EDT
-
Use local interfaces with entities by Toby Reyelts on May 10 2001 11:40 EDT
- Use local interfaces with entities by wang minjiang on July 13 2001 05:17 EDT
- Use local interfaces with entities by Pradeep Balaji on November 29 2001 11:41 EST
-
Use local interfaces with entities by Tyler Jewell on May 09 2001 01:42 EDT
- Use local interfaces with entities by Farooq Hameed on May 09 2001 01:33 EDT
- dependent object and local interfaces by Venkatesh Deshpande on May 10 2001 20:13 EDT
- Use local interfaces with entities by Bledar Ginos on May 16 2001 09:45 EDT
- Use local interfaces with entities by Gerald Boersma on May 25 2001 21:22 EDT
- Use local interfaces with entities by Rich Boyde on June 01 2001 09:43 EDT
- Local Interfaces and Clustering by bharat b on November 29 2002 02:34 EST
- Use local interfaces with entities == ? by Sanand Patel on July 24 2001 18:20 EDT
- Use local interfaces with entities by Daniel Cardin on August 02 2001 15:59 EDT
- how do you pass graphs or trees of objects to the client by Basil Fawlty on August 29 2001 04:01 EDT
- Use local interfaces with entities by mahesh kumar on August 28 2002 09:25 EDT
- Unvisited question: Wrong number of arguments in constructor. th by Amit Desai on March 29 2005 23:34 EST
- Use local interfaces with entities by Anand Raj on October 10 2002 19:54 EDT
- who can tell me how to test localinterface entitybean? by holen chen on February 25 2003 01:05 EST
- who can tell me how to test localinterface entitybean? by Amitav Chakravarty on February 12 2004 03:44 EST
- Use local interfaces with entities by Sandun Ranmal abeyweera on November 17 2003 03:08 EST
- Use local interfaces with entities by Amitav Chakravarty on February 09 2004 14:28 EST
-
Use local interfaces with entities[ Go to top ]
- Posted by: Satadru Roy
- Posted on: May 01 2001 20:34 EDT
- in response to Ed Roman
I agree. In fact, I wonder why the specs didn't go as far as to abolish remote interfaces for entity beans altogether. It's counterintuitive to access an entity bean directly through a remote interface and then access its related objects through value objects. Doing away with the remote interfaces for entity beans would have forced a design decision on the developer but it'd have removed a lot of unnecessary confusion.
Satadru -
Use local interfaces with entities[ Go to top ]
- Posted by: Robert Nicholson
- Posted on: May 01 2001 21:04 EDT
- in response to Satadru Roy
An EJB 2.0 compliant container still has to be backward compatible with EJB 1.1 code does it not? -
Use local interfaces with entities[ Go to top ]
- Posted by: Tony Brookes
- Posted on: May 02 2001 19:51 EDT
- in response to Robert Nicholson
No, it has to support both the 1.1 and 2.0 spec, but that doesn't mean you can't use the 2.0 features of a "2.0 bean."
I suspect that the vendor specific deployment tools (where they exist) will have a "is this a 1.1 or a 2.0" bean flag somewhere! :)
Chz
Tony -
Use local interfaces with entities[ Go to top ]
- Posted by: Ranit Mathur
- Posted on: November 21 2001 09:02 EST
- in response to Satadru Roy
its true that we should always be using Local Interfaces for EB to EB relations, but what are the clustering issues.
Moreover, if we use CMR, then the target EB need to provide LocalInterfaces. Do LocalInterfaces allow clustering. And if they do, then there is a possibility that the JNDI will return a reference to an object on the other member of the cluster, then how CMR is going to work.
Ranit
-
Use local interfaces with entities[ Go to top ]
- Posted by: Pradeep Balaji
- Posted on: November 29 2001 23:47 EST
- in response to Ranit Mathur
Hi ranit,
Its true when your using local object the ejbs in the relationship should be in the same server.If you have to go for clustering ,go for EJBObject & EJBHome instead of EJBLocalObject & EJBLocalHome ,use seperate jar & ejb-jar for each of the ejb's involved. -
Use local interfaces with entities[ Go to top ]
- Posted by: Colin He
- Posted on: May 07 2001 13:54 EDT
- in response to Ed Roman
In this case, we choose that one session bean wraps multiple entity beans.
Yihua he -
Use local interfaces with entities[ Go to top ]
- Posted by: David Wolfe
- Posted on: May 07 2001 22:20 EDT
- in response to Ed Roman
Do any EJB vendors currently support this feature (local interfaces) of the EBJ 2.0 proposed spec? -
Use local interfaces with entities[ Go to top ]
- Posted by: Scott Boecker
- Posted on: May 10 2001 08:40 EDT
- in response to David Wolfe
This feature is available in the latest version (6.5) of the PowerTier app server from Persistence. This feature is referred to as "collocation optimization". Using this feature, we have seen a 30% reduction in execution time for some of our bean intensive operations. -
Use local interfaces with entities[ Go to top ]
- Posted by: Ilamparithi Chithambaram
- Posted on: May 10 2001 11:09 EDT
- in response to Scott Boecker
It's really interesting..
And I am just wondering that..Local interfaces were only announced a couple weeks ago and this feature is available in PowerTier app server!!!?? Great!!!
Parithi
-
Use local interfaces with entities[ Go to top ]
- Posted by: Kevin Weller
- Posted on: May 10 2001 11:26 EDT
- in response to Scott Boecker
Is the PowerTier feature simply a container optimization on the use of collocated remote interfaces? That's what WebLogic Server does... -
Use local interfaces with entities[ Go to top ]
- Posted by: Cedric Beust
- Posted on: June 04 2001 11:59 EDT
- in response to David Wolfe
Do any EJB vendors currently support this
> feature (local interfaces) of the EBJ 2.0
> proposed spec?
Weblogic 6.1 will support local interfaces (beta available soon).
--
Cedric
-
Use local interfaces with entities[ Go to top ]
- Posted by: Nicholas Wilson
- Posted on: May 08 2001 11:18 EDT
- in response to Ed Roman
This sounds very interesting. Is it somehting that can be done now using EJB 1.1 or do we need a container which supports EJB 2.0. Could we have code example please -
Use local interfaces with entities[ Go to top ]
- Posted by: Farooq Hameed
- Posted on: May 09 2001 01:33 EDT
- in response to Nicholas Wilson
I haven't seen any code example of using Local interfaces. Can someone provide it? Also, currently atleast BEA WLS6.0 is not supporting it. -
Use local interfaces with entities[ Go to top ]
- Posted by: Tyler Jewell
- Posted on: May 09 2001 13:42 EDT
- in response to Farooq Hameed
Man... you guys are awfully demanding -- I like that. :-) Local interfaces were only announced a couple weeks ago, so no vendors support it just yet.
Local interfaces will be supported in WebLogic Server in the near future, but I can't comment as to exactly when -- it will be soon, though.
Tyler -
Use local interfaces with entities[ Go to top ]
- Posted by: Toby Reyelts
- Posted on: May 10 2001 11:40 EDT
- in response to Tyler Jewell
Tyler said:
Local interfaces will be supported in WebLogic Server in the near future, but I can't comment as to exactly when -- it will be soon, though.
----------
Tyler, since you seem to be up on local interfaces, maybe you can explain to me what the benefit of local interfaces is (from your's or Weblogic's point of view), specifically:
I've heard that the Weblogic container already optimizes intra-vm calls, but that those calls use pass by reference instead of pass by value semantics. Why can't the container just make copies of the arguments if it makes a local call. This would
a) keep remote semantics intact
b) improve performance over remote calls
c) keep developers from having to deal with YAEC (yet another ejb complexity - the addition of local interfaces to the mix)
What do local interfaces give us beyond what this sort of optimization already gives us?
God bless,
-Toby Reyelts
-
Use local interfaces with entities[ Go to top ]
- Posted by: Tyler Jewell
- Posted on: May 15 2001 14:17 EDT
- in response to Toby Reyelts
Hi... Sorry to take so long to respond.
Well, my personal feelings are truly mixed about whether or not pass-by-reference should even be allowed in a container. Toby, you make some excellent points about optimizing calls but maintaining pass-by value semantics.
However, the performance of pass-by-value will always be in question and vendors want pass by reference.
Let's think of this another way, though. We have become so ingrained with thinking about EJBs as only having remote interfaces, we are shocked to think of local interfaces. I don't think it's so shocking. All developers begin learning the Java language by understanding pass by reference semnatics and the performance benefits within a same VM. One could argue that a system should be designed with nothing but local interfaces internally and then expose only certain services with a remote interface or a SOAP web service. I think if this were done initially with the EJB specification, it would force developers to 1) design their components correctly for granularity and 2) come up with appropriate remote interfaces that don't have a lot of silly accessor / utility methods that shouldn't be exposed.
So, that's one argument. Another argument for having pass-by-reference is that EJBs will be able to pass objects that can't be passed by value. For example, Reflection objects are not serializable and can't be passed over RMI, but they can be passed as an input parameter to a local method.
Tyler -
Use local interfaces with entities[ Go to top ]
- Posted by: Kishore Lal
- Posted on: October 20 2001 05:51 EDT
- in response to Tyler Jewell
The Weblogic6.1 documentation shows that local-reference calling of a Bean is possible which is not the same with Weblogic6.0 . Any idea about any patch-ups which would make the local-reference call possible for 6.0 version ?
-
Use local interfaces with entities[ Go to top ]
- Posted by: Kishore Lal
- Posted on: October 20 2001 05:51 EDT
- in response to Tyler Jewell
The Weblogic6.1 documentation shows that local-reference calling of a Bean is possible which is not the same with Weblogic6.0 . Any idea about any patch-ups which would make the local-reference call possible for 6.0 version ?
-
Use local interfaces with entities[ Go to top ]
- Posted by: wang minjiang
- Posted on: July 13 2001 05:17 EDT
- in response to Farooq Hameed
But WLS already uses call-by-reference even from 5.1. It basically is same thing as the local interface.
minjiang -
Use local interfaces with entities[ Go to top ]
- Posted by: Pradeep Balaji
- Posted on: November 29 2001 23:41 EST
- in response to Farooq Hameed
Weblogic 6.1 supports Ejb 2.0 specification ie,cmp,cmr etc...also has GUI for administration .The cluster can be set up in 2 minutes using the weblogic 6.1 leaving other app server vendors far behind. -
dependent object and local interfaces[ Go to top ]
- Posted by: Venkatesh Deshpande
- Posted on: May 10 2001 20:13 EDT
- in response to Ed Roman
can anybody explain what is the difference between
dependent object of draft 1 of EJB 2.0
and local interfaces of draft 2 of EJB 2.0 ..
I failed to locate any explanation as why
dependent objects is dropped from Draft 2 of EJB 2.0
-
Use local interfaces with entities[ Go to top ]
- Posted by: Bledar Ginos
- Posted on: May 16 2001 09:45 EDT
- in response to Ed Roman
Outside of having entity beans as data objects, this type
of bean seems that has been designed for remote access.
Ok. I agree and I welcome this.
But... I actually can't find any reason for mapping relational data as EJB (with remote accessibility) and after that suggesting use of "local interface" by local session beans calls so that optimizes accessibility.
Doesn't this look like
something comes when you go ?????
Comparing all that with traditional way of mapping data to regular java beans and following with an access layer from session beans, does anybody see some run-time differences between theme.
I mean run-time differences anything that doesn't concern the design time commodity
(easy graphical mapping with xml, not writing jdbc and anything else like that).
-
Use local interfaces with entities[ Go to top ]
- Posted by: Gerald Boersma
- Posted on: May 25 2001 21:22 EDT
- in response to Ed Roman
Which begs the question: What is the point of Entity EJBs?
We have done a complete design / implementation cycle on our app using Weblogic 5.1, and the only benefit that we can see is the following:
The advantage of an Entity EJB is that when an application is distributed and a session bean accesses an entity bean located on a different machine, it will get the instance of the entity bean on that machine. Therefore if, during the same transaction, two session beans located on different machines access the same entity bean at different times during the transaction, they will access the same cached bean and therefore intermediate, non-committed changes to the database will be reflected properly. That is, changes to the entity bean's attributes that have not yet been saved to the database will be maintained throughout the entire transaction.
Is this a correct conclusion? If so, doesn't this usefulness become insignificant given that weblogic (don't know about others) recommends that instead of deploying the EJBs on different machines, they should all be deployed on each machine and clustering should be used for fail-over/load balancing?
Thanx for your help.
-
Use local interfaces with entities[ Go to top ]
- Posted by: Rich Boyde
- Posted on: June 01 2001 09:43 EDT
- in response to Gerald Boersma
I agree with Gerald!
In addition:
An entity bean's sole purpose in life is to hide the details of database access, to access the database in a simular fashion and to reduce dependency on learning SQL. You also can minimize your connections to the database on a session by session basis, but with the amount of overhead all this implies it seems counterproductive. I have always used entity beans in a limited fashion, using them for complex transactions but always masked by a session bean. This has always given us the best performance.
rich -
Local Interfaces and Clustering[ Go to top ]
- Posted by: bharat b
- Posted on: November 29 2002 02:34 EST
- in response to Gerald Boersma
Hi ServerSiders.
Here is a new member in your group with lot of queries for u....
well...
i m working on EJB 2.0 using Weblogic 6...i'll be heavily using local interfaces for beans communication and clustering has be implemented in my system.....
could anybody focus on behaviour of local interfaces in clustered environment?
thanx.. -
Use local interfaces with entities == ?[ Go to top ]
- Posted by: Sanand Patel
- Posted on: July 24 2001 18:20 EDT
- in response to Ed Roman
This gets me re-thinking EJBs. Given some of the "issues" with entity beans (performance, bulk cacheing & optimistic locking "work arounds", clustering, vendor locking) my take it that the above pattern degenerates to "standardized" DAOs.
From that, I go to EJBs degenerating to session beans + DAO. Which I am quite happy with since I *do* trust the database for reliability/clustering/cacheing/etc and I am then thankful for what *I* really want in EJB session beans --- easy-to-use transaction support.
*But* if I had a *really* nice pattern (or implementation) for easy-to-use transaction support, I would be happy with servlets/beans/JSP/JMS + txn support + standardized DAO. System would be faster and "lighter" without all those EJB layers. Is this all sacrilegious? -
Use local interfaces with entities[ Go to top ]
- Posted by: Daniel Cardin
- Posted on: August 02 2001 15:59 EDT
- in response to Ed Roman
JBoss 2.4 BETA supports local interfaces. Thanks to a contribution by Dan O'Connor.
-
how do you pass graphs or trees of objects to the client[ Go to top ]
- Posted by: Basil Fawlty
- Posted on: August 29 2001 04:01 EDT
- in response to Ed Roman
hi,
i'm interested in hearing what you guys suggest in the following scenario. i am coding to the EJB2.0 spec using JBoss 2.4 Beta with the persistence manager from MVCSoft.
I am using local entities with cmp and cmr (container managed relationships). Now lets say i have a complex object tree like that shown below. How is this graph of objects best passed back and forth between the client and the session facade. How do you best handle updates of a deeply nested object i.e if a client changes the address of a customer on one of the orders how should that change get reflected on the server - does the whole graph have to be passed back. Should the session facade provide fine grained update methods...
i guess i'm assuming a session facade for handling the CompositeOrders only - would it be better to have more fine grained session facades.
regards,
Colin Daly.
CompositeOrder
Salesperson salesperson
Collection orders
Order
Customer customer
Collection lineItems
LineItem
Product product
double quantity
Customer
ContactInfo contactInfo
Address billingAddress
Address shippingAddress
-
Use local interfaces with entities[ Go to top ]
- Posted by: mahesh kumar
- Posted on: August 28 2002 09:25 EDT
- in response to Ed Roman
I am getting compilation errors when i tried to create ejb jar ..My bean is entity bean with local interface..It works fine if the interface is remote..
..._xfd0ny_ELOImpl.java:53: Wrong number of arguments in constructor.
throw new javax.ejb.EJBException("Unexpected exception in " + -
Unvisited question: Wrong number of arguments in constructor. th[ Go to top ]
- Posted by: Amit Desai
- Posted on: March 29 2005 23:34 EST
- in response to mahesh kumar
Hi There,
I am facing problem while compiling the CMP Entity Bean.
Following is the error message.
D:\ADDezai\J2EEExamples\ejbcgen\com\bean\entity\UserBean_p3h65u_ELOImpl.java:53: Wrong number of arguments in constructor.
throw new javax.ejb.EJBException("Unexpected exception in " +
.............................
Please let me know anybuddy has work around on this.
You can directoly mail me on addezai at gmail dot com for quick response.
Regards,
Amit Desai -
Use local interfaces with entities[ Go to top ]
- Posted by: Anand Raj
- Posted on: October 10 2002 19:54 EDT
- in response to Ed Roman
How does the App Server handles the clustering if we use the local interfaces for entity beans? -
who can tell me how to test localinterface entitybean?[ Go to top ]
- Posted by: holen chen
- Posted on: February 25 2003 01:05 EST
- in response to Ed Roman
who can tell me how to test local interface entitybean?
you'd better answer the question with code,thank you. -
who can tell me how to test localinterface entitybean?[ Go to top ]
- Posted by: Amitav Chakravarty
- Posted on: February 12 2004 03:44 EST
- in response to holen chen
To test the Local Interface you can use the cactus framework. -
Use local interfaces with entities[ Go to top ]
- Posted by: Sandun Ranmal abeyweera
- Posted on: November 17 2003 03:08 EST
- in response to Ed Roman
**** off -
Use local interfaces with entities[ Go to top ]
- Posted by: Amitav Chakravarty
- Posted on: February 09 2004 14:28 EST
- in response to Ed Roman
As per EJB2.0 specification if you used CMR, their is a restriction that you need to use Local objects.