Oracle has released a new new Struts/BC4J based Toy Store Demo and accompanying detailed technical whitepaper.
and its accompanying detailed technical whitepaper
illustrate best practices techniques for building a simple web storefront application as an MVC-style web application using existing frameworks.
View the BC4J Toy Store:
In particular, the demo shows how to use
-> Jakarta Struts for the Controller layer
-> JSP for the View layer
-> Oracle's BC4J J2EE framework for the Model layer
in a way that maximizes "out-of-the-box" functionality for the developer, and minimizes the amount of application infrastructure code that needs to be authored by hand.
The demo is designed to look and work similarly to the original "Java Pet Store" demo that Sun published a fews years ago, so hopefully it will be instantly familiar to anyone who has played with or looked at that demo. It comes translated into English, Italian, and German to illustrate the multilanguage features of Struts and BC4J as well.
Technical questions on the BC4J framework can be posted in the Oracle Technet JDeveloper discussion forum
What version of Struts are you using in this application (and within JDeveloper 9.0.3)? I searched in the on-line documentation for a while, but couldn't find this information.
JDev 9.0.3 ships with Struts 1.1 Beta 2 in the distribution.
What bothers me with many J2EE Domain Models is the loss of OO (IMHO), because of difficulty with good O/R mapping? Domain Models often look like views into the database, which seems to me to be the case here. Classes need to get back their first class status, too often they are relegated to getter setter second class citizens.
Looking at the Domain Model classes and code where is the Order class. Having OrdersImpl.java doesn't seem right. Orders should preferably just be a collection of Order. What about an addOrder(Order order) method on AccountImpl.java. Account can then do some Domain rule checking before adding the new Order to the collection of orders.
In this case, the demo was consciously trying to keep to the table "shapes" from the original Java Pet Store demo.
You're right that the "Orders" entity object should have been named just "Order". That went unnoticed.
Account does have a collection of related orders called "Orders" (accessor method getOrders()) which returns an iterator to the collection of related "Orders" entity object instances. With your suggested renaming, it would return an iterator to the collection of related "Order" instances. And I agree that would sound better name wise.
BC4J also fully supports the use of Java inheritance and automatically manages the storage of family hierarchies into a single table using a discriminator column. This allows us to support very easy polymorphic queries as well, which return objects of different entity types from a query.
We have been using Struts as the Framework for most of our clients. It will be really intresting to see that if JDeveloper provides coding ease like IntelliJ has for Scriptlets & TLD's. In any case the JDev IDE looks very promising and powerfull.
JDeveloper does offer extensive context-senstive "code insight" and "tag insight" for on-the-fly syntax help for Java code, JSP and HTML tags, JSP Tag library tag and attributes, and XML-Schema-driven tag insight for any XML file based on an XML Schema.
I tried the toy store example on JDeveloper this after. The "new user registration" function does not work. I am not sure if it is my fault.
I've heard back from many users that the demo works for them, so we'll need to look into your specific case. Please post a question in the Oracle Technet JDeveloper discussion forum explaining what doesn't work about it, and then email me the URL to your Forum posting so I can investigate and answer the question in the public forum so others can benefit by the answer, too.
You can visit the JDev discussion forum at this URL:
I posted my problem in that forum, but got no response. Maybe posting here can get some help. Below is the Error I got:
500 Internal Server Error
java.lang.NoSuchMethodError: void oracle.jbo.Row.setNewRowState(byte)
org.apache.struts.action.ActionForward oracle.jbo.html.struts11.actions.EditAction.create(org.apache.struts.action.ActionMapping, org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
org.apache.struts.action.ActionForward toystore.controller.strutsactions.RegisterAction.execute(org.apache.struts.action.ActionMapping, org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
org.apache.struts.action.ActionForward org.apache.struts.action.RequestProcessor.processActionPerform(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, org.apache.struts.action.Action, org.apache.struts.action.ActionForm, org.apache.struts.action.ActionMapping)
void org.apache.struts.action.RequestProcessor.process(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
void org.apache.struts.action.ActionServlet.process(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
void org.apache.struts.action.ActionServlet.doGet(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
void javax.servlet.http.HttpServlet.service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
void javax.servlet.http.HttpServlet.service(javax.servlet.ServletRequest, javax.servlet.ServletResponse)
void com.evermind[Oracle9iAS (22.214.171.124.0) Containers for J2EE].server.http.ServletRequestDispatcher.invoke(javax.servlet.ServletRequest, javax.servlet.ServletResponse)
void com.evermind[Oracle9iAS (126.96.36.199.0) Containers for J2EE].server.http.ServletRequestDispatcher.forwardInternal(javax.servlet.ServletRequest, javax.servlet.http.HttpServletResponse)
boolean com.evermind[Oracle9iAS (188.8.131.52.0) Containers for J2EE].server.http.HttpRequestHandler.processRequest(com.evermind[Oracle9iAS (184.108.40.206.0) Containers for J2EE].server.ApplicationServerThread, com.evermind[Oracle9iAS (220.127.116.11.0) Containers for J2EE].server.http.EvermindHttpServletRequest, com.evermind[Oracle9iAS (18.104.22.168.0) Containers for J2EE].server.http.EvermindHttpServletResponse, java.io.InputStream, java.io.OutputStream, boolean)
void com.evermind[Oracle9iAS (22.214.171.124.0) Containers for J2EE].server.http.HttpRequestHandler.run(java.lang.Thread)
void com.evermind[Oracle9iAS (126.96.36.199.0) Containers for J2EE].server.http.HttpRequestHandler.run()
Check out the link http://radio.weblogs.com/0118231/
hope it helps.
I posted an answer to your question in the JDeveloper OTN Forum, and in case others might hit the same installation issue, I posted the solution on my "Dive into BC4J" weblog as well at:
I tried the toy store example on JDeveloper this afternoon. The "new user registration" function does not work. I am not sure if it is my fault.
I asked this question at the OTN forum last year and hope you don't mind me asking this again: what does it take to make BC4J an open source framework? Does Larry Ellison have to personally endorse it? Is Oracle thinking to make tons of money selling the framework, because it cannot sell Oracle9iAS and has to make up the revenue shortfall somewhat? It doesn't help when a framework is being used by 1000 projects internally by its vendor, while the rest of the developer community still sees BC4J as a proprietary product that targets one of their many problems (data persistence in this case), and I'm sure you know what proprietary is perceived as in the J2EE space today.
Frankly speaking, BC4J is not ready for any production for commercial internal project. I still regard BC4J as PL/SQL guy writes java in PL/SQL. Oracle need some real Java guy ... or they just write everything as PL/SQL.
conclusion: They know "OO" as "Ouch!Oracle..."
Correction: Frankly speaking, BC4J is not ready for any production for commercial *Internet* project.
Anyway, the bright side is internal/intranet prototype/admin project. I successfully utilized on internal admin project .... better than oracle form ... RAD ... easy to maintain if developer is not laid off ...
We've been steadily improving the framework since November 1999, before the J2EE community even invented fancy design pattern names for many of the features that we've implemented (and continued to improve) for years. :-)
Since you provide no specifics about what gives you the impression that BC4J is a "prototype tool", I cannot try to help you understand how this statement could not be farther than the truth. Hundreds of external customers (and over 50 internal app development teams) use it to build much more than prototypes. I help answer questions for these customers every day in the OTN JDeveloper forum.
I don't understand your PL/SQL comment. BC4J is 100% Java and designed for J2EE/Java developers. Everything you do we BC4J is either done declaratively via XML configuration descriptors, or done by writing Java methods that override framework lifecycle methods.
The fact that our framework let's you fully exploit SQL, is a feature that most developers end up having to write "fast-lane reader" pattern SQL clauses to do anyway. As my two BC4J whitepapers illustrate, all we do is provide you with a bunch of appliation infrastructure code that you won't have to write for yourself.
BC4J is not open source, but we do provide source for all of our client-side frameworks (JClient, JSP Data Tags, and BC4J/Struts integration). Any J2EE apps built with BC4J can work with any J2EE app server, and you can use BC4J to work with Oracle, SQL*Server, DB2, OracleLite, and other databases, too.
Many external customers use BC4J (as well as our own internal teams), and the framework's many of design pattern implementations and rich set of application-building features and tools reflect the experience of these users who have helped us continuously improve the framework since 1999 when we first went production. Customers are building both JSP and Swing apps (those web apps, both with and without Struts).
If your perception is that BC4J only targets persistence, then I'd encourage your to read of Simplify J2EE Development with the Oracle BC4J Framework
and Building a Web Store with Struts & BC4J Frameworks
which try to explain the full breadth of J2EE design patterns and application building features that we provide for you. Persistence is only a very small slice of what features are required to build real-world apps, and we go way beyond that for you.