2 phase commit for entity bean

Hi all,
Does the 2-phase commit capability in WL6.X applies to entity bean?
Thanks,
Rick

Two phase commit is the mechanism that allows transactions to the managed
across different servers and databases.
yes, definitely I does apply for entity beans
"Rick Lee" <[email protected]> wrote in message
news:[email protected]..
>
Hi all,
Does the 2-phase commit capability in WL6.X applies to entity bean?
Thanks,
Rick

Similar Messages

  • How set diff. timeouts for entity beans?

    How do i set diff. timeouts for diff. entity beans? Is it in the ejb-jar.xml file? Is this refreshed every time it is accesses?

    Hi there,
    Although not familiar with all of the App servers on the market, I'd say that you are unlikely to find a timeout value for Entity Beans. Passivation of Entity beans is normally a function of the commit options supported by a specific App server. For example, with Commit Option C an entity bean instance should always be returned to the instance pool after a transaction has completed. You can find details of the various commit options in the EJB specification which you can view or download from:
    http://java.sun.com/products/ejb/docs.html
    Hope this helps
    Amanda
    Developer Technical Support
    Sun Microsystems
    http://www.sun.com/developers

  • How to disable cache implementation in 8.1 SP6 for entity beans

    How to disable cache implementation in 8.1 SP6 for entity beans
    In our production environment, we want to disable cache implementation for entity beans. We are using weblogic 8.1 SP6.
    Weblogic cache implementation has been causing many cachefull exceptions so we want that it fetches the data from database everytime instead of cache.

    Check the "max-beans-in-cache" setting in your weblogic-ejb-jar.xml. The cache full exception, means that a new bean could not be created because of this cache being full.
    Nothing to do with fetching from the database directly.
    If you really want direct fetches then do not use beans at all. Consider using direct JDCB/SQL calls (without a entity bean) to fetch huge data.
    Let's again review your application based on the below explanation before making a decision on which configuration change to perform:
    If you truly have many ejbs simultaneously enrolled in transactions, then yes, the cache must be big enough to hold all the instances.
    Your cache must have a max size large enough to handle your peak simultaneous transaction load.
    Also, try to ask the following query to your application developer. Does every user actually have to have more than one bean in the cache ? Are many of these values read-only reference values that are not updated ?
    SOLUTION CHOICE:
    1. If you are testing with more number of users simultaneously, then you will need to increase the "max-beans-in-cache" setting in your weblogic-ejb-jar.xml to match the load.
    2. If you have few users but still seeing a lot of beans, then consult with your application developer and try to ask the above questions (Does every user have more than......) and based on that try to redesign/tune your application to make it an effective Entity bean model.
    3. If you have queries where huge result sets are returned, consider using plain/direct JDB/SQL calls.
    Arun

  • Do I need to Create Primary Key Class for Entity beans with Local interface

    Do I need to Create Primary Key Class for Entity beans with Local interface?
    I have created my entity bean with the wizard in Sun One Studio and it does not create a primary key class for you.
    I thought that the primary key class was required. My key is made up of only one field.
    Anyone know the answer.
    Jim

    u dont need to create a primary key class for a entity bean.if ur table's primary key feild(int ,float) is a built in or primitive data type,then u dont need one.But if ur table has a primary key field which is non primitive (for example StudentID,ItemID etc)then u have to create a primary key class.
    hope this helps :-)

  • IsDirty or isModified flag for Entity Beans

    I've been reading a lot of conflicting information on the use of a isModified boolean in Entity Beans. Is creating a modified boolean recommended for BMPs? Or CMPs? Or both? I am doing a BMP, and wondering if it will really buy me much performance-wise to add this logic to my ejbStore() method. Thoughts?
    Thanks,
    Ceily Turner

    Greetings,
    I've been reading a lot of conflicting information on
    the use of a isModified boolean in Entity Beans. IsAre you sure all this information was presented in the same contexts? I'm guesing the apparent conflict was only perceptual and without regard for BMP in one case and CMP in [the /an]other...
    creating a modified boolean recommended for BMPs? OrDefinitely! The container will call your bean's ejbStore method (sometime) after a call to its business method(s) to ensure its state is synchronized back to the resource. However, in a BMP bean, the container has no way of knowing whether the business method(s) actually modified your bean's state, making the call to ejbStore a "blind call". Additionally, business method calls are not the only triggers to calling ejbStore - transaction COMMIT (regardless if your bean was an active participant in the transaction), and passivation being among them, as well as "at any time within the container's discretion". Though, precisely when and how often the spec. leaves to the "vendor's disrection". With all these factors at play, "blindly" hitting the resource is a sure-fire way to degrade the performance of your beans and, consequently, the application(s) which they are a part. Make your synchronization code "smart" - use a 'dirty flag'.
    CMPs? Or both? I am doing a BMP, and wondering if itIn CMP, the container has more direct knowledge of the bean's state fields and, therefore, should know whether an actual update to the resource is needed - this is especially true for EJB 2.0. Of course, this depends on the vendor's implementation (coders) to be "smart" on the bean coder's behalf. In any event, the container has absolute control over bean synchronization, and ejbStore is relegated to being a pre-processor, in CMP, so using a 'dirty flag' here will gain you absolutely nothing!
    will really buy me much performance-wise to add this
    logic to my ejbStore() method. Thoughts?Refer back to the above. :)
    Thanks,
    Ceily TurnerRegards,
    Tony "Vee Schade" Cook

  • Re: junit test for entity beans ... ejb 3.0

    I'm confused. I'm trying to test my entity bean.
    I have:
    - an entity bean
    - a stateless session bean for accessing the entity bean (facade)
    - an interface for accessing the the stateless bean
    And I'm trying to write a JUnit test class to test this bean. However, I am uncertain as to how to test this (I'm new to EJB 3.0, JBoss and Eclipse).
    What would the JUnit test look like? I'm confused as to whether or not I should be injecting the interface/bean/what???
    I've tried several variations. I either get "NameNotFound" - not bound exceptions or Null pointer exceptions.
    What would the @EJB syntax look like or how would I do it through the context?
    For Example:
    @EJB private TestFacade myTest; //interface to stateless bean ?
    OR
    InitialContext ctx = new InitialContext();
    TestResultFacadeBean myTest = (TestResultFacadeBean) ctx.lookup("localTest");
    I'm confused at to which method I should be using and what object I should be accessing. If I could get either one to work, I'd be happy. :)
    How do I ensure my bean is deployed to the container? What do I need to do?
    If anyone has a simple example or explanation as to which method I should use and how to use it, I'd be very grateful.
    Thanks very much,
    LisaD

    OK, you need to have several layers of testing.
    Layer 0. Test the entity beans are deployable (more on this later). Basically, you need to know that all your annotations work. Things to watch out for are multiple @Id fields in one class or @EmbeddedID or @IdClass in conjuction with @ManyToOne, @ManyToMany, @OneToMany, @OneToOne and fun with @JoinTable, @JoinColumn and @JoinColumns. Once you know how these are supposed to work with the spec, it's not too bad to write it correctly each time. But there are some gotchas that will break things later on.
    Layer 1. Do the functions in the classes that don't depend on annotations work as expected. Typically, this is just going to be the getters and setters in your entity classes. Of course JUnit best practice says we don't bother testing functions that look like:
    public T getX() {
    return this.x;
    or
    public void setX(T x) {
    this.x = x;
    as there is nothing that can go wrong with them. So in that case, your level 1 tests will just be initial values specified from constructors and verifying that the non-get/set pairs work, and that the getters you have tagged @Transient work (because you've likely put some logic in them)
    Layer 2. Test the session bean methods that don't require injection to work.
    Layer 3. Test the session bean methods that require injection (Mock Objects). Simulate the injection for yourself, injecting Mock Objects for the entity manager. Then you can confirm that the correct methods are being called in the correct sequences, etc.
    [Note this may require some skill in designing the mock.  I'm working on developing my own entitymanager mock, and if it looks usefull I'll release it to the world.
    Layer 4. Test the session bean methods that require injection (Real entity manager) (See Layer 0)
    For this you will need an out of container persistence implementation.  Currently Hibernate and Glassfish provide beta versions.  You will need a different persistence.xml file that lists all the entities.  You will have to use reflection to inject the entity manager(s) that you create from an entity manager factory unless you provide a constructor that takes an EntityManager as a parameter.  You may need to use reflection to call any @PostConstruct method if you made it private.
    Layer 5. Navigate the relationships in the objects returned from Layer 4 using a database that has been loaded with test data.
    I am currently using Layers 0, 1, 2 & 4 to test my session beans and entity beans.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Do JNDI look up for entity beans from a session bean  in different  jars

    I have a problem doing entity beans JNDI look up from a session bean which is deployed
    as a separate package (session.jar) from the entity beans (entity.jar)
    I believe if both session bean and entity beans are deployed into one jar and
    I specify ejb-local-reference-description for session bean, it should work. However,
    due to some reason, they have to be in separated packages but still in the same
    container. Then question how to do JNDI lookup given entity beans only have local
    interfaces?
    FYI.
    1 both session.jar and entity.jar are self-contained. i.e., no deployment error.
    each JNDI name can be viewed from JNDI tree
    2. weblogic-ejb-jar.xml for session.jar
    <weblogic-ejb-jar>
    <description><![CDATA[Generated by XDoclet]]></description>
    <weblogic-enterprise-bean>
    <ejb-name>PetstoreLogic</ejb-name>
    <stateless-session-descriptor>
    </stateless-session-descriptor>
    <reference-descriptor>
    </reference-descriptor>
    <jndi-name>PetstoreLogic</jndi-name>
    <local-jndi-name>PetstoreLogicLocal</local-jndi-name>
    </weblogic-enterprise-bean>
    </weblogic-ejb-jar>
    3. weblogic-ejb-jar.xml (code snip) for entity.jar
    <weblogic-enterprise-bean>
    <ejb-name>Account</ejb-name>
    <entity-descriptor>
    <persistence>
    <persistence-type>
    <type-identifier>WebLogic_CMP_RDBMS</type-identifier>
    <type-version>6.0</type-version>
    <type-storage>META-INF/weblogic-cmp-rdbms-jar.xml</type-storage>
    </persistence-type>
    <persistence-use>
    <type-identifier>WebLogic_CMP_RDBMS</type-identifier>
    <type-version>6.0</type-version>
    </persistence-use>
    </persistence>
    </entity-descriptor>
    <reference-descriptor>
    </reference-descriptor>
    <local-jndi-name>net.sourceforge.cpetstore/AccountLocalHome</local-jndi-name>
    </weblogic-enterprise-bean>
    4. if I do
    accountLocalHome = (AccountLocalHome) ic.lookup("net/sourceforge/cpetstore/AccountLocalHome");
    get error like:
    javax.naming.LinkException: . Root exception is javax.naming.NameNotFoundException:
    While trying to look up /app/ejb/net.sourceforge.cpetstore-entity.jar#Account/local-home
    in /app/ejb/cpetstore-ejb.jar#PetstoreLogic.; remaining name '/app/ejb/net/sourceforge/cpetstore-entity/jar#Account/local-home'
         at weblogic.jndi.internal.BasicNamingNode.newNameNotFoundException(BasicNamingNode.java:869)
         at weblogic.jndi.internal.ApplicationNamingNode.lookup(ApplicationNamingNode.java:150)
         at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:338)

    In weblogic-ejb-jar.xml use jndi-name instead of local-jndi-name in reference-descriptor
    element.
    "Qiming He" <[email protected]> wrote:
    >
    I have a problem doing entity beans JNDI look up from a session bean
    which is deployed
    as a separate package (session.jar) from the entity beans (entity.jar)
    I believe if both session bean and entity beans are deployed into one
    jar and
    I specify ejb-local-reference-description for session bean, it should
    work. However,
    due to some reason, they have to be in separated packages but still in
    the same
    container. Then question how to do JNDI lookup given entity beans only
    have local
    interfaces?
    FYI.
    1 both session.jar and entity.jar are self-contained. i.e., no deployment
    error.
    each JNDI name can be viewed from JNDI tree
    2. weblogic-ejb-jar.xml for session.jar
    <weblogic-ejb-jar>
    <description><![CDATA[Generated by XDoclet]]></description>
    <weblogic-enterprise-bean>
    <ejb-name>PetstoreLogic</ejb-name>
    <stateless-session-descriptor>
    </stateless-session-descriptor>
    <reference-descriptor>
    </reference-descriptor>
    <jndi-name>PetstoreLogic</jndi-name>
    <local-jndi-name>PetstoreLogicLocal</local-jndi-name>
    </weblogic-enterprise-bean>
    </weblogic-ejb-jar>
    3. weblogic-ejb-jar.xml (code snip) for entity.jar
    <weblogic-enterprise-bean>
    <ejb-name>Account</ejb-name>
    <entity-descriptor>
    <persistence>
    <persistence-type>
    <type-identifier>WebLogic_CMP_RDBMS</type-identifier>
    <type-version>6.0</type-version>
    <type-storage>META-INF/weblogic-cmp-rdbms-jar.xml</type-storage>
    </persistence-type>
    <persistence-use>
    <type-identifier>WebLogic_CMP_RDBMS</type-identifier>
    <type-version>6.0</type-version>
    </persistence-use>
    </persistence>
    </entity-descriptor>
    <reference-descriptor>
    </reference-descriptor>
    <local-jndi-name>net.sourceforge.cpetstore/AccountLocalHome</local-jndi-name>
    </weblogic-enterprise-bean>
    4. if I do
    accountLocalHome = (AccountLocalHome) ic.lookup("net/sourceforge/cpetstore/AccountLocalHome");
    get error like:
    javax.naming.LinkException: . Root exception is javax.naming.NameNotFoundException:
    While trying to look up /app/ejb/net.sourceforge.cpetstore-entity.jar#Account/local-home
    in /app/ejb/cpetstore-ejb.jar#PetstoreLogic.; remaining name '/app/ejb/net/sourceforge/cpetstore-entity/jar#Account/local-home'
         at weblogic.jndi.internal.BasicNamingNode.newNameNotFoundException(BasicNamingNode.java:869)
         at weblogic.jndi.internal.ApplicationNamingNode.lookup(ApplicationNamingNode.java:150)
         at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:338)

  • Creating jar file for entity bean

    I am trying to deploy an entity bean..i compiled all the java files and created a dir by name META_INF and copied ejb-jar.xml
    and the other two .xml files which are needed to this dir. then using ,ant i tried to create the jar file ,,but it is giving the following error
    during the process ..PLs Help me
    Buildfile: build.xml
    clean:
    [delete] Deleting directory D:\ejb\entity\build
    [delete] Deleting directory D:\ejb\entity\dist
    init:
    [mkdir] Created dir: D:\ejb\entity\build
    [mkdir] Created dir: D:\ejb\entity\build\META-INF
    [mkdir] Created dir: D:\ejb\entity\dist
    compile_ejb:
    [javac] Compiling 3 source files to D:\ejb\entity\build
    jar_ejb:
    [jar] Building jar: D:\ejb\entity\dist\Cabin.jar
    ejbc:
    [java] java.io.FileNotFoundException: META-INF/ejb-jar.xml not found in jar file
    [java]      at weblogic.ejb20.dd.xml.DDUtils.getEntry(DDUtils.java:332)
    [java]      at weblogic.ejb20.dd.xml.DDUtils.getEjbJarXml(DDUtils.java:236)
    [java]      at weblogic.ejb20.dd.xml.DDUtils.loadEJBJarDescriptorFromJarFile(DDUtils.java:151)
    [java]      at weblogic.ejb20.dd.xml.DDUtils.createDescriptorFromJarFile(DDUtils.java:139)
    [java]      at weblogic.ejb20.dd.xml.DDUtils.createDescriptorFromJarFile(DDUtils.java:130)
    [java]      at weblogic.ejbc20.runBody(ejbc20.java:338)
    [java]      at weblogic.utils.compiler.Tool.run(Tool.java:79)
    [java]      at weblogic.ejbc.main(ejbc.java:21)
    [java] ERROR: java.io.FileNotFoundException: META-INF/ejb-jar.xml not found in jar file
    compile_webapp:
    Total time: 20 second

    The Ejb jar file structure for WebLogic server:
    META-INF/ejb-jar.xml
    META-INF/weblogic-ejb-jar.xml
    META-INF/weblogic-cmp-rdbms-jar.xml
    Ejb Bean Class
    Remote interface
    Home interface

  • Package structure suitable for entity beans

    hi,
    I have to manage some good number of entity beans ( around 250 )
    is it a good idea to package these beans.
    i mean what number of packages could be an idea one.
    currently we have 5 packages and around 50 beans will be in each.
    can anybody suggest on this..

    package structure should be based more on the business context rather than number of beans. Usually it is of the form..
    org/com.<company_name>.<proj_name>.<context>.entity
    for instance...a good package structe example is
    org.apache.log4j.Category !
    If you have customer and order beans then
    com.walmart.pos.customer.entity
    com.walmart.pos.order.entity
    hth...
    sanjay.

  • Object attribute for Entity Bean?

    Can I have an Object type attribute in an Entity Bean that must be mapped to a database. This Object will then only contain text attributes. For example,
    class UserBean {
    String name;
    Address address;
    class Address {
    String street;
    String streetnumber;
    In other words: Can I use EJB's to provide the same facility that an Object-Oriented Database provides?

    Providing you are not worried about referential integrity, CMP will do this automatically.

  • Whats 2-phase commit for

    hi guys
    i am curious, why JTA invent the 2-phase commit?
    whats it stand for? how we use it.
    thanks alot

    http://www.webopedia.com/TERM/T/two_phase_commit.html
    http://www.sei.cmu.edu/str/descriptions/dtpc.html
    or just google it.

  • 2 Phase Commit for ESB based Appliation

    If I wrote an application that needed two phase commit and I used Oracle ESB as the mechanism to link two different parts of the application together, would I have that capability?

    ESB supports global transactions such that if any XA endpoint fails, the others are rolled back. See the transaction/exception handling lesson on otn.oracle.com/goto/esb for details of how it works.

  • Type of Serialized Object for Entity Bean

    Hi,
    I develop a container managed persistence entity bean. I want to persist an object that is serializable into a database column. My database column type is a Blob. I wonder what is the type of a field in my entity bean? Please help. Thanks in advance.
    Cheers,
    Paul Ngo

    Providing you are not worried about referential integrity, CMP will do this automatically.

  • Help needed for entity bean

    i have this entity bean tat creates a new row in a mysql database... and using mysql query browser i see the record... but when using the bean to retrieve, it gives finderexception... i have to undeploy + redeploy to be able to retrieve the record... y is tat so?
    how can i solve this..? i'm using jboss.

    some parts of my code is listed as below...
    private static final String insertStatement = "INSERT INTO cards (cardid, imageid, musicid, message, createdby, recipientEmail, createddate) VALUES (?, ?, ?, ?, ?, ?, ?)";
    private static final String updateStatement = "UPDATE cards SET imageid=?, musicId=?, message=?, createdby=?, recipientEmail=?, createddate=? WHERE cardid=?";
    private static final String deleteStatement = "DELETE FROM cards WHERE cardid=?";
    private static final String findByPKStatement = "SELECT imageid, musicid, message, createdby, recipientEmail, createddate FROM cards WHERE cardid = ?";
    public String ejbCreate(String cardID, String imageID, String musicID, String message, String createdBy, String recipientEmail, java.sql.Date createdTime) throws CreateException {
    try {
    getDatabaseConnection();
    ps = connection.prepareStatement(insertStatement);
    ps.setString(1, cardID);
    ps.setString(2, imageID);
    ps.setString(3, musicID);
    ps.setString(4, message);
    ps.setString(5, createdBy);
    ps.setString(6, recipientEmail);
    ps.setDate(7, createdTime);
    if (ps.executeUpdate() != 1) {
    throw new CreateException("Failed to insert new record");
    } catch (SQLException e) {
    throw new CreateException(e.getMessage());
    } catch (Exception e) {
    } finally {
    try {
    ps.close();
    connection.close();
    } catch (Exception e) { }
    return cardID;
    public String ejbFindByPrimaryKey(String cardID) throws FinderException {       
    try {
    getDatabaseConnection();
    ps = connection.prepareStatement(findByPKStatement);
    ps.setString(1, cardID);
    ps.executeQuery();
    ResultSet rs = ps.getResultSet();
    if (rs.next()) {
    this.cardID = cardID;
    imageID = new String(rs.getString(1));
    musicID = new String(rs.getString(2));
    message = new String(rs.getString(3));
    createdBy = new String(rs.getString(4));
    recipientEmail = new String(rs.getString(5));
    createdTime = rs.getDate(6);
    } else {
    throw new FinderException("Failed to select this Primary Key");
    } catch (SQLException e) {
    throw new FinderException(e.getMessage());
    } catch (Exception e) {
    } finally {
    try {
    ps.close();
    connection.close();
    } catch (Exception e) { }
    return cardID;
    private void getDatabaseConnection() throws NamingException, SQLException {
    InitialContext ctx = new InitialContext();
    String connectionURL = "jdbc:mysql://localhost:3306/card";
    try {
    Class.forName("com.mysql.jdbc.Driver").newInstance();
    connection = DriverManager.getConnection(connectionURL, "root", "123");
    catch (Exception e) {     }
    }

  • Which WebLogic XDoclet Properties to set for Entity Beans

    I have no documentation about howto set the WebLogic XDoclet properties (in a EJB Project).
    The Entity Beans used by me, are CMP's accessing an Oracle Data Source (allready setup by me in the WebLogic console).
    If someone knows documentation about this, or some example of a CMP (with @weblogic tags) that is backed by an Oracle table, I will appreciate that very much

    Hi ,
    Go through the following link,In that you will find the weblogic tags and will get some needfull information on this issue.
    http://dev2dev.bea.com/pub/a/2002/03/243.html
    Regards
    Anilkumar kari

Maybe you are looking for

  • Print a string on a specific printer

    Hello everyone, I need some help. I have to print a string in LabView. Previously the method used was to set on the option "Automatically print front panel every time VI completes execution" in the Print Options of the VI Properties. Now, however, I

  • Can you create an object from a string

    I have been working on creating a dynamic form, creating the form items from an xml file. I am getting very close to conquering this task. I will share it when it's complete. However, I am stuck at the moment trying to create an object from a string.

  • Auto update of file from laptop to ipad?

    Does anyone know if I sync an existing document from my laptop to my ipad via pages, then work on it on the ipad, will it update the existing file on the laptop when I sync overall?

  • Text Field is Blank in Transaction F-28

    Hi Experts, There is a requirement to add to the current layout the text field in F-28 transaction code. However, when I add them as an administrator, The text field is blank. We already maintained the text field in both Accounting Document Line item

  • Transferring music from ipad to computer to put on a cd

    I bought music from itunes on my ipad, I want to transfer it to my computer so I can put it on a cd to play in my truck. I tried to select and drag over and copy and past it wont allow me. Please tell me that I can do this, Ive purchased alot of musi