Nice document.

FYI - recently the Hypersonic SQL download was changed to include a
hsql.jar, which you can place in the \orion\lib\ dir as noted by Dan. 

However the hsql JDBC driver class has been renamed to
org.hsql.jdbcDriver, so you will need to use this in the
data-sources.xml if you download the latest hsql.



> -----Original Message-----
> From: Dan A [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, 2 February 2000 6:48 AM
> To: Orion-Interest
> Subject: EJB news-app How-to
> 
> 
> 
> These are the steps that I took in order to get the 
> "news-app" EJB working 
> on Orion 8.2, with JDK1.2.  It is just a matter of making 
> sure all the 
> necessary steps have been completed, which is not always an 
> easy task.  
> Hopefully this document will help - let me know if there are 
> any questions.  
> This is not a tutorial, so it won't contain any code.
> 
>                Getting the news-app EJB working
> 
> First of all, you need to have a database for your entity 
> Beans.  For the 
> news-app example, you can use the Hypersonic Database at
> http://www.lynx.ch/Contacts/~/ThomasM/hypersql.html.  Download the
> hsql.zip file and unzip it in the orion directory, and make 
> sure that the 
> directory structure of hsql/hDriver.class (found in 
> hypersonic/demo) is in 
> the orion classpath, such as c:\orion or c:\orion\lib.  When this is 
> complete, you can proceed with the following steps of 
> deploying the news-app 
> EJB.
> 
> 1) Add a valid data-source to config/data-sources.xml and uncomment
> the helper datasources in the same file:
> Make sure your data-source looks like this, and uncomment the 
> rest of the 
> file:
> 
> <data-source class="com.evermind.sql.ConnectionDataSource"
> location="jdbc/DefaultDS">
>       <name>Default data-source</name>
>       <description>
>               Hypersonic SQL source.
>       </description>
>       <url>jdbc:HypersonicSQL:defaultdb</url>
>       <connection-driver>hSql.hDriver</connection-driver>
>       <username>sa</username>
>       <password></password>
> </data-source>
> 
> 2) Make sure the <ejb-config> and <rmi-config> tags are 
> uncommented in 
> config/server.xml.
> 4)  Close the comment on line 16 of config/server.xml: <!-- 
> RMI-server 
> config link, uncomment to activate the RMI service - (if it 
> is not already 
> closed.)
> 5) Install the EJB: this is done by uncommenting the 
> <ejb-jar> entry in 
> config.xml/ejb.xml that is used for the news-app.
> 6) Uncomment the <web-app> tag to the news-app in
> c:\orion\default-site\web-site.xml, so you can run the EJB with JSP.
> 7)  Remove the status="deactivated" parameters from 
> config/principals.xml.
> (If you get a mysterious login page in the demos, it refers to these
> <user> entries)
> 8) Restart Orion to auto-deploy the EJB.
> 
> *Note: The first time your entity Bean is deployed, which is also the 
> creation of the database, you should see some server output 
> like this, which 
> shows confirmation of the deployed EJB, and the name of the DB table:
> 
> C:\orion>java -jar orion.jar
> Auto-deploying file:/C:/orion/demo/news-app/news-ejb/...
> Auto-creating table: create table com_evermind_ejb_NewsItem 
> (id INTEGER 
> primarykey, subject VARCHAR (255), text VARCHAR (255), date 
> TIMESTAMP, 
> submitter VARCHAR (255), locale VARCHAR (5))
> done.
> Orion/0.8.2 initialized
> 
> 
> After the Entity Bean is deployed, we can now access it.
> 
> 1) A good way to see what's going on is to access the EJB by going to
> C:\orion\demo\news-app\news-ejb\com\evermind\ejb and run the 
> NewsItemClient 
> (java com.evermind.ejb.NewsItemClient).  Also, make sure that 
> c:\orion\demo\news-app\news-ejb is in your classpath.  This 
> client will ask 
> the user for input items that will be used in an ejbCreate() 
> method, which 
> will map those entity Bean values to persistent records in a 
> database (you 
> can verify this later).
> 2) After running the client, you now have used an Entity Bean 
> to map data 
> into a database, making it persistent, and now that data is available 
> anywhere at anytime, and should be at no risk of being lost 
> or corrupted 
> thru EJB.
> 3) Now go to http://localhost:2000/news/border.html, and 
> select the "view" 
> hyperlink, which will take you to 
> http://localhost:2000/news/news.jsp, which 
> is essentially displaying all data in the database to you, by 
> calling an EJB 
> findAll().
> 4) If you just want to see the generic raw data in the database, the 
> database is written to the file system in c:\orion\defaultdb, 
> so you can use 
> Hypersonic's DatabaseManager tool (Java application) to run 
> simple select 
> statements to query the database whether the Orion 
> application server is 
> running or not, just to show you that your data is in the database.
> 
> And that's it - you have now seen how data is persisted with 
> Enterprise Java 
> Beans, which shows the power of EJB, and the power of the EJB 
> Server, Orion.
> From here, you should be able to now create your own entity 
> Beans and use 
> your own database to productively use EJB.
> 
> ______________________________________________________
> Get Your Private, Free Email at http://www.hotmail.com
> 
> 

Reply via email to