Java Technology Home Page
A-Z Index

Java Developer Connection(SM)
Chat

Downloads, APIs, Documentation
Java Developer Connection
Tutorials, Tech Articles, Training
Online Support
Community Discussion
News & Events from Everywhere
Products from Everywhere
How Java Technology is Used Worldwide
Print Button
 
Office Hours Transcripts Index

Office Hours:
Enterprise JavaBeansTM (EJB) Tutorial:
April 8, 1999

Speakers: Uday Shetty (SPK-uday_123) and Tom Daly (SPK-tdaly1)

If you are not familiar with the tutorial, it is available at the JavaTM Developer ConnectionSM (JDC) at:

SPK-tdaly1: Good Morning.

jarcher1: Hi all. How are you today?

SPK-tdaly1: We have Uday Shetty and me (Tom Daly) the authors of the Enterprise JavaBeansTM tutorial writing your first stateless session bean.

Can we answer any questions for you regarding the tutorial?

jarcher1: I have a few...am I the only non-author participant??

SPK-uday_123: Hi jarcher1, you'll have to put up with rusty typing.

SPK-tdaly1: Yep so far you are outnumbered. :-)

jarcher1: My name is Jim, and rusty typing is a way of life <Grin>!! OK...I liked your tutorial! I have a few questions that may go.

SPK-tdaly1: Have you managed to build and get the demo working?

SPK-uday_123: Jim, have you tried running HelloWorld on any other EJB servers?

jarcher1: Beyond it a bit. I am wondering why the division of containers and servers? It seems like the container provides most services, and I don't understand what the server provides the container with???

SPK-tdaly1: Actually today the concept of a container is just that—a concept—it really is the server doing all of the work.

jarcher1: Ah, no, I don't yet have an EJB server, but I'm looking for one...

SPK-uday_123: Container manages the well-being of the bean, Server provides all the underlying resources.

jarcher1: Hmmm... I might have broken something. Am I still here?

SPK-tdaly1: Yep.

jarcher1: OK, so the container really passes most requests to the server?

SPK-uday_123: Yep

SPK-tdaly1: Anyone there?

jarcher1: I see. I suppose that makes sense. I realize this is not exactly about your tutorial, but I was wondering if you could recomend a server. I hesitate to use the BEA one because I don't want it to expire and I really don't want to be contacted by salespeople...

SPK-tdaly1: I think the EJBHOME server is still freely available at http://www.ejbhome.com

jarcher1: OK, I'll look into that. Thanks! Also, would a database app normally access an entity from a session bean or from a client?

SPK-uday_123: You can also try Gemstone, Persistence for evaluation. These are all commercial products and have a 30 day license.

jarcher1: Thanks!

SPK-tdaly1: There are no hard rules. If there's business logic that is specific to your user session, it makes sense to have a session bean on top of the entity. Otherwise, the entity bean may suffice. Does this help?

jarcher1: OK, Thanks. For the past few days, I have been trying to piece together how an actual database application might work with multiple tables, transaction support and so on. Most of the tutorials and such I have seen have been great, but very basic. Yes, it's a big help.

platibus: Is there a performance penalty for using EJBeans?

SPK-uday_123: Model is designed to be scalable, but it all depends on the implementation.

jarcher1: Must an entity bean represent a single record from a single table or would it represent a number of joined or related records each from a different table?

SPK-tdaly1: There is nothing specifically limiting it. Many of the EJB servers coming onto the market are based on existing products e.g. Oracle8i, and the scaling of these existing products is well known. EJB should not be a radical departure for them.

SPK-uday_123: Entity bean can represent a single record or a number of joined records.

Sage45: Hello all.

SPK-tdaly1: A futher note about performance is that at Sun we have a project already well under way to measure and tune EJB server and application performance.

Hi Sage45.

SPK-uday_123: Hi Sage45.

SPK-tdaly1: Tom Daly and Uday Shetty are here to help answer questions on EJB.

