I am in the process of redesigning our application. One of my design concerns is how best to handle read only data within EJB. The data that I need within my application maybe changes once a day. The data from database is basically read only. We currently have a home grown solution. We are looking for something that is more standard.
I know within EJB, there are entity beans that represent data in the database. But if the data does not change is this the best option to use?
I just want to make sure that I use what ever will provide my application with the best performance.
You have not explained the details of the project and the motivation to go for EJB's. Yes, you can configure the entity beans to be readonly or read-mostly depending upon ur requirements.
Ok, here are some details on my application, war and peace to follow. :)
My application is a web services back-end. We are taking in XML request from the web service call, parsing the XML, then calling SAP IPC based on the XML request to get configuration and pricing information. The configuration and pricing information is then formatted back into an XML and the returned to the client.
The main reason for wanting to go to EJB is our use of SAP IPC. Within SAP IPC there is a client/server mode and a stand-alone mode. I am currently using the client/server mode per Saps recommendation. The client/server mode had several problems with performance as well as usability. So I am looking into the converting my application to use SAP IPC stand-alone. The problem with stand-alone is it is just a java API. In order to load balance the application, I would have to create multi-instances of the application, which creates a whole set of other problems. Enter EJB. EJB offers a lot of the performance and scalability that I am looking for. I had hoped to encapsulate some of the SAP stand-alone APIs into a stateless session bean allowing to objects to be pooled. I was also looking at having my database layer handled by entity beans.
One of main pieces of my application is that when it initializes. It gets about 20 tables from an Oracle database and caches it into memory. This data is accessed a great deal by the application, so going back to the database each time isn't really practical. I was trying to find a standard way of having this data cached in memory. I was looking at entity beans as a possible solution. But I wondered if an entity bean is the best used for read only data.
Have you considered Read-Only concurrency feature WebLogic and other app servers offer, or use a 3rd party caching product? The caveat is that all of these are proprietary, as there is no spec for caching yet (JCache is years away, if they can ever agree with each other).
Entity beans are the best for read-only access. They are scalable and have tremendous performance gain over many other options.
"Entity beans are the best for read-only access." .. is not quite true !
What EBJ offers, generally speaking (regarding different application servers) is basically transactions, and this stuff has huge performance overheads (table locking etc). Furthermore read-only marking is not a part of the original spec. and therefore container implementation specific.
*** EJB's were made to access SINGLE units of data for ATOMIC operations. ***
It seems that none of the requirements for EJB use are present.