Session EJB vs ENtity EJB
Why/When would you use Session EJB instead of Entity EJB to access Database values
You might use a Session Bean to access the database when you didn't want the overhead of Entity Beans or if the data you were retrieving didn't relate to the entity structure easily.
Have a look at the Fast Lane Reader pattern in the J2EE Design Patterns section to get more information about an example. Here the data is only being read and presented to the user so support for updating the values, security and concurrency isn't needed and is purely overhead.
Hope this helps.
Similar Messages
-
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]...
> -
How a stateful session ejb invoke an entity ejb
i have write a stateful session ejb and an entity ejb
i want to invoke the method of the entity ejb in the session ejb.
Do they should in the save package,and archive to a jar package?
Thanks:)the choice is yours
It not necessary that they shoule be in the same package
Work both ways
You make a call to it in the same way as you call it from a client
i.e. to say that an EJB can invoke another in the same way as a client invoke it...make the home object et.al
Regards
Sanjay -
How to use the same Entity EJB to access the same table in 2 syb databases
We are trying to convert an application to J2EE. We have the following
concern. The application requires the use of 10 sybase databases with
identical tables. One database per branch. We would like to be able to use the same set of entity EJBs to access all databases.
One solution we can think of is to use bmp entity beans and have a dispatcher session bean pass the database that the entity bean has to connect to.
Would it work?
Is there a more elegant way to do this?I don't know if there is a more elegant way to do it, but that will work. I have a similar scenario, one database per customer. You'll have to use BMP and get your connections based on the branch.
Each one of my DAO methods requires that a customer ID be passed in for each method. The customer ID is part of the primary key for each entity bean; therefore, if I need to find a deposit (entity) for a customer, I pass the customer ID and deposit ID to my session facade, create the PK using these, do a findByPrimaryKey, etc. In the ejbLoad, I use the customer ID and the deposit ID to pass into the DAO. There, another class (ConnectionFactory) returns a proper connection based on the customer ID passed, which I use to do my queries.
Paul -
Clustering read-only bean-managed entity ejbs
I'm designing a data caching approach that relies on using read-only entity ejbs with bean-managed persistence. My design is based on the fact that WebLogic blocks on entity bean access by concurrent users for a given bean instance (unique primary key). I would like to keep only one entity bean instance active(timeoutSetting=0) for eacy primary key for all users to share. That way I only have to hit the database one time to initially populate data in the entity bean. I'm worried about this approach in a WebLogic clustered environment. From reading notes in this newsgroup and other doc, it appears that WebLogic might not use one instance of the entity bean (based upon unique primary key) in a clustered environment. Is that true (that being multiple users could get their own instance of the entity bean with the same primary key)?
Thanks,
Bryan
Typically, the read-write EJBs are on each WL server instance, so there is
no remote invocation -- it is all done by reference.
Cameron Purdy
Tangosol, Inc.
http://www.tangosol.com
+1.617.623.5782
WebLogic Consulting Available
"Bryan Dixon" <[email protected]> wrote in message
news:[email protected]...
>
> I guess I'm confused about read-write (not read-only) entity beans being
pinned or not. This is from WebLogic 5.1 EJB doc:
> "read-write entity EJBs do not use a clustered EJBObject stub; a client's
method calls to a particular EJB always go to a single WebLogic Server
instance. If the server that a client is using fails, the client must
re-find the entity EJB using the cluster-aware home stub."
>
> Doesn't that mean the entity bean instance for a primary key is pinned to
a single WebLogic Server instance? Maybe I'm just misunderstanding
terminology about what a "particular EJB" is - I was thinking it is an
entity bean instance for a unique primary key.
>
> Thanks,
> Bryan
>
>
> "Cameron Purdy" <[email protected]> wrote:
> >>I was thinking that read-write entity beans were pinned.
> >
> >Not unless you pin them. Basically, that means that the JAR/XML that
> >contains/specifies the EJB only is on one server.
> >
> >> So if two separate weblogic instances in a cluster did a find on an
entity
> >ejb with the same primary key and then performed some business method on
> >that entity ejb, would there really be two separate bean instances in
each
> >weblogic instance for the same primary key?
> >
> >If it is not pinned, yes.
> >
> >--
> >Cameron Purdy
> >Tangosol, Inc.
> >http://www.tangosol.com
> >+1.617.623.5782
> >WebLogic Consulting Available
> >
> >
> >"Bryan Dixon" <[email protected]> wrote in message
> >news:[email protected]...
> >>
> >> Toa, thanks again.
> >>
> >> There are a couple of things I'm not clear about though. One is that I
> >want one instance of an entity bean per primary key, not a singleton of
the
> >entity bean itself. How would JNDI in a clustered environment help me
> >there?
> >>
> >> The other question I have is about having multiple instances of an
entity
> >bean for the same primary key in the cluster. I was thinking that
> >read-write entity beans were pinned. So if two separate weblogic
instances
> >in a cluster did a find on an entity ejb with the same primary key and
then
> >performed some business method on that entity ejb, would there really be
two
> >separate bean instances in each weblogic instance for the same primary
key?
> >>
> >> Thanks again,
> >> Bryan
> >>
> >> "Tao Zhang" <[email protected]> wrote:
> >> >
> >> >"Bryan Dixon" <[email protected]> wrote:
> >> >>
> >> >>The reason I was wanting one instance per primary key is that I want
to
> >use this entity bean to cache some data from database tables. This data
> >doesn't change frequently, so we were wanting to get it from this entity
> >bean's memory instead of constantly hitting the database. This data is
> >global to all users, so we don't want to store it in stateful session
beans.
> >> >>
> >> >>After reading more about the read-only cache-strategy it doesn't
appear
> >that any sycnhronization will occur if the entity bean for a given
primary
> >key is updated (state data is updated) in one weblogic instance, that
change
> >will not get synced up with other weblogic instances for that same
primary
> >key. Is that correct?
> >> >>
> >> >It's correct. If you do want to have exact one copy in the cluster.
You
> >can read Using JNDI in cluster environment.
> >> >
> >> >>If I deploy this entity bean with read-write cache-strategy the
WebLogic
> >doc reads as if I will get one instance per primary key that is pinned to
> >one WebLogic instance and I won't get any fail-over or load-balancing on
the
> >ejbObject (the entity bean instance). Did I read this correctly? If
that
> >is the case, what is the advantage of setting up read-write entity beans
to
> >be clusterable - just the Home objects? I definitely could be
> >misunderstanding something in the doc since I'm very new to clustering.
> >> "Tao
> >> >Zhang"
> >> ><[email protected]> wrote:
> >> >>>
> >> >
> >> >It's not only instance in the cluster. Probably many instances.
> >> >
> >> >If you use 2 tier clustering, failover will not happen because of
> >co-location. But if you use 3 tier cluster, you can write the special
code
> >in the client side to do failover and load-balance.
> >> >
> >> >In a 2 tier cluster, actually the ejb load balancing and failover is
> >almost useless.
> >> >
> >> >But in 3 tier, you can use it.
> >> >
> >> >Hope this help.
> >> >
> >> >
> >> >
> >> >>>"Bryan Dixon" <[email protected]> wrote:
> >> >>>>
> >> >>>>Thanks Tao.
> >> >>>>
> >> >>>>A couple more questions...
> >> >>>>I was planning deploying this entity bean with the read-only
> >cache-strategy which means our transaction attribute would be
> >TXN_NOT_SUPPORTED. Also, our db isolation is TRANSACTION_READ_COMMITTED.
> >> >>>>
> >> >>>>Based upon how I was planning on deploying this entity bean, would
> >WebLogic create an instance of the bean for each primary key in each
> >cluster? I'm just trying to figure out how many duplicate bean instances
> >for the primary key I could have across all clusters. I was really just
> >wanting one instance that is shared among all clients and was hoping that
> >the clustering would provide me with fail-over if that one cluster went
> >down.
> >> >>>>
> >> >>>If you use 3 tier cluster structure, it's impossible to know how
many
> >instances of ejb with the same primary key. Probably one instance for
each
> >wls instance.
> >> >>>In wls5.1, it's impossible to host only read only entity bean
instance
> >in the 3-tier cluster. Because read only entity bean are clusterable in
both
> >home and remote interface.
> >> >>>
> >> >>>>Regarding making the bean a pinned service, which it sounds like I
> >might have to do to get the results I want, how do I do that? Is that a
> >deployment descriptor setting? Also, if I make it a pinned service, do I
> >get any fail-over suport by clustering the bean?
> >> >>>>
> >> >>>For the pinned service, you can just deployed on one or several
server
> >instances. The per-server properties file is a good place to put the
> >weblogic.ejb.deploy property. If only one pinned service in the cluster,
you
> >can't get fail over. If the that server instance fails, the home stub
will
> >be removed from the jndi in other server instances.
> >> >>>
> >> >>>Why do you must need only one instance in the cluster? Do you want
> >exact-only-copy? You can read Using JNDI doc about its in cluster
> >environment.
> >> >>>
> >> >>>
> >> >>>
> >> >>>
> >> >>>>Thanks again,
> >> >>>>Bryan
> >> >>>>
> >> >>>>
> >> >>>>
> >> >>>>"Tao Zhang" <[email protected]> wrote:
> >> >>>>>
> >> >>>>>
> >> >>>>>Bryan Dixon <[email protected]> wrote in message
> >> >>>>>news:[email protected]...
> >> >>>>>>
> >> >>>>>> I'm designing a data caching approach that relies on using
> >read-only
> >> >>>>>entity ejbs with bean-managed persistence. My design is based on
the
> >fact
> >> >>>>>that WebLogic blocks on entity bean access by concurrent users for
a
> >given
> >> >>>>>bean instance (unique primary key). I would like to keep only one
> >entity
> >> >>>>>bean instance active(timeoutSetting=0) for eacy primary key for
all
> >users to
> >> >>>>>share. That way I only have to hit the database one time to
> >initially
> >> >>>>>populate data in the entity bean. I'm worried about this approach
in
> >a
> >> >>>>>WebLogic clustered environment. From reading notes in this
newsgroup
> >and
> >> >>>>>other doc, it appears that WebLogic might not use one instance of
the
> >entity
> >> >>>>>bean (based upon unique primary key) in a clustered environment.
Is
> >that
> >> >>>>>true (that being multiple users could get their own instance of
the
> >entity
> >> >>>>>bean with the same primary key)?
> >> >>>>>>
> >> >>>>>
> >> >>>>>
> >> >>>>>It's true. In a cluster environment, each wls instance can have
their
> >ejb
> >> >>>>>instance. The block of concurrent access to the ejb data is up to
> >your
> >> >>>>>transaction attribute and isolation level and your database.
> >> >>>>>
> >> >>>>>If you only want to keep one instance active, you can make the
> >read-only
> >> >>>>>entity bean a pinned service, to be deployed in one instance. But
the
> >> >>>>>network overhead is worse.
> >> >>>>>
> >> >>>>>
> >> >>>>>> Thanks,
> >> >>>>>> Bryan
> >> >>>>>
> >> >>>>>
> >> >>>>
> >> >>>
> >> >>
> >> >
> >>
> >
> >
>
-
How do I access session data through an EJB?
Hi
How do I access session data through an EJB?
I am currantly developing a Web service (using ejb's, JBoss.net and Apache Axis). A client making a call to this Web service, is expecting a bussiness-object in return. My problem is that this bussiness-object i stored in a users session data. How do I retrieve this bussiness-object from the users session.
I have read that this does not work with httpsessions, is this true? If this is true, is it possible to store the bussiness object in a JavaBean e.g:
<jsp:useBean id="userContextWebImpl" scope="session" class="com.ac.march.client.UserContextWebImpl">
<%
String key = "test";
String value = "This is the value";
userContextWebImpl.setValue( key, value1 );
%>
</jsp:useBean>
and then retrieve this information through the EJB? Or is it possible to do this by using Statfull JavaBeans? Or can this be done through a nother solution?
Please help!I have created a JavaBean with scope="application" to store some data. The data is stored when a user prefomes a spesific task.
A different person then makes a call to a Web-Service on the server. The Web-Service then asks an EJB to retrieve the data stored in the JavaBean (servlet cotext). In other words: How do I retrieve this data from the EJB?
I have tried with this code, but with no luck.
(ApplicationContextWebImpl is the JavaBean)
public static String getBookingResult( String key )
String myResult = null;
String myKey = key;
ApplicationContextWebImpl applicationContextWebImpl = null;
try
applicationContextWebImpl = new ApplicationContextWebImpl();
myResult = (String)applicationContextWebImpl.getValue( key );
catch ( java.rmi.RemoteException e )
return myResult;
} -
How to use a session bean in another session bean (or an EJB in a session)
JDev 11.1.1.4, WLS 10.3.4, Windows 7 x64
I have a login controller with a session-scoped bean that manages logins.
I have another session-scoped bean that manages menu security.
both modules compile and work fine now I need to share the data from one to another.
I need to reference the login controller in the menu security bean. How do I reference (include) the login bean in the security bean?
I tried an EJB - what a farce - these are supposed to be universal and easy ( basis of the oop in Java).
the bean is defined:
@Stateless(name = "SecurityEJB", mappedName = "ZITASApplication-ZITASModel-SecurityEJB")
I have tried :
ic = new InitialContext();
session = (SecurityEJBLocal)ic.lookup("ZITASApplication-ZITASModel-SecurityEJB#model.security.logic.SecurityEJB");
session = (SecurityEJBLocal)ic.lookup("ZITASApplication-ZITASModel-SecurityEJB#model.security.logic.SecurityEJBLocal");
session = (SecurityEJBLocal)ic.lookup("java:ejb/model.security.logic.SecurityEJB");
session = (SecurityEJBLocal)ic.lookup("java:ejb/SecurityEJB");
session = (SecurityEJBLocal)ic.lookup("java:app/SecurityEJB");
session = (SecurityEJBLocal)ic.lookup("java:module/SecurityEJB");
All return null pointers and claim the name cannot be resolved.
As you can see - I have found various claims to how to do this.
One way says create a sevlet, generate a listener and use the sevlet. Basically one for every EJB - a lot of work to use the EJBs
I would assume that this would be one of the easiest parts of java - as it is the foundation of re-usability and oop.
I can do either in the application - the added complexity of the EJB is less desirable - but better programming?Hi,
ic.lookup("ZITASApplication-ZITASModel-SecurityEJB#model.security.logic.SecurityEJB");This should work with remote interface. If you want to lookup local interface, you need to register it in web.xml. Quote:
To access the business local interface you need to define ejb local references for your component environment (i.e. from your servlet environment). You can do this by defining references in your web.xml. For example:
<ejb-local-ref>
<ejb-ref-name>ejb/BusinessLogicBean</ejb-ref-name>
<local>packagename.BusinessLogicBean</local>
</ejb-local-ref>
To lookup your local reference from your servlet you need to use the following JNDI reference:
java:comp/env/ejb/BusinessLogicBean Another one
First, declare a local ejb reference in your web.xml file (This will add it to JNDI):
<ejb-local-ref>
<ejb-ref-name>ejb/Foo</ejb-ref-name>
<local>simple.ejb.FooLocal</local>
</ejb-local-ref>
Then it can be looked up from JNDI:
InitialContext ctx = new InitialContext();
FooLocal foo = ctx.lookup("java:comp/env/ejb/Foo");Hope this helps.
Pedja
Helpful links (judging from your first post, you are probably sick of these :) )
How to lookup local EJB in Oracle Weblogic 10.3
http://m-button.blogspot.com/2008/07/reminder-on-how-to-use-ejb3-with.html
http://www.coderanch.com/t/451012/EJB-JEE/java/EJB-Local-Lookup-not-working -
Oracle Dabase Schema with OC4J CMP Entity EJB
I have tables in a schema called vsxlib. My Entity EJBs that map to SQL SERVER tables (no schema) work perfectly. My Entity CMP EJBs that connect need to connect to the vsxlib schema only partially work.
The findAll method works. When I add a where clause, I get no results back.
When I try a findByPrimaryKey, I get a ObjectNotFoundException.
Does OC4J version 9.0.3 support database schemas? There were examples posted at http://otn.oracle.com/sample_code/tech/java/j2ee/javacookbook/transactionsample/readme.html#descfiles say that they have an Entity bean working within a db schema.
Could it be permission related????
I even tried creating a synonym pointing to the table within the vsxlib schema.. No Luck.
I had this same problem with JBoss3.2 and found out that they did not support db schemas. That is why I was wanting to switch to OC4J because I thought for sure, being an oracle product that it would support db schemas.
Any help is greatly appreciated.Hi Alex,
I think you may be misunderstanding the meaning of 'database schemas'. For your information, in the Oracle database, a schema is the same as a database user. For example all the database tables belonging to user SCOTT (TIGER) are said to be in the SCOTT schema.
OC4J uses the term 'database schema' differently. Here it refers to the mapping of database datatypes to java classes. Look at the "j2ee/home/config/database-schemas" subdirectoryof the OC4J installation for more details. The "data-sources.xml" file has a 'schema' tag (not sure if that's the correct name) which points OC4J to the datatype mapping XML file -- usually one of those that come with the distribution. However, I use OC4J stand-alone version and I don't need to worry about the mappings at all -- OC4J already knows the mappings for an Oracle database (I assume).
In order to access a particular Oracle schema, I merely have to log in to the database as the appropriate user. So, using the previous example, if I configure the "data-sources.xml" file to use 'scott' as the database login, then OC4J can access the SCOTT schema. You can find more details about Oracle's use of the term 'schema' in the Oracle documentation, which is available from:
http://tahiti.oracle.com
Hope this has answered your question.
Good Luck,
Avi. -
Oracle sequence problem in CMP Entity EJB
I have a problem with Oracle sequence when I am using from the CMP entity EJB in WebLogic
6.1:
The problem is when the WebLogic server starts it acquires the correct sequence number
from Oracle, but during the runtime, when I open a new sqlplus window and increment
the sequence number, the container is not picking up from the new incremented value
instead it is still continuining by incrementing the old sequence number it has acquired
when it fetched from Oracle last time.
The sequence increment and key-cache-size in weblogic-cmp-rdbms-jar.xml are exactly
same
Any help would be greatly appreciated.Change the key-cache-size to 1 in weblogic-cmp-rdbms-jar.xml and then try
your experiment again.
-- Anand
"Satya" <[email protected]> wrote in message
news:3d06274c$[email protected]..
>
I have a problem with Oracle sequence when I am using from the CMP entityEJB in WebLogic
6.1:
The problem is when the WebLogic server starts it acquires the correctsequence number
from Oracle, but during the runtime, when I open a new sqlplus window andincrement
the sequence number, the container is not picking up from the newincremented value
instead it is still continuining by incrementing the old sequence numberit has acquired
when it fetched from Oracle last time.
The sequence increment and key-cache-size in weblogic-cmp-rdbms-jar.xmlare exactly
same
Any help would be greatly appreciated. -
Database Views with Entity EJBs
Is it possible to use Weblogic Workshop to create a CMP entity EJB on an Oracle database view for a Weblogic 8.1 server?
Is there special configuration I need to do for either the Oracle or Weblogic side to accomplish this?
Thanks.
TaniaI can manually create the EJB, an it builds just
fine, but when I go to deploy it, I get the following
error:
[EJB:011076]Unable to deploy the EJB
'AssortmentMerchandise' because the databas
e table 'K_BA01.BAV_ASRT_CLUSTR_DAT' is not
accessible. Please ensure that this
table exists and is accessible.
The view is on the same datasource that I have
successfully created all of my other entity EJBs
(from tables).
I can select data from the view using JDBC and the
same datasource that I am trying to associate the EJB
to.
Any ideas what might be wrong with my view?Are you using synonyms or aliases? I would double check those...
Log in using same username and password as weblogic and try a simple query:
select * from K_BA01.BAV_ASRT_CLUSTR_DAT -
How to set the isolation level on Entity EJBs
I am using 10.1.3.3 of the OC4J app server.
I am creating an application that uses EJB 2.1.
I am trying to set the isolation levels on the EJBs to either serializable or repeatable read.
When i deploy the EAR file from the OC4J admin console, i can set the isolation level property on the EJB's however when i inspect the orion-ejb-jar.xml file I do not see the isolation level being set. Furthermore, i tried to manually change the isolation setting by editing the orion-ejb-jar.xml and adding the isolation="serialiable" attribute on the entity bean descriptor. I then stopped and restarted the server. I noticed that my change was no longer in the file.
Can someone please let me know how to solve this problem and set the isolation level on Entity EJBs . ThanksI find it at ejb.pdf from BEA.
The transaction-isolation stanza can contain the elements shown here:
<transaction-isolation>
<isolation-level>Serializable</isolation-level>
<method>
<description>...</description>
<ejb-name>...</ejb-name>
<method-intf>...</method-intf>
<method-name>...</method-name>
<method-params>...</method-params>
</method>
</transaction-isolation>
"Hyun Min" <[email protected]> wrote in message
news:3c4e7a83$[email protected]..
> Hi!
>
> I have a question.
> How to set the transaction isolation level using CMT in descriptor?
>
> The Isolation level not supported in CMT?
>
> Thanks.
> Hyun Min
>
>
-
Mapping of an entity EJB to multiple database tables using CMP?
Can one entity EJB have attributes split between (mapped to) multiple databse tables?
Would CMR work properly between two such entity EJBs (both mapped to multiple database
tables).Hi Milos.
Can one entity EJB have attributes split between (mapped to) >>multiple databasetables?
A CMP Entity should be always mapped a record in a single DB table.
Thanks.
Ji Zhang
Developer Relations Engineer
BEA Support -
Bmp entity ejb transactions, using DAO objects
hi all,
i'm new to entity ejb's... i'm using the j2ee reference implementation (1.3.1) with the cloudscape db to test my code.
i can't seem to get my ejbCreate method to work. i'm using a DAO object to encapsulate all my database code, and simply call dao.insert(...) in my ejbCreate method.
i tested the dao object, and it works fine when it's invoked straight. but when i try to invoke under the ejb container i run into problems:
i deploy the bean with container managed transactions:
(1) with the 'required' attribute:
I get a javax.transaction.RollbackException nested inside another RollbackException, nested inside a RemoteException, nested inside another RemoteException. The final RollbackException says <<no stack trace available>>...
So I've got no clue what's causing it...
(2) with the 'never' attribute:
I get a NullPointerException nested inside another NullPointerException, nested inside a RemoteException, nested inside another RemoteException. The final NullPointerException says <<no stack trace available>>...
So I've got no clue what's causing it...
I'm assuming something messed up with my deployment -- but I've checked it against all the examples I can find -- seems to be correct. Would the encapsulated Data Access code cause a problem? Some other config problem?
Thanks in advance for any help!!i'm using the cloudscape db that's already configured with the server. i believe the datasource is correctly configured, as i am able to successfully invoke the dao methods straight -- the problem occurs when I try to do it via the entity bean that uses the dao object.
here's my server startup messages:
Binding DataSource, name = jdbc/Cloudscape, url = jdbc:cloudscape:rmi:CloudscapeDB;create=
true
Binding DataSource, name = jdbc/DB1, url = jdbc:cloudscape:rmi:CloudscapeDB;create=true
Binding DataSource, name = jdbc/EstoreDB, url = jdbc:cloudscape:rmi:CloudscapeDB;create=tr
ue
Binding DataSource, name = jdbc/InventoryDB, url = jdbc:cloudscape:rmi:CloudscapeDB;create
=true
Binding DataSource, name = jdbc/DB2, url = jdbc:cloudscape:rmi:CloudscapeDB;create=true
Binding DataSource, name = jdbc/XACloudscape, url = jdbc/XACloudscape__xa
Binding DataSource, name = jdbc/XACloudscape__xa, dataSource = COM.cloudscape.core.RemoteX -
Deployment error: The Entity EJB requires the table: to be accessible
Hello
When I deploy my EJBs, WEBLogic throws an exception:
Unable to deploy EJB: OrderBean from ejb-jar-ic.jar:
The Entity EJB requires the table: Order to be accessible. Please ensure that th
is table exists and is accessible.
I use built in Cloudscape database.
And I have those lines in descriptor:
<weblogic-rdbms-bean>
<ejb-name>OrderBean</ejb-name>
<data-source-name>ejbDS</data-source-name>
<table-name>Order</table-name>
<field-map>
<cmp-field>totalAmount</cmp-field>
<dbms-column>totalAmount</dbms-column>
</field-map>
<field-map>
<cmp-field>time</cmp-field>
<dbms-column>ordertime</dbms-column>
</field-map>
<field-map>
<cmp-field>orderID</cmp-field>
<dbms-column>orderID</dbms-column>
</field-map>
</weblogic-rdbms-bean>
<create-default-dbms-tables>True</create-default-dbms-tables>
thanx in advance
MarisHi Maris,
I see that you have create-default-dbms-tables set to true so WLS should be creating
the database table for your EJB. If you can give me some more information, I'll be
able to help you further. What version of WLS + service pack are you using? Also,
is this a 1.1 bean or 2.0? Lastly, what are the types of the CMP fields in your
bean?
As a work-around, you can try creating the database table yourself before deploying
the bean. This should resolve the deployment problem.
- Matt
Maris wrote:
Hello
When I deploy my EJBs, WEBLogic throws an exception:
Unable to deploy EJB: OrderBean from ejb-jar-ic.jar:
The Entity EJB requires the table: Order to be accessible. Please ensure that th
is table exists and is accessible.
I use built in Cloudscape database.
And I have those lines in descriptor:
<weblogic-rdbms-bean>
<ejb-name>OrderBean</ejb-name>
<data-source-name>ejbDS</data-source-name>
<table-name>Order</table-name>
<field-map>
<cmp-field>totalAmount</cmp-field>
<dbms-column>totalAmount</dbms-column>
</field-map>
<field-map>
<cmp-field>time</cmp-field>
<dbms-column>ordertime</dbms-column>
</field-map>
<field-map>
<cmp-field>orderID</cmp-field>
<dbms-column>orderID</dbms-column>
</field-map>
</weblogic-rdbms-bean>
<create-default-dbms-tables>True</create-default-dbms-tables>
thanx in advance
Maris -
Deploying CMP Entity EJB: NullPointerException
Hi,
I have built a very simple CMP Entity EJB, when deploying it to Oracle8i 8.1.7, it fails and return this error:
Processing container managed persistence bean...java.lang.NullPointerException
java.lang.Class java.lang.Class.forName0(java.lang.String, boolean, java.lang.ClassLoader)
java.lang.Class java.lang.Class.forName(java.lang.String)
void oracle.aurora.ejb.deployment.GenerateEjb.cmpDeploy(oracle.aurora.ejb.dd.OracleEntityDescriptor)
void oracle.aurora.ejb.deployment.GenerateEjb.invoke()
void oracle.aurora.server.tools.sess_iiop.ToolImpl.invoke(java.lang.String[], java.io.InputStream, java.io.PrintStream, java.io.PrintStream)
void oracle.aurora.ejb.deployment.GenerateEjb.main(java.lang.String[])
Can anyone help????
Patrick.
nullI have the same problem with JDeveloper 3.2.3 and 8.1.7.2
Here is the error:
*** Executing deployment profile E:\Xaris\JDeveloper\General\EJBs\EmpCmp\EmpCmp.prf ***
*** Generating archive file E:\Xaris\JDeveloper\General\EJBs\EmpCmp\empcmp.jar ***
Compiling the project...done
Validating the profile...done
Initializing deployment...done
Scanning project files...done
Generating classpath dependencies...done
Generating archive entries table...done
*** Archive generation completed ***
*** Deploying the EJB to 8i JVM ***
EJB deployment argument list:
"E:\Program Files\Oracle\JDeveloper 3.2.3\java1.2\jre\bin\javaw"
"-DPATH=E:\Program Files\Oracle\JDeveloper 3.2.3\bin;E:\Program Files\Oracle\JDeveloper 3.2.3\java1.2\bin"
-classpath
"E:\Program Files\Oracle\JDeveloper 3.2.3\aurora\lib\aurora_client.jar;E:\Program Files\Oracle\JDeveloper 3.2.3\lib\javax-ssl-1_2.jar;E:\Program Files\Oracle\JDeveloper 3.2.3\aurora\lib\jasper.zip;E:\Program Files\Oracle\JDeveloper 3.2.3\aurora\lib\vbjorb.jar;E:\Program Files\Oracle\JDeveloper 3.2.3\aurora\lib\vbjapp.jar;E:\Program Files\Oracle\JDeveloper 3.2.3\aurora\lib\vbjtools.jar;E:\Program Files\Oracle\JDeveloper 3.2.3\aurora\lib\vbj30ssl.jar;E:\Program Files\Oracle\JDeveloper 3.2.3\aurora\lib\aurora.zip;E:\Program Files\Oracle\JDeveloper 3.2.3\sqlj\lib\translator.zip;E:\Program Files\Oracle\JDeveloper 3.2.3\sqlj\lib\runtime.zip;E:\Program Files\Oracle\JDeveloper 3.2.3\aurora\lib\mts.jar;E:\Xaris\JDeveloper\General\EJBs\EmpCmp\classes;E:\Program Files\Oracle\JDeveloper 3.2.3\lib\jdev-rt.zip;E:\Program Files\Oracle\JDeveloper 3.2.3\jdbc\lib\oracle8.1.7\classes12.zip;E:\Program Files\Oracle\JDeveloper 3.2.3\lib\connectionmanager.zip;E:\Program Files\Oracle\JDeveloper 3.2.3\lib\javax_ejb.zip;C:\Program Fil
s\JavaSoft\JRE\1.3.1\lib\i18n.jar;C:\Program Files\JavaSoft\JRE\1.3.1\lib\jaws.jar;C:\Program Files\JavaSoft\JRE\1.3.1\lib\rt.jar;C:\Program Files\JavaSoft\JRE\1.3.1\lib\sunrsasign.jar;E:\Program Files\Oracle\JDeveloper 3.2.3\lib\xmlparserv2.jar"
oracle.aurora.ejb.deployment.GenerateEjb
-u
harris
-p
harris
-s
sess_iiop://192.168.10.218:2481:WORK
-republish
-keep
-temp
TEMP
-descriptor
"E:\Xaris\JDeveloper\General\EJBs\EmpCmp\EmpCmp.xml"
-oracledescriptor
E:\Xaris\JDeveloper\General\EJBs\EmpCmp\EmpCmp_oracle.xml
-generated
"E:\Xaris\JDeveloper\General\EJBs\EmpCmp\EmpCmpClient.jar"
"E:\Xaris\JDeveloper\General\EJBs\EmpCmp\empcmp.jar"
Reading Deployment Descriptor...done
Verifying Deployment Descriptor...done
Gathering users...done
Processing container managed persistence bean...java.lang.NullPointerException
java.lang.Class java.lang.Class.forName0(java.lang.String, boolean, java.lang.ClassLoader)
java.lang.Class java.lang.Class.forName(java.lang.String)
void oracle.aurora.ejb.deployment.GenerateEjb.cmpDeploy(oracle.aurora.ejb.dd.OracleEntityDescriptor)
void oracle.aurora.ejb.deployment.GenerateEjb.invoke()
void oracle.aurora.server.tools.sess_iiop.ToolImpl.invoke(java.lang.String[], java.io.InputStream, java.io.PrintStream, java.io.PrintStream)
void oracle.aurora.ejb.deployment.GenerateEjb.main(java.lang.String[])
null
*** Errors occurred while deploying the EJB to 8i JVM ***
*** Deployment completed ***
Does anyone know what is the problem?
Maybe you are looking for
-
Error when starting parser: timeout during allocate / CPIC-CALL:'TfSAPCMRC'
Hello experts. When I try to preview or refresh a Crystal Report document built on a BEx query I get the following error msg: Database connector error: BAPI Error #0. Error when starting parser: timeout during allocate / CPIC-CALL: 'TfSAPCMRCV'. We h
-
Display of missing values in a table view.
Hi everyone, I have a table view with 7 columns and 10 rows which displays only those values which are missing in the DataBase Table. Is it possible to show only the missing values as '-' in a table view, the table view is having 7 different fields.
-
Can't seem to export in iPhoto 9.5
i tried to export photos to the desktop tonight and it does not work. I can drag and drop but dont know why i cant export. Tried to quit and reopen and it did not work. i am on my new mbpro with mavericks Thanks Ross
-
I have had an issue with test stand version 1.0.1 (yes, I know; it's quite old) and calling a C function thru an action step. when I call this function with 18 parameters, it seems to hang. I have called a function with 16 and it seems to work. Is th
-
Itunes 64 will not install on my Dell comp. running windows 7
I am trying to install Itunes 64 on my new Dell computer running Windows 7. The Installer program is running OK because I can install windows updates without any trouble. The Windows installer cannot execute the file I downloaded from the Apple web