Bean-Managed vs. Container-Managed Persistence

Hello,
I would like the real world skinny on bean-managed persistence vs. container-managed persistence. I have heard the bean-managed offers higher scalability and performance, while container-managed offers simplicity but with a cost. Can someone give me some perspective?
Thanks,
Rob Miller

Wrong forum, but I guess if you are new to java it could be argued that anything goes...
General rule:
use CMP if you don't have worries about speed or legacy systems.
use BMP if you need to control the persistence and/or want to connect to legacy host systems. BMP allows you to set up caching and transaction handlers to handle the presistence in a manner more suited to your needs.

Similar Messages

  • Bean-managed persistence (BMP) in EJB 3.0

    I've been on the google for a few days now and haven't found one single notion on bean-managed persistence in EJB 3.0 specification. Even the official specification PDFs don't mention it :(
    Help! I need BMP! Does anybody know what's the situtation in EJB 3.0? Can I and how mark an entity bean to be bean-managed persistent and use ejbLoad and ejbStore functions like in the EJB 2.0 or something like that?
    Tnx in advance,
    Igor

    Tnx Frank, I was afraid of that :(
    I think that is a step back for the EJB technology. Now it is fixed to the table structure, every change in the database calls for a re-desing, re-compilation and re-deplyoment.
    With BMP in EJB 2.1 one was able to build a bean that modifies itself according to the table structure dinamically. Is there any way to do it in EJB 3.0?
    Igor

  • Bean-managed persistence?

    Hi,
    Can someone explain to me if there is a diffetent between bean managed persistence and bean managed transaction?
    Or where I can read about it?
    Thanks,
    Julia

    sun has several articles about both of these concepts. You can probably find them via an Internet search. Here is one of the documents:
    http://java.sun.com/j2ee/tutorial/1_3-fcs/index.html

  • Bean Managed Persistence and Object Fields

    I'm having trouble persisting data in the fields in my EJB. I have posted the code for my EJB below:
    package com.kns.account.ejb;
    import java.sql.*;
    import javax.ejb.EntityBean;
    import javax.ejb.EntityContext;
    import javax.ejb.CreateException;
    import javax.ejb.FinderException;
    * @stereotype EntityBean
    public class AccountBeanEJB implements EntityBean
    public int id;
    public String username;
    public String password;
         * The container assigned reference to the entity
         private EntityContext context;
         * @return
         public AccountBeanEJB() {
         * Sets the context of the bean
         * @param ec
         public void setEntityContext(EntityContext ec) {
              context = ec;
              // to do: code goes here.
         * Clears the context of the bean
         public void unsetEntityContext() {
              this.context = null;
              // to do: code goes here.
         * This method is called when the container picks this entity object
         * and assigns it to a specific entity object. Insert code here to
         * acquire any additional resources that it needs when it is in the
         * ready state.
         public void ejbActivate() {
         * This method is called when the container diassociates the bean
         * from the entity object identity and puts the instance back into
         * the pool of available instances. Insert code to release any
         * resources that should not be held while the instance is in the
         * pool.
         public void ejbPassivate() {
         * @return
         public Integer ejbCreate(int theId, String theUsername, String thePassword)
              throws CreateException
    System.out.println("Creating new account");
         String sqlstr = "Insert into Account (ACCOUNTID, USERNAME, PASSWORD)";
         sqlstr = sqlstr + " VALUES(" + theId + ", '" + theUsername + "', '" + thePassword + "')";
         Connection conn = null;
         try
         conn = getConnection();
         Statement stmt = conn.createStatement();
         stmt.executeUpdate(sqlstr);
         System.out.println(sqlstr);
         this.id = theId;
         this.password = thePassword;
         this.username = theUsername;
         System.out.println("Done creating new account");
         catch(Exception e)
         e.printStackTrace();
         finally
         try
         conn.close();
         catch(Exception e)
              return new Integer(this.id);
         public void ejbPostCreate(int id, String username, String password) {
         * @return
         public Integer ejbFindByPrimaryKey(Integer key)
              throws FinderException {
              // to do: code goes here.
              this.id = key.intValue();
              return (key);
         public void changePassword(String newPassword)
         this.password = newPassword;     
         * @return
         public int createAccount(String username, String password) {
              // to do: code goes here.
              return (0);
         public void ejbRemove()
         String sqlstr = "Delete * from Account Where ACCOUNTID = " + this.id;
         Connection conn = null;
         try
         conn = getConnection();
         Statement stmt = conn.createStatement();
         stmt.executeUpdate(sqlstr);
         catch(Exception e)
         e.printStackTrace();
         finally
         try
         conn.close();
         catch(Exception e)
         public void ejbLoad()
         System.out.println("In ejbLoad");
         String sqlstr = "Select * from Account Where ACCOUNTID = " + this.id;
         System.out.println(sqlstr);
         Connection conn = null;
         try
         conn = getConnection();     
         Statement stmt = conn.createStatement();
         ResultSet rs = stmt.executeQuery(sqlstr);
         if(rs.next())
         this.password = rs.getString("Password");
         System.out.println("password = " + this.password);
         this.username = rs.getString("Username");
         System.out.println("username = " + this.username);
         catch(Exception e)
         e.printStackTrace();
         finally
         try
         conn.close();
         catch(Exception e)
         public void ejbStore()
         System.out.println("In ejbStore");
         String sqlstr = "Update Account Set Username = '" + this.username + "', Password = '" + this.password + "' Where ACCOUNTID = " + this.id;
         System.out.println(sqlstr);
         Connection conn = null;
         try
         conn = getConnection();
         Statement stmt = conn.createStatement();
         stmt.executeUpdate(sqlstr);
         catch(Exception e)
         e.printStackTrace();
         finally
         try
         conn.close();
         catch(Exception e)
         public String getPassword()
         //ejbLoad();
         return this.password;
         public String getUsername()
         //ejbLoad();
         return this.username;
         private Connection getConnection() throws ClassNotFoundException, SQLException
         Class.forName("weblogic.jdbc20.pool.Driver");
         return DriverManager.getConnection("jdbc20:weblogic:pool:pwxPool");
         public void removeAccount() {
    It seems like id, username, and password fields are not stored between calls. Here is some sample output from my weblogic server:
    Account found for id = 99
    in ejbStore
    Update Account set Username= 'null', Password ='null' Where accountId = 0
    Does anyone know how to fix this? I'm banging my head on the desk over here. Thank you.

    These functions always return null! Please help me!
    public String getPassword()
    //ejbLoad();
    return this.password;
    public String getUsername()
    //ejbLoad();
    return this.username;

  • Has someone experiance with bean managed persistence withWAS Java and NWDS?

    Thank you for any answers?
    Mehmet

    Hi mehmet
    Here are some links which might help you with respect tp BMP
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/842584e5-0601-0010-509c-aced995b60db
    /people/stepan.samarin/blog/2004/06/16/choosing-your-persistency-strategy-java-j2ee
    /people/madhusudhan.buragapally/blog/2005/02/15/challenges-while-deploying-a-j2ee-application-on-sap-web-application-server
    Hope this helps , please do not forget to reward poinst if u find  it helpful
    regards
    rajesh kr

  • 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
              > >> >>>>>
              > >> >>>>>
              > >> >>>>
              > >> >>>
              > >> >>
              > >> >
              > >>
              > >
              > >
              >
              

  • Container Managed Persistence entity bean relationship fields

    I want to ask something that until now still confuse. Did Relationship fields in Container Managed Persistence entity beans declare , inside Database table or only Persistence fields .
    If Relationship fields not declare inside database table ,how if SQL calls the relationship fields between related entity bean.
    did container handle this task.
    example: I have 2 entity bean with CMP(Container Managed Persistence)version 2.0
    call Player and Team. every entity bean have own relationship fields and persistence fields.
    player has playerId(primary key),name,position,age persistence fields and teams is relationship fields.
    team has teamId(primary key),name,city and players is relationship fields.
    I know that all persistence fields is declare in own database table but how about relationship fields.
    can you tellme, How SQL calls can access relationship fields if relatiosnship fields is not declare in database table.
    I use J2EE RI SDK version 1.3
    and deploytool .
    thank's .

    thank's for your reply .Now I have another problem
    I use J2EE RI from java.sun .I try to follow example in j2eetutorial about CMP Example call RosterApp.ear .
    I dont'change anything code inside RosterApp.ear but when I deploy and runclient command thereis syntax error :
    java.rmi.ServerException: Remote exception occured in server thread :nested exception is java.rmi.ServerException :exception thrown from bean :nested exception is : java.ejb.EJBException :nested exception is :java.sql.SQLException :syntax error or access violation ,message from server: "you have an error in SQL syntax near "
    "leagueBeanTable" WHERE "leagueId" = 'L1' at line 1
    in example ,RosterApp.ear use Cloudscape database ,but I try to use Mysql database for RosterApp.ear ,is there any different syntax SQL from Cloudscape to Mysql .
    if like that ,so I must edit first SQL calls from Cloudscape to MYSQL . I think because relationship fields is for entity beans only ,so how if mysql database want to access foreign key another table because foreign key isn't declare in databse table.
    example : I have 3 entity bean call player, team, league .
    1. PlayerEJB have persistence fields name, position, playerId(primary key), cmr fields is teams
    2. TeamEJB have persistence fields name, city, teamId (primary key) , cmr fields is players and leagues .
    3. LeagueEJB have persistence fields name ,sport, leagueId(primary key), cmr fields is teams
    so table is
    PlayerEJB <--->TeamEJB<--->LeagueEJB
    Player have some finder method call findBySport(String Sport) .
    because Sport is persistence fields for LeagueEJB
    so PlayerEJB must traverse TeamEJB first before LeagueEJB
    EJB QL : SELECT distinct object(p) FROM Player (p) IN (p.teams) AS t
    WHERE t.league.sport = ?1
    I know that Container will translates EJB QL to SQL calls ,but default is only for cloudscape database and I use for MYsql .
    so can you helpme how to query method findBySport(String sport) to Mysql calls .
    thereis no foreign key between table in database table there is only Relationship fields in entity bean.

  • Bean or Container Managed Persistence

    Hi,
    I've been reading up on the Sun J2EE tutorial. One of the topics there is bean or container managed persistence. It states that container managed is easier for developers and allows for more portability. The class codes are much smaller compared to bean managed and developers need not worry about database queries.
    Can anyone share their experiences on this? Any 'Real World' advantages and disadvantages? Is there a guideline I can follow when to use bean or container managed persistence?
    Thanks,
    -Ray

    That seems like an obvious flaw. So why was it even considered in the
    J2EE framework? I mean wouldn't the J2EE architects immediately realize
    that? Just doesn't make sense to me why there's even a tutorial or books
    for it. What does it suppose to solve then??I know what you mean... again, I think they thought it looked good on paper.
    And it gets worse...
    Before you use Entity Beans you must be absolutely sure that there will never be another app that accesses the underlying table that doesnt use the EntityBean to do it... For example a C++ App that accesses the tables directly... otherwise you have to set a flag in the App Server that states that basically every time a property on an EntityBean is read the Bean will have to RE-READ the beans state from the database!!
    Some things look really good, from an OO perspective, but dont work really well in reality. Sure Entity Beans look really good in the example program in the tutorial, but what happens when you multiply the number of entity beans by 1000, 100,000, or more? Just think of the CPU, and Memory overhead for instantiating all those objects!
    There are people out there who believe that using Stored Procedures is a no-no because in their minds it puts "Business Logic" on the database and not the App Server...To this I say... BUNK... Ive seen several instances where by simply moving a set of queries from the App Server to a stored procedure on the database, allowed for a 10-20 times performance gain because of the elimination of network IO. In one instance I saw a query go from 3 hours execution time on the App Server to under 10 minutes on the database... But stored procedures arent OO...
    So IMHO before you use EntityBeans at all... be absolutely sure you understand all of the ins-and-outs of doing so.

  • Container-managed persistence Entity bean

    WE use a container-managed persistence Entity bean. To handle the state synchronization between the object & the database, what must WE do?
    Thanks in Advance

    That's the container's job. You can use the commit option A/B/C to control how the DB and objects are synchronized.
    -Scott
    http://www.swiftradius.com

  • Container-managed persistence application problem

    I worked out a container-manager persistence entity bean application. Everything is fine until I run the client. When I ran the client, I got the following exception from the server side when I turned on "j2ee -verbose":
    "Exception in thread "RequestProcessor[20]" org.omg.CORBA.BAD_PARAM: CourseBean_P
    M_EJBLocalObjectImpl minor code: 1330446342 completed: Maybe
    at com.sun.corba.ee.internal.orbutil.ORBUtility.throwNotSerializableForC
    orba(ORBUtility.java:660)
    at com.sun.corba.ee.internal.iiop.CDROutputStream_1_0.write_abstract_int
    erface(CDROutputStream_1_0.java:631)
    at com.sun.corba.ee.internal.iiop.CDROutputStream.write_abstract_interfa
    ce(CDROutputStream.java:281)
    at com.sun.corba.ee.internal.javax.rmi.CORBA.Util.writeAbstractObject(Ut
    il.java:145)
    at javax.rmi.CORBA.Util.writeAbstractObject(Util.java:128)
    at com.sun.corba.se.internal.io.IIOPOutputStream.writeObjectDelegate(IIO
    POutputStream.java:99)
    at com.sun.corba.se.internal.io.IIOPOutputStream.writeObjectOverride(IIO
    POutputStream.java:106)
    at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:271)
    at java.util.ArrayList.writeObject(ArrayList.java:513)
    at com.sun.corba.se.internal.io.IIOPOutputStream.writeObject(Native Meth
    od)
    at com.sun.corba.se.internal.io.IIOPOutputStream.invokeObjectWriter(IIOP
    OutputStream.java:525)
    at com.sun.corba.se.internal.io.IIOPOutputStream.outputObject(IIOPOutput
    Stream.java:492)
    at com.sun.corba.se.internal.io.IIOPOutputStream.simpleWriteObject(IIOPO
    utputStream.java:125)
    at com.sun.corba.se.internal.io.ValueHandlerImpl.writeValueInternal(Valu
    eHandlerImpl.java:134)
    at com.sun.corba.se.internal.io.ValueHandlerImpl.writeValue(ValueHandler
    Impl.java:114)
    at com.sun.corba.ee.internal.iiop.CDROutputStream_1_0.write_value(CDROut
    putStream_1_0.java:1049)
    at com.sun.corba.ee.internal.iiop.CDROutputStream_1_0.write_value(CDROut
    putStream_1_0.java:638)
    at com.sun.corba.ee.internal.iiop.CDROutputStream.write_value(CDROutputS
    tream.java:268)
    at _RegisterBean_EJBObjectImpl_Tie._invoke(Unknown Source)
    at com.sun.corba.ee.internal.POA.GenericPOAServerSC.dispatchToServant(Ge
    nericPOAServerSC.java:519)
    at com.sun.corba.ee.internal.POA.GenericPOAServerSC.internalDispatch(Gen
    ericPOAServerSC.java:204)
    at com.sun.corba.ee.internal.POA.GenericPOAServerSC.dispatch(GenericPOAS
    erverSC.java:112)
    at com.sun.corba.ee.internal.iiop.ORB.process(ORB.java:273)
    at com.sun.corba.ee.internal.iiop.RequestProcessor.process(RequestProces
    sor.java:84)
    at com.sun.corba.ee.internal.orbutil.ThreadPool$PooledThread.run(ThreadP
    ool.java:99)
    Anybody has any insight in this. I checked the appliation using the verification tool, it shows no problem at all. I am really out of idea!
    Thanks a lot!

    send me your contact info and i think i can help.
    my email is : [email protected]
    In addition I believe ssniazi is in violation of the conduct code of this website because ssniazi is requesting information which will be used by a business entity without telling the users that it will be used in that way. And I expect that Oracle itself would frown on such activities.
    2.3 You agree that You will not use the Website to:...(g) collect or store personal data about other users unless specifically authorized by such users.

  • Container-managed / bean-managed transaction demarcation

    I am trying to make sure I understand container-managed and bean-managed transaction demarcation and in particular where you have one bean calling another bean. What happens where one of the beans has container-managed transaction demarcation and the other bean-managed transaction demarcation. In fact the initial question to ask is, is this allowed?
    Lets use an application scenario to illustrate the issue. The application has a payment transaction. Payments can be received in one of two ways:
    1. As a payment at a branch where the individual payment is processed on a client application and resulting in the processing of a single payment transaction.
    2. As a batch of payments received from a bank containing, potentially, thousands of payment transactions.
    The proposed implementation for this uses two session beans. The first is a Payment session bean that implements the business logic as appropriate calling entity beans to persist the change. The second is a BatchPayment session bean. This processes the batch of payment transactions received from the bank. The BatchPayment reads through the batch of payments from a bank calling the Payment session bean for each payment transaction.
    Lets look at the transactional properties of both session beans. In order to support the client application the Payment session bean can implicitly enforce transactional integrity and is therefore set to container-managed transaction demarcation. However the BatchPayment session bean will want to explicitly specify transaction demarcation for performance reasons. The transactional "commit" process is relatively expensive. When processing a large batch of transactions rather than performing a commit after every transaction is processed we want to perform the commit after a number of transactions have been processed. For example, we may decide that after every 100 transactions have been processed we commit. The processing will have a shorter elapsed time as we have not had to perform 99 commit processes. So the BatchPayment session bean will want to explicitly specify its transaction demarcation and will therefore be defined with bean-managed transaction demarcation.
    How would this be implemented? A possible solution is:
    Payment session bean implemented with container-managed transaction demarcation with transaction scope set to Required.
    BatchPayment session bean implemented with bean-managed transaction demarcation with transaction scope set to Required.
    When the client application is run it calls the Payment bean and the container-managed transaction demarcation ensures the transactional integrity of that transaction.
    When a BatchPayment process is run it explicitly determines the transaction demarcation. Lets say that after every 100 Payment transactions (through 100 calls to the Payment session bean) have been processed the BatchPayment bean issues a commit. In this scenario however we have mixed container-managed and bean-managed transaction demarcation. Hence my original question. Can container-managed and bean-managed transaction demarcation be mixed? If not how is it possible to implement the requirements as described above?
    Thanks for any thoughts.
    Paul

    BatchPayment session bean implemented with bean-managed transaction demarcation with transaction scope set to Required.Didn't quite understand this sentence.... if it's BMT it has no declarative transaction attributes such as "Required"....
    Anyway, first of all I'll have to ask, Why at all would you want to commit in the middle of the business method? to get as much through as possible before a potential crash? :-)
    Can container-managed and bean-managed transaction demarcation be mixed?Yes, of course. Just remember that the "direction" you are refering to ->
    a BMT SB that propagates it's transaction to a method in a CMT SB that is demarcated with "Required" is the simplest case. If it were "reversed", or for that matter any BMT that might be called within an active transaction context must perform logic to manipulate the transaction state. For instance(and most common case), checking to see if a transaction is active and if so not to do anything(just use the one that is already active).
    If not how is it possible to implement the requirements as described above?You could also implement this scenario with CMTs all the way through. your BatchPayment SB could consist of two methods, one (say, execute(Collection paymentsToExecute) ) with "Supports", and another(say executeBatchUnit(Collection paymentsToExecute, int beginIndex, int endIndex) ) with "RequiresNew".
    then have the first just call the other with indexes denoting each time a group of payments.
    Still, it does seem more suitable using BMT for these kind of things.....
    Hope this helped....

  • About Container-managed Transactions and Bean-managed Transactions

    as the document of weblogic7.0 describe the differents of Container-managed
              Transactions and Bean-managed Transactions,and in the document,It tell us
              details of using Bean-managed Transactions,such as \:
              import javax.naming.*;import javax.transaction.UserTransaction;.....
              import java.sql.*;import java.util.*;
              UserTransaction tx = (UserTransaction)
              ctx.lookup("javax.transaction.UserTransaction");tx.begin();
              tx.commit() //or tx.rollback
              but how to use Container-managed Transactions?
              what is EJB's deployment descriptor? can someone tell me?
              i wonder someone will show me an example of how to use Container-managed
              Transactions.
              thanks
              fish
              

    Many if not all of the WLS EJB examples use container-managed
              transactions. That's a good place to start.
              I'd also recommend that you pick up a decent EJB book. There's several
              on the market right now.
              -- Rob
              fish wrote:
              > <ejb-jar>
              > <enterprise-beans>
              > <session>
              > <ejb-name>testbean</ejb-name>
              > <home>test.test.TestHome</home>
              > <remote>test.test.Test</remote>
              > <ejb-class>test.test.TestBean</ejb-class>
              > <session-type>Stateful</session-type>
              > <transaction-type>Container</transaction-type>
              > </session>
              > </enterprise-beans>
              >
              > <assembly-descriptor>
              > <container-transaction>
              > <method>
              > <ejb-name>EmployeeRecord</ejb-name>
              > <method-name>*</method-name>
              > </method>
              > <trans-attribute>Required</trans-attribute>
              > </container-transaction>
              > </assembly-descriptor>
              > </ejb-jar>
              > ----------------------------------------------
              > seems i have to write ejb-jar.xml like this,am i right?
              > what about <ejb-client-jar>? is it needed in this xml file?
              >
              > thanks
              >
              > fish
              >
              >
              

  • Bean Managed Transactions and rollback

    Hi Everybody,
    I am using Bean Managed Transactions in a Message Bean which is called every some time by an EJB3 timer. This Message Bean subsequently calls a Session Bean which uses Container Managed Transactions and uses the default transaction attribute which is SUPPORTS. The Session Bean methods might sometime throw a System Exception(inheriting from RuntimeException) which will rollback the Bean Managed Transaction which was started from the Message Bean.
    When this happens and I try to invoke userTransaction.rollback() I get invalid transaction state exception and I suppose this means that is already rolled back.
    Is there a way to get another transaction or set the transaction back to a valid state so I can carry on with some persistence tasks or the only way to do that is by suppressing the RuntimeException and throwing an Application Exception having the *@ApplicationException(rollback=false)* annotation? Can I suppress a System Exception though?
    Thank you in advance!

    Saroj wrote:
    Hi All,
    I would like to know whether we can use JDBC Connection Object's commit and rollback
    methods to control Transaction in Bean Managed Transactions or not.You may use the JDBC connection's transaction support from an EJB. That being said, you
    need to understand that it won't be the transaction that started declaratively by the
    EJB container nor would it be a bean-managed transaction started through
    UserTransaction.
    FWIW, I question why you'd want to do this though. I'd use container-managed
    transactions and let the container handle this for you. The transaction manager
    includes a 1PC optimization so it's not going to do an XA/2PC tx if you only have a
    single resource in the tx. Also, the EJB container includes all the logic to properly
    handle rollbacks when exceptions are thrown etc.
    Finally, your code will more maintainable and reusable if you use the container-managed
    tx + JTA resources. If I later wanted to call another EJB or another JTA resource (eg
    JMS perhaps) I could do it without having to rewrite all of your code.
    -- Rob
    >
    >
    Why is it required that we should use Java Transaction API to control the Transaction
    in Our Beans?
    I understand that if we are using Multiple Resources and need to use Transaction
    then going for JTA makes sense. If I am using only Resource,for example, Only One
    Connection then we should be able to use Connection's Transaction control.
    I understand that other way to do the transaction is to use Container's transaction
    services.
    Please respond at the earliest.
    Thanks in Advance,
    Saroj

  • Unable to generate Bean Managed Client project

    Hello,
    I am using JDeveloper 9.0.3 Production (build 1035).
    For each of our Business Components projects, we create a deployment profile - BC EJB Session Bean, Session Facade (BMT).
    Because of the way our application is organized, the default folder proposed for the BMC (Bean Managed Client) project is not suitable.
    As it is not possible to modify the BMC project folder or name once generated (maybe here is a slight problem?), we decided to find a different modus operandi to get the same final result.
    But, it seems that the only way to create the BMC project is from the very beginning, when the deployment profile is created, and with the default names generated by JDeveloper.
    Maybe I am missing something.
    Here are the steps I perform:
    1. Specify an Application Server Connection (Standalone OC4J) to our development OC4J server.
    2. For the BC project, create a Deployment Profile / Business Components EJB Session Bean.
    3. For this deployment profile, choose to deploy to Oracle 9iAS EJB Container, using the previously created connection.
    4. In the AppModules section of the profile, carefully reset the option "Create AppModule Configurations" after having selected the one AppModule defined in the BC project.
    5. In the properties of our AppModule, in the Remote section, I activate now the option "Remotable Application Module" and I select Session Facade (BMT) configuration.
    6. In the Target Platform section, I update the Client Project entry to fit our project's organization and press OK.
    7. I return to the deployment profile settings and set the option "Create AppModule Configurations".
    For my surprise, at this moment the BMC project is not created. Nor if I compile the BC project, or modify again the AppModule, or the configurations, or the deployment profile...
    I even tried to quit JDeveloper, re-enter and re-do the same attempts, but useless...
    Is there a way to create the BMC project for a BMT Session Facade configuration after having created the deployment profile?
    TIA,
    Adrian

    Sorry, I think I over-reacted. In fact, the only real problem I have is that I cannot move the BMC project from the default project to another.
    I already have some projects for my application (which I tested until now in local config) and I want now to make them remotable. The problem with the project that did not want to create the BMC-pair was that it had nothing to remote - no exposed method, nor for AM, nor for VO's ;o)
    For a project that already has some remotable methods, the steps to perform are very strict when you want to make it remotable. You are right, if I first make my AM remotable and properly define there the path and name for the client project, I get the good results.
    But, even in this case, I did not see any integrated way of moving this project (completely generated by JDev) to another folder. What I do is modify the project in the configuration properties, quit JDev and move the folder manually.
    Thank you,
    Adrian

  • Bean-managed transaction with EJB 3.0

    Hi,
    I try to get a bean-managed transaction example running with EJB 3.0 under GlassFish v2ur2.
    In order to demarcate the scenario I have to get me the UserTransaction which I get from the SessionContext. I would like to use it then like: UserTransaction ut = context.getUserTransaction();
    I tried to get the SessionContext with the help of the EJB method setSessionContext which should be called by the container after instance creation.
    However, setting a log output into that method does not show any call of this method.
    So, how can I get this method called or is there another way to get the SessionContext for the UserTransaction to work ?
    Are there any good and fully implemented examples for bean-managed transactions ?
    Thanks for your help.
    Regards

    I found the solution for that my SessionContext was NULL and I could not use the UserTransaction.
    The reason for it is that I injected the EJB with @EJB into my servlet and did a MyBean mybean = new MyBean();
    That leads to a SessionContext which is NULL within my EJB.
    If I use it without instantiating it it works fine.
    Again, thanks for your help. At least it pointed me into the right direction.
    Regards

Maybe you are looking for

  • Unable to open sdk extension google map in design studio 1.3

    Hi, i registered all sdk components into design studio client tool after i try to use google map and drag into my application however nothing happened just keep loading for a long time, even i used google api key within jsiclude: http://maps.googleap

  • Design view inop DW CS3

    Design view grayed out, inaccessable. The file has an HTML extenstion. Files I had previously been able to use Design View on, Design View no longer works. I suspect I inadvertantly turned it off, but how?

  • How do I get iphoto to recognize scanned jpeg photos?

    How do I get IPhoto to recognize sacnned jpeg photos?  The response is that the format is nor recognized!

  • PDF with page curl effect

    Hi, I understand that Indesign can produce pdf with page curl effect. what if I only have a pdf file and i want to include the page curl effect? anybody knows what's the quickest way to do this? Is there any way to import multiple pdf pages into Inde

  • Upgraded to GeForce GTX TITAN Black video card. Everything is too small to read.

    Upgraded to GeForce GTX TITAN Black video card and a Samsung 4K monitor, recently. Now, everything in Adobe Premiere Pro CS6 is too small to read. What can I do to make it readable?