13.07.2015 Views

Java™ Application Development on Linux - Dator

Java™ Application Development on Linux - Dator

Java™ Application Development on Linux - Dator

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

480Chapter 21Introducti<strong>on</strong> to Enterprise JavaBeansdepend many factors, including the databases your c<strong>on</strong>tainer supports, thecomplexity of your database, the quantity of n<strong>on</strong>-Java clients, or the amountof legacy code.Entity beans can be a hard sell in many development envir<strong>on</strong>ments. Wecan see three str<strong>on</strong>g reas<strong>on</strong>s to resist the use of entity beans.1. Heterogenous envir<strong>on</strong>ments. In many enterprises, rich and diverse setsof development envir<strong>on</strong>ments exist—Windows.NET and ASP clients,mainframe clients, C and C++ applicati<strong>on</strong>s, third-party applicati<strong>on</strong>s, andJava. The soluti<strong>on</strong> many database envir<strong>on</strong>ments adopt is to use storedprocedures that are shared across all of these platforms to c<strong>on</strong>centratedatabase access into a comm<strong>on</strong> set of code. Stored procedures do not tendto be written with the kind of strict row-to-object mapping that entitybeans model so well; instead, they are often designed to support specificbusiness processes. That fits so well with the sessi<strong>on</strong> bean model that youmay be tempted to implement a sessi<strong>on</strong> bean facade in fr<strong>on</strong>t of such storedprocedures and leave it at that.2. Legacy code. A variati<strong>on</strong> <strong>on</strong> the above argument exists when there is alreadya c<strong>on</strong>siderable body of code, perhaps even Java code written directlyusing JDBC, that accesses the database and performs the comm<strong>on</strong> operati<strong>on</strong>s.Here again, the simplest soluti<strong>on</strong> is to put a sessi<strong>on</strong> bean facade <strong>on</strong>the already existing code.3. Mobile cheese. One of the trendy business books published recently is titledWho Moved My Cheese? and it is about the negative ways in whichpeople react to change. You might very well meet resistance simply becausethe technology is new and unfamiliar, and represents a change in thinkingabout data persistence from what the development staff is used to doing.So, where is it suitable? Entity beans are particularly well suited to envir<strong>on</strong>mentsthat are homogenous by being based either mostly <strong>on</strong> Java or <strong>on</strong>CORBA/IIOP. Further, they are well suited to envir<strong>on</strong>ments where the bulkof the work is the editing and manipulati<strong>on</strong> of small numbers of entities persessi<strong>on</strong>, as opposed to large reports or statistical queries where a sessi<strong>on</strong> mightwant to use many or all rows in a table.Please note that using entity beans in such appropriate cases in no wayprecludes other types of use! You just w<strong>on</strong>’t likely use entity beans for them.In other words, you d<strong>on</strong>’t have to use it just because it is there.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!