Sage45: I have a question about the Java Development KitTM.

SPK-tdaly1: We'll try.

SPK-uday_123: Hi aliberson.

aliberson: Hello everyone.

Sage45: Is the JDK for Java 2 compliant/backwards compatible with code from 1.0???

SPK-uday_123: The Java 2 Platform has some new features like the security, collections, and RMI. The byte codes are compatible.

platibus: We have our own homegrown application server. What is the minimum conceivable effort that is needed to make it EJB compliant (in personmonths)?

aliberson: Is this forum limited to EJB only?

SPK-tdaly1: platibus, this is a really good question and one of the areas I am currently working on. I suspect the more separation between the app server logic and the application, the simpler the task of separation.

aliberson: I have a question about Visual Café/JDBC/Oracle on a separate host, but this is the only forum that I see.

SPK-uday_123: Yep, pretty much.

SPK-tdaly1: You can try the JDBC/Oracle part on me.

jarcher1: Is there currently an estimate as to when V2 spec will be out, and will there be radical changes?

Sage45: Sorry. Got booted. So then, what you are saying is that code designed under the Java 2 Platform using JDK1 compliant classes/structures will be compliant with the 1.0 spec???

SPK-uday_123: Next version of the EJB spec, code name Moscone will be released shortly.

platibus: Thanks, Tom (SPK-tdaly1)...in the best case scenario, are we talking about a few weeks for one person or half a year for a team of four (just a ballpark figure)?

SPK-tdaly1: The next version of the EJB spec really tightens up some of the issues affecting portability and it reflects the move to the Java 2 platform.

Sage45: I'm trying to cover all browsers...don't want to limit or keep people who have not upgraded to IE5.0 from seeing or accessing the Java 2 code, so I want to write and compile all my programs to be 1.0 compliant.

SPK-uday_123: Sage45, Yep, the code designed with the Java 2 technology using JDK1.1 structures is compliant with EJB1.0 spec.

SPK-tdaly1: I am sorry I can't even begin to guess without knowing more about the app and the amount of code you have. What I can say is that the sooner you do this the sooner you have a new market for your application, considering the move toward online application service providers.

Sage45: Thanks.

SPK-tdaly1: Sorry this was a little unclear. What I mean is that once your app is a set of components you can possibly start reselling them and maybe you can start providing services with the delivery vehicle being the WWW.

jarcher1: Could you offer an example of what type of beans might be available. commercially, that would be generic enough to use with a company's business logic? It seems that the beans a bean writer would have to code are business specific, but I keep seeing a lot of hype about how these beans will be available commercially as generic beans to be used by EJB developers. Am I missing something?

aliberson: I've been able to use a policy file to allow my applet to bypass the sandbox restrictions and connect to oracle on a host separate from the web server using Oracle's thin driver. I used Café's wizard to create a data grid. The applet executes when I run it from my local machine, but when I run it from the server, I get the following errors in the log:

Sage45: I just started to program in Java and man all I can say is that this program, being as small as it is, is very powerful...Are there any full machine coded compilers for Java???

SPK-tdaly1: Oracle has one embedded in Oracle8i.

Aliberson, I can't see the log.

aliberson: Error: NNW3239_WAVERecord [[NNW3239_WAVE_JApplet1_QNAlias]]

aliberson: One trouble is that I don't know of a way to debug the applet once it's running from the server.

SPK-tdaly1: Hmm, this is not a JDBC error as far as I can tell, what is WAVE?

aliberson: WAVE is the name of the table I am querying.

dbell9n: I would like to access a Hashtable that was created in an existing running instance. How can 50 other running clients access the same hashtable when they instantiate their object?

SPK-tdaly1: aliberson, it looks like you have an application level error. What you might try is getting one of the Oracle demo programs running locally and then from your client machine. Then once you have this working, look back at your example. Have a look in $ORACLE_HOME/jdbc/demo directory for examples.

