Lookup Data ( Readonly Entity Bean)
My application has a requirement for multiple lookup data ( asset types ,
broker types ) with code and description. The lookup data is fairly static
and only updated through an external source.Can I use a read only BMP Entity
EJB. The primary key will be the lookup type.
Is this a good pattern or are any other efficient ways to achieve the same
thing.
John.
That fits quite well into what ReadOnly entity beans are designed for.
Charles
"John" <[email protected]> wrote:
My application has a requirement for multiple lookup data ( asset types
broker types ) with code and description. The lookup data is fairly static
and only updated through an external source.Can I use a read only BMP
Entity
EJB. The primary key will be the lookup type.
Is this a good pattern or are any other efficient ways to achieve the
same
thing.
John.
Similar Messages
-
How to handle multiple tables data in Entity Beans?
How to handle multiple tables data in Entity Beans?
i mean, my bean (non trivial) is responsible for frequent
insertion in one table and some deletion on another table.
Can anyone of you...please..?Is your data model right? If you are adding in one and deleting in another it sounds to me more like a process that an entity, in which case you may revisit your data model and simplify it, add in a session bean with the process method to co-ordinate between the two.
However, if you want to map multiple different tables within a single entity bean it is possible and just part of the mapping. How you actualyl specify it depends on which implementation you are working with.
Cheers,
Peter. -
Hello,
I am performing some tests concerning the benefit of caching data with Entity Bean.
Here is the case :
I have an Entity Bean with a business method getName() to retrieve a name field in the EJB.
I understand that in order to cach data, I have to set the NOT_SUPPORTED transaction attr for this method. In this way, when this method is called, the ejbReload() is not called and the data is retreived from the EJB ready instance (and not from the database).
Is it true and is it the good way to use the cach mechanism ?
Now if we consider that this instance is the only one in the ready stage, and it is never pooled (it seems so !), what about a modification of the database from a tier (or from an other EB instance)? The Entity Bean is not able to see this modification seence it does not call the ejbLoad method.
Is there a way to force an Entity Bean to be periodically polled in order to recover data from the data store when activated ?
Thanks in advance,
ThierryNo, This is wrong way of doing what you want. Most of the application servers provide various configuration settings for this. Eg. caching mechanism, interval on when to call ejbLoad and ejbStore, read only beans. You have to check the documentation for this.
--Ashwani -
Retrieve data from entity bean to struts and display in JSP
I am integrating Struts+EJB3.0.
Now i need to retrieve data stored in mysql database through entity bean to struts framework*(Action Form*).Then i need to display it in JSP page.(display using combo box).
Please Any one give suggestions!!!!!
Thanks in advanceI got the solution.
--Jagan.+ -
Using JODA Date in Entity Bean
We are planning to use JODA open source in our project which is actually a replacement for Java Calendar and Date. Like to know how can we map the JODA Datetime to date columns in the table. Refer the link http://edocs.bea.com/wls/docs60/ejb/cmp.html for the supported data types. Is there any server specific extension available to support new data types.
If not, we should still use util.Date in the entity bean but expose as DateTime outside. We'll do the conversion between util.Date and DateTime in the entity bean since we don't want to expose java.util.Date outside teh entity bean.
But this restriction will fail for finder queries implemented through EJB QL unless the servic emethid calling the finder do the conversion to util.Date before calling. Is there a clean way to use JODA DateTime in Entity BeanEJB doesn't support identity field. EJB expects you set primary key values explicitly. There is a well known pattern that makes use of a session bean to generate entity bean primary key. Your best option is to use BMP or give up auto increment identity fields.
-
Re: ReadOnly Entity Bean
Hi all,
I am trying to write a Read Only Entity bean which gets loaded once in the cache
and then the container refreshes it every x seconds.
Has anyone come across any example how to do this. That would really help.
Thanks...KevinRTFM http://e-docs.bea.com/wls/docs70/////ejb/reference.html#1139340 :
"ReadOnly used for read-only entity beans. Activates a new instance for each
transaction so that requests proceed in parallel. WebLogic Server calls
ejbLoad() for ReadOnly beans are based on the read-timeout-seconds
parameter."
In weblogic-ejb-jar.xml:
<concurrency-strategy>ReadOnly</concurrency-strategy>
<read-timeout-seconds>x</read-timeout-seconds>
Michael Jouravlev
"KW" <[email protected]> wrote in message
news:3cee3f67$[email protected]..
>
Hi all,
I am trying to write a Read Only Entity bean which gets loaded once in thecache
and then the container refreshes it every x seconds.
Has anyone come across any example how to do this. That would really help.
Thanks...Kevin -
Using a BLOB data type in a CMP Entity Bean??
Hi all,
i am trying to store blob type data using entity bean, The corresponding field in the Entity bean is defined with data type byte[ ] , and i'm getting error while creating entity bean, could anyone please help me!
This is the error:
[6/7/06 11:19:05:559 EEST] 5b7936b5 ExceptionUtil E CNTR0019E: Non-application exception occurred while processing method "create". Exception data: com.ibm.ejs.container.CreateFailureException: ; nested exception is:
javax.ejb.EJBException: nested exception is: com.ibm.ws.ejbpersistence.utilpm.PersistenceManagerException: PMGR6022E: Error using adapter to create or execute an Interaction. com.ibm.ws.rsadapter.cci.WSInteractionImpl@6593f6a7
javax.ejb.EJBException: nested exception is: com.ibm.ws.ejbpersistence.utilpm.PersistenceManagerException: PMGR6022E: Error using adapter to create or execute an Interaction. com.ibm.ws.rsadapter.cci.WSInteractionImpl@6593f6a7
com.ibm.ws.ejbpersistence.utilpm.PersistenceManagerException: PMGR6022E: Error using adapter to create or execute an Interaction. com.ibm.ws.rsadapter.cci.WSInteractionImpl@6593f6a7
at com.ibm.ws.ejbpersistence.dataaccess.DataAccessRequestImpl.execute(Unknown Source)
at com.ibm.ws.ejbpersistence.beanextensions.ConcreteBeanStatefulInstanceExtensionImpl.executeCreate(Unknown Source)
at com.ibm.ws.ejbpersistence.beanextensions.CBNotExistState.ejbCreate(Unknown Source)
at com.ibm.ws.ejbpersistence.beanextensions.ConcreteBeanStatefulInstanceExtensionImpl.ejbPostCreate(Unknown Source)
at org.epo.dg3.task.ConcreteDocStore_5418fe50.ejbPostCreate(ConcreteDocStore_5418fe50.java:133)
at org.epo.dg3.task.EJSCMPDocStoreHomeBean_5418fe50.create_Local(EJSCMPDocStoreHomeBean_5418fe50.java:29)
at org.epo.dg3.task.EJSLocalCMPDocStoreHome_5418fe50.create(EJSLocalCMPDocStoreHome_5418fe50.java:23)
at java.lang.reflect.Method.invoke(Native Method)
at com.ibm.etools.utc.model.ReflectionMethodModel.invoke(ReflectionMethodModel.java:68)Try to use the OCI native driver instead of THIN.
-
NON-transactional session bean access entity bean
We are currently profiling our product using Borland OptmizeIt tool, and we
found some interesting issues. Due to our design, we have many session beans which
are non transactional, and these session beans will access entity beans to do
the reading operations, such as getWeight, getRate, since it's read only, there
is no need to do transaction commit stuff which really takes time, this could
be seen through the profile. I know weblogic support readonly entity bean, but
it seems that it only has benefit on ejbLoad call, my test program shows that
weblogic still creates local transaction even I specified it as transaction not
supported, and Transaction.commit() will always be called in postInvoke(), from
the profile, we got that for a single method call, such as getRate(), 80% time
spent on postInvoke(), any suggestion on this? BTW, most of our entity beans are
using Exclusive lock, that's the reason that we use non-transactional session
bean to avoid dead lock problem.
ThanksSlava,
Thanks for the link, actually I read it before, and following is what I extracted
it from the doc:
<weblogic-doc>
Do not set db-is-shared to "false" if you set the entity bean's concurrency
strategy to the "Database" option. If you do, WebLogic Server will ignore the
db-is-shared setting.
</weblogic-doc>
Thanks
"Slava Imeshev" <[email protected]> wrote:
Hi Jinsong,
You may want to read this to get more detailed explanation
on db-is-shared (cache-between-transactions for 7.0):
http://e-docs.bea.com/wls/docs61/ejb/EJB_environment.html#1127563
Let me know if you have any questions.
Regards,
Slava Imeshev
"Jinsong HU" <[email protected]> wrote in message
news:[email protected]...
Thanks.
But it's still not clear to me in db-is-shared setting, if I specifiedentity
lock as database lock, I assumed db-is-shared is useless, because foreach
new
transaction, entity bean will reload data anyway. Correct me if I amwrong.
Jinsong
"Slava Imeshev" <[email protected]> wrote:
Jinsong,
See my answers inline.
"Jinsong Hu" <[email protected]> wrote in message
news:[email protected]...
Hi Slava,
Thanks for your reply, actually, I agree with you, we need to
review
our db
schema and seperate business logic to avoid db lock. I can not say,guys,
we need
to change this and that, since it's a big application and developedsince
EJB1.0
spec, I think they are afraid to do such a big change.Total rewrite is the worst thing that can happen to an app. The
better aproach would be identifying the most critical piece and
make a surgery on it.
Following are questions in my mind:
(1) I think there should be many companies using weblogic serverto
develop
large enterprise applications, I am just wondering what's the maintransaction/lock
mechanism that is used? Transional session / database lock,
db-is-shared
entity
I can't say for the whole community, as for my experience the standard
usage patthern is session fasades calling Entity EJBs while having
Required TX attribute plus plain transacted JDBC calls for bulk
reads or inserts.
is the dominant one? It seems that if you speficy database lock,
the
db-is-shared
should be true, right?Basically it's not true. One will need db-is-shared only if thereare
changes
to the database done from outside of the app server.
(2) For RO bean, if I specify read-idle-timeout to 0, it shouldonly
load
once at the first use time, right?I assume read-timeout-seconds was meant. That's right, but if
an application constantly reads new RO data, RO beans will be
constantly dropped from cache and new ones will be loaded.
You may want to looks at server console to see if there's a lot
of passivation for RO beans.
(3) For clustering part, have anyone use it in real enterpriseapplication?
My concern, since database lock is the only way to choose, how aboutthe
affect
of ejbLoad to performance, since most transactions are short live,if high
volume
transactions are in processing, I am just scared to death about
the
ejbLoad overhead.
ejbLoad is a part of bean's lifecycle, how would you be scared ofit?
If ejbLoads take too much time, it could be a good idea to profile
used SQLs. Right index optimization can make huge difference.
Also you may want cosider using CMP beans to let weblogic
take care about load optimization.
(4) If using Optimization lock, all the ejbStore need to do
version
check
or timestamp check, right? How about this overhead?As for optimistic concurrency, it performs quite well as you can
use lighter isolation levels.
HTH,
Slava Imeshev
"Jinsong Hu" <[email protected]> wrote in message
news:[email protected]...
We are using Exclusive Lock for entity bean, because of we do
not
want
to
load
data in each new transaction. If we use Database lock, that means
we
dedicate
data access calls to database, if database deadlock happens,
it's
hard
to
detect,
while using Exclusive lock, we could detect this dead lock in
container
level.
The problem is, using Exclusive concurrency mode you serialize
access to data represented by the bean. This aproach has negative
effect on ablity of application to process concurrent requests.As
a
result the app may have performance problems under load.
Actually, at the beginnning, we did use database lock and usingtransactional
The fact that you had database deadlocking issues tells that
application logic / database schema may need some review.
Normally to avoid deadlocking it's good to group database
operations mixing in updattes and inserts into one place so
that db locking sequence is not spreaded in time. Moving to
forced serialized data access just hides design/implementation
problems.
session bean, but the database dead lock and frequent ejbLoad
really
kill
us,
so we decided to move to use Exclusive lock and to avoid dead
lock,
we
change
some session bean to non-transactional.Making session beans non-transactions makes container
creating short-living transactions for each call to entity bean
methods. It's a costly process and it puts additional load to
both container and database.
We could use ReadOnly lock for some entity beans, but since weblogicserver will
always create local transaction for entity bean, and we found
transaction
commit
is expensive, I am arguing why do we need create container leveltransaction for
read only bean.First, read-only beans still need to load data. Also, you may seeRO
beans
contanly loading data if db-is-shared set to true. Other reason
can
be
that
RO semantics is not applicable the data presented by RO bean (forinstance,
you have a reporting engine that constantly produces "RO" data,
while
application-consumer of that data retrieves only new data and neverasks
for "old" data). RO beans are good when there is a relatively stable
data
accessed repeatedly for read only access.
You may want to tell us more about your app, we may be of help.
Regards,
Slava Imeshev
I will post the performance data, let's see how costful
transaction.commit
is.
"Cameron Purdy" <[email protected]> wrote:
We are currently profiling our product using Borland
OptmizeIt
tool,
and we
found some interesting issues. Due to our design, we have
many
session
beans which
are non transactional, and these session beans will access
entity
beans
to
do
the reading operations, such as getWeight, getRate, since
it's
read
only,
there
is no need to do transaction commit stuff which really takes
time,
this
could
be seen through the profile. I know weblogic support readonly
entity
bean,
but
it seems that it only has benefit on ejbLoad call, my test
program
shows
that
weblogic still creates local transaction even I specified
it
as
transaction not
supported, and Transaction.commit() will always be called
in
postInvoke(),
from
the profile, we got that for a single method call, such as
getRate(),
80%
time
spent on postInvoke(), any suggestion on this? BTW, most of
our
entity
beans are
using Exclusive lock, that's the reason that we use
non-transactional
session
bean to avoid dead lock problem.I am worried that you have made some decisions based on an improper
understand of what WebLogic is doing.
First, you say "non transactional", but from your description
you
should
have those marked as tx REQUIRED to avoid multiple transactions
(since
non-transactional just means that the database operation becomesits
own
little transaction).
Second, you say you are using exclusive lock, which you shouldonly
use
if
you are absolutely sure that you need it, (and note that it
does
not
work in
a cluster).
Peace,
Cameron Purdy
Tangosol, Inc.
http://www.tangosol.com/coherence.jsp
Tangosol Coherence: Clustered Replicated Cache for Weblogic
"Jinsong Hu" <[email protected]> wrote in message
news:[email protected]...
> -
Entity beans and data synchronization
I want to use a BMP to represent information about a database entity where the BMP "fields" are actually statistical summaries (e.g., an Account bean where the "field" num_transactions is calculated using a query rather than stored). I want to do this because the queries that generate the summary statistics are costly and I want to cache the results in memory. Since these are "read-only" statistics, I could use DAOs and a Fast Track Reader but I want to make use of the caching and lookup facilities of J2EE for finding accounts that are already cached.
I only refresh the back end database nightly, so I need to flush all of the values in all cached Account beans nightly. Is there a facility for this type of thing, or do I need to manually control it (e.g., using a "version" number on the data that is checked periodically).
Thx,
John H.John,
You might also check your application server's documentation. Weblogic provides a read-only entity bean, whereby you can specify a timeout parameter in your descriptor file. The container will then only call ejbLoad() when the ejb is accessed and the timeout has been passed. This, in effect, provides a caching mechanism.
Best of luck,
Richard -
How to load the existing data from the databse in the CMP entity bean?
hello
my problem is as follows--
i am creating a CMP entity bean.in these beans client create the data instances using create() function.
now a entity bean will be created for the newly created data and it's EJBObject will also be formed.
now we will be able to perform finder methods over them.
remember these data has been newly created in the database.
but now if i want to perform the finder methods on the
existing data in the database( i don't need to use create() fn as i am not "creating" the data.). how will i perform the query over the existing data.
basically i have to make a CMP bean to extract the data corresponding to a particular condition , from the database table. i don't want to create the data in the database but just find out what data satisfies my condition.
thanking you
Prashantyou have to use findByXXX methods. depending on your appserver you may have to declare them (and eventually the query you want to be used) in the vendor specific deploiement descriptor.
(e.g. using jboss i don't remember having explicitly declare the findBySomeField method - where someField is a persistent field - in the dd, whereas with bas all finder methods have to be explicitly declared)
[note that obviously these methods have to be present in your home interface] -
Insert data into table from JSP page using Entity Beans(EJB 3.0)
I want to insert data into a database table from JSP page using Entity Beans(EJB 3.0).
1. I have a table 'FRIENDS', (in Oracle 10g database).
2. It has two columns, 'NAME' and 'CITY'. Both have datatype strings(varchar2).
3. Now from a JSP page, having two textfields, 'NAME' and 'CITY', I want to insert data into table 'FRIENDS'.
4. In between JSP and database is a Entity Bean(EJB 3.0) and a stateless session bean.
5. I am using JDev as editor.
Please provide me code ASAP or link with similar example.
Thank you.
AnuragHi,
I am also trying that scenario. So u can
Post the jsp form data to a Servlet which will act as a Controller.
In the servlet invoke the business method.
Similar kind of app is in www.roseindia.net
Hope this would help u.
Meanwhile if u get any optimal solution, pls post it.
Thanks,
Happy Java Coding. -
Urgent: Can't lookup entity bean
Dear all,
I define a business process in workflow engine, which invoke a java class to get
DB data through CMP entity bean. The entity bean was packed in to a ear and was
workable/callable within the same ear.
However, when the workflow engine can't invoke the entity bean, the workflow engine
always throw exception as following.
javax.naming.LinkException: . Root exception is javax.naming.NameNotFoundException:
Unable to resolve 'app/ejb/ConsignmentEntityBean.jar#Consignments/local-home'
Resolved: 'app/ejb' Unresolved:'ConsignmentEntityBean.jar#Consignments' ; remaining
name 'ConsignmentEntityBean.jar#Consignments/local-home'
I think the problem may occur in deployment/configuration. Since the problem is
very urgent, anyone can help me? To all developers, How do you package/deploy
Entity Bean in Integration Server?
Thx,
PhilipI solved this.
Since I was testing the action code only, I didn't define a navigation entry corresponding to the action string returned for this button:
<h:commandButton value="Add" style="height:21px; width:51px;font-size:8pt; font-color: black;" action="#{resourceBean.addAction}">
</h:commandButton>After I added a nav definition, it worked. I don't know why at this point. I suspect a key step in the lifecycle was pre-empted...someone else can probably explain why. If I get a chance to research it after I'm done with my project, I'll update this post.
Thanks.
-L -
How to Enter the existing data in the entity beans?
hello
my problem is as follows--
i am creating a CMP entity bean.in these beans client create the data instances using create() function.
now a entity bean will be created for the newly created data and it's EJBObject will also be formed.
now we will be able to perform finder methods over them.
remember these data has been newly created in the database.
but now if i want to perform the finder methods on the
existing data in the database( i don't need to use create() fn as i am not "creating" the data.). how will i perform the query over the existing data.
basically i have to make a CMP bean to extract the data corresponding to a particular condition , from the database table. i don't want to create the data in the database but just find out what data satisfies my condition.
thanking you
PrashantAll I say here is based on limited knowledge on 1.1 ejb specification. There could be improvements on 2.0 spec. 1.1 specification does not formaly provide how the finders should work for container managed beans. It leaves it at the hand of bean providers. Currently bean providers describes the finers in a description of the Entity Bean. Refer to documentation accompanied with application server you are using.
I attach the famous bank account example in weblogic server.
<finder-list>
<finder>
<method-name>findBigAccounts</method-name>
<method-params>
<method-param>double</method-param>
</method-params>
<finder-query><![CDATA[(> balance $0)]]></finder-query>
</finder>
</finder-list>
Method definition in Home inteface is
public Enumeration findBigAccounts(double balanceGreaterThan)
throws FinderException, RemoteException; -
JDBC or Entity Beans for Read-Only Data?
Entity beans are way to slow on pulling the amount of data I need. What are the cons of just using JDBC? Is this bad programming?
One query pulls about 700 rows from 6 different tables taking up to 20 seconds. The same call using JDBC takes 2 seconds. What is the proper thing to do?One query pulls about 700 rows from 6 different
tables taking up to 20 seconds. The same call using
JDBC takes 2 seconds. What is the proper thing to do?JDBC. Entity beans are not really suited for data across multiple tables. This can be best done with plain SQL +JDBC. -
Data caching without entity beans
This may be a basic question :
We have an app with session beans invoked by MDBs via non-web clients. No Entity Beans.
I want to cache sql query results in a hashmap. What is the best way to do it?
Create a pojo singleton with the hashmap and reference that in the session beans?
Is there any j2ee container consideration in this?
Is there a better way to do it?
thanksHi Gilbert,
Someone recently asked a similar question to yours. Perhaps that thread will
be helpful to you?
Author: Valeri Kireitchik
Subject: how to set exclusive-write-access="true"
Date: May 17, 2002 10:18 PT
URL:
Re: Get the Table name by providing the Sequence name
The same person (Valeri) also asked his question on two other forums:
http://www.elephantwalker.com/rfa?id=549
http://www.mail-archive.com/orion-interest%40orionserver.com/msg19037.html
Good Luck,
Avi.
Maybe you are looking for
-
Log file in session and call transaction methods
Hi Experts, How to see log file in session and call transaction methods?
-
How can I sort and summarize a flatfile
Hello, I have a question about sorting and summarizing in a file to Idoc scenario. The scenario is as follows. Flat file to Idoc conversion (invoic) Simple flat file structure (1 recordtype) Each record = 1 invoice item In a record are both header an
-
Re: Not Able to Create database objects(Tables, etc) in Oracle 12c
In addition to what Nishant said, the PDB databases are not opened by default. You must open them manually or create a trigger to do it.
-
I am having some trouble getting an image to be a hyperlink with the image and hyperlink component. <a href="lastpage.htm"> <img border="0" src="buttonnext.gif" width="65" height="38"> </a>Can this be done with the jsf components?
-
Driver alias Warning for "pci103c,3355"
On Solaris 10 with latest patch level SunOS host1 5.10 Generic_148889-02 i86pc i386 i86pc I have the following Warning in mesd Mar 22 18:04:42 host1 genunix: [ID 723599 kern.warning] WARNING: Driver alias "pci103c,3355" conflicts with an existing dri