dbell9n: Is anyone here?

SPK-tdaly1: dbell9, are we talking session or entity beans.

dbell9n: Session. I would like to get to one central Hashtable that is created only once.

aliberson: I am able to run Oracle's JDBCTestConnection applet (which outputs HelloJDBC and sysdate from dual).

dbell9n: By many clients. I do not want to create a new instance of that existing hashtable.

SPK-tdaly1: aliberson, this means your driver setup is ok, so it looks like a real application error, can you run it as an application not just an applet?

SPK-tdaly1: In sesssion beans, each instance belongs to one and only one client and the data it holds (if any) is held exclusively for that client.

aliberson: I can run it locally (from Visual Café's environment), and it connects to the database and displays the records as an applet.

dbell9n: What is a entity bean and should I use this instead of a session in trying to access only one hashtable by many running clients.

SPK-tdaly1: I am sorry, there is something in your environment or in Café's that I guess I can't diagnose remotely.

aliberson: Is there a way I can put the code of the applet in one whole try block and catch the exception?

SPK-tdaly1: An entity bean is an object representation of persistent data (e.g. a bank account). A session bean is a representation of a service (e.g a teller) who can access the bank account.

jarcher1: This is not a development question, but what type of price range do commercial EJB servers fall into? I have noticed that no onputs pricing in their lit or online, so that made me wonder if it is tremendousely high. Is there a server available that a small company could afford?

Oh, also, does an EJB server provide a mechanism where multiple clients can access the same data simultaneously, and see other users changes? I realize this can be implemented by the developers, but I was wondering if that is provided for.

SPK-uday_123: jarcher1, some vendor pricing depends on the number of CPU's, number of users, etc. I believe the price varies from $10k to $$$$.

dbell9n: Are you saying that I should be using an entity bean instead of a session bean? And if so, is there any documentation on the web I can find?

This is my scenario. I am connecting to a socket that only allows me on read and write socket. However, I can flow many requests through the read socket. Let's call the above my Requester/Requestee. Then I have another client that will need to send a request to the Requester/Requestee to fill an order. Keep in mind I don't want to establish/can't establish another connection to the read/write socket. How do I determine who to send the data back to?

SPK-tdaly1: Hmm, I have to check on this with entity beans. You can have multiple clients access the same data but the way the data is shared depends upon the transaction attributes you specify and upon the container/server for implementing the sharing on your behalf, i.e. you don't code this sharing of data, you get it for free.

dbell9n: Any examples of this free giving of data Tom (SPK-tdaly1)? I have been baffled over the last two weeks on how to accomplish this. What time does this chat session end?

SPK-tdaly1: Have a look at the BEA weblogic entity bean examples, they may make this clearer for you have a look at http://www.weblogic.com. :-)

SPK-uday_123: jarcher1 I have to signoff. Thanks for the interest in EJB.

SPK-tdaly1: Ok, I do have to sign off. It has been a pleasure chatting with you. See ya.

jarcher1: Thanks for all your help and advice!!!

dbell9n: Thanks Tom?

Sage45: Thanks everyone. It's been quite enlightening.

Forum closed at Thu Apr 8 12:19:03 1999


Reader Feedback

Tell us what you think of this transcript.

Duke

Very worth reading Worth reading Not worth reading

If you have other comments or ideas for future articles, please type them here:


Print Button
[ This page was updated: 21-Sep-2000 ]
Products & APIs | Developer Connection | Docs & Training | Online Support
Community Discussion | Industry News | Solutions Marketplace | Case Studies
Glossary | Feedback | A-Z Index
For more information on Java technology
and other software from Sun Microsystems, call:
(800) 786-7638
Outside the U.S. and Canada, dial your country's AT&T Direct Access Number first.
Sun Microsystems, Inc.
Copyright © 1995-2000 Sun Microsystems, Inc.
All Rights Reserved. Terms of Use. Privacy Policy.