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;

Similar Messages

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

  • Bean-Managed Transaction and xDoclet

    Hi,
    i am new by xDoclet.
    Does anybody know, how to specify Bean-Managed Transaction by EJB using xDoclet.
    Thank you very much for any hint or link.
    --Eugen                                                                                                                                                                                                                                                                                                                           

    Thanks Dhiraj for helping,
    I have a application module called TestAppModule. TestAppModule should be deployed as Bean Managed Service Bean. In the Remote of the Application Module, I chose BmtServiceBean. 3 files were created
    RemoteTestAppModule.java
    TestAppModuleHome.java
    TestAppModuleServer.java
    In ejb-jar.xml, this tag was added
    <enterprise-beans>
    <session>
    <description>Session Bean ( Stateful )</description>
    <display-name>TestAppModule</display-name>
    <ejb-name>testBc4jComponents.TestAppModule_bmservice</ejb-name>
    <home>testBc4jComponents.common.serviceejb.beanmanaged.TestAppModuleHome</home>
    <remote>testBc4jComponents.common.serviceejb.beanmanaged.RemoteTestAppModule</remote>
    <ejb-class>testBc4jComponents.server.serviceejb.beanmanaged.TestAppModuleServer</ejb-class>
    <session-type>Stateful</session-type>
    <transaction-type>Bean</transaction-type>
    </session>
    </enterprise-beans>
    In Orion-ejb-jar.xml
    <session-deployment name="testBc4jComponents.TestAppModule_bmservice"/>
    I deployed the bean into oc4j.
    In the Bean Where I am managing the Transaction.
    Context ctx = new InitialContext();
    Object home = ctx.lookup("testBc4jComponents.TestAppModule_bmservice");
    TestAppModuleHome testAppHome = (TestAppModuleHome) PortableRemoteObject.narrow(home, TestAppModuleHome.class);
    When I am looking up the Appmodule Bean, I reached an error stating "Serialization Error, The TestAppModuleImpl is not Serializable"
    Please let me know what I am doing wrong?
    Thanks
    Senthil

  • 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

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

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

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

  • Bean meanged persistence

    I am trying to execute EJB example on bean managed persistence from the book
    It give me this error:
    Error unmarshalling return; nested exception is:
    java.io.invalidclassException:c8e.z.a;class invlaid for serailization
    I tried examples from the net but same error shows up
    please help me regarding this

    Hey it returns the string object ...
    here is snippet of my EJB and Client code........
    import java.sql.*;
    import javax.sql.*;
    import java.util.*;
    import javax.ejb.*;
    import javax.naming.*;
    public class AccountEJB implements EntityBean {
    private String id;
    private String firstName;
    private String lastName;
    private double balance;
    private EntityContext context;
    private Connection con;
    private String dbName = "java:comp/env/jdbc/account";
    public void debit(double amount)
    throws InsufficientBalanceException {
    if (balance - amount < 0) {
    throw new InsufficientBalanceException();
    balance -= amount;
    public void credit(double amount) {
    balance += amount;
    public String getFirstName() {
    return firstName;
    public String getLastName() {
    return lastName;
    public double getBalance() {
    return balance;
    public String ejbCreate(String id, String firstName,
    String lastName, double balance)
    throws CreateException {
    if (balance < 0.00) {
    throw new CreateException
    ("A negative initial balance is not allowed.");
    try {
    insertRow(id, firstName, lastName, balance);
    } catch (Exception ex) {
    throw new EJBException("ejbCreate: " +
    ex.getMessage());
    this.id = id;
    this.firstName = firstName;
    this.lastName = lastName;
    this.balance = balance;
    return id;
    client code::::::::::::
    public class AccountClient {
    public static void main(String[] args) {
    try {
    Context initial = new InitialContext();
    Object objref = initial.lookup("MyAccount");
    AccountHome home =
    (AccountHome)PortableRemoteObject.narrow(objref,
    AccountHome.class);
    Account duke = home.create("123", "Duke", "Earl", 0.00);
    duke.credit(88.50);

  • 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

  • System and Query field disable in Data Manager for Netweaver BI

    Dear All.
    i have installed Xcelsius Engage Server 2008, when i try to add connection for SAP Netweaver BI from the Data Manager the dialog appears correctly but in Defination TAB only the Name field is enable both System and Query field is disable.
    without that how can i configure the connection please let me know how to fix this issue.
    Kind regards,

    Hi,
    You give the name of the connection and then click on "Browse".  It will then prompt you to connect to the desired system.  Log in and then select the appropriate query you want to build a dashboard on.
    Hope this helps.
    Regards,
    RashmiG

  • Two phase commit and bean managed transactions

    To all the Transaction GURUS!
              Hi guys (-and gals).
              I've been doing J2EE for quite a while, but today was my first at
              XA-Transactions and Bean Managed Transactions.
              Why am I doing this?
              ====================
              Well I have to be able to controll the transactionalbehaviour of my
              bean
              during runtime, since some bean calls would cause a transactional
              overflow due to the stress they would cause to the system, whereas
              smaller bean calls need to run in one transaction.
              -> Therefore I need Bean Managed Transactions
              Since the bean does a call on two Database Connections it has to use a
              XA-Transaction.
              -> Therefore I need XA-Transactions.
              Abstract
              ========
              - I just can't get a User TransAction into the right Status it stays
              in 'STATUS_NO_TRANSACTION' all the time
              - Therefore the SQL Commands can be comitted 'java.sql.SQLException:
              Does not support SQL execution with no global transaction'
              - Therefore I can't do a rollback 'java.lang.IllegalStateException:
              Transaction does not exist'
              - Therefore I wrote this mail.
              I don't want to be a smart-"ass" writing such a detailed and indepth
              mail. I just would like to show that I tried, and would like to have
              some replies from you guys.
              Below are my configurations, code and logfiles.
              Thanx for taking your time and hope that the other people may learn
              something as well.
              cu
              Stefan
              Scenario
              ========
              used Software
              Bea Weblogic (WL) 6.0 SPx (not real sure which SP i have)
              Oracle 8.1.6 using the API-Version 8
              I configured the system as follows:
              (ofcourse I 'xxx'ed out all of the confidential data, sorry guys;-))
              excerpt from:
              config.xml
              <JDBCConnectionPool CapacityIncrement="5"
              DriverName="oracle.jdbc.driver.OracleDriver" InitialCapacity="2"
              LoginDelaySeconds="1" MaxCapacity="5" Name="oraclePool"
              Properties="user=xxx;password=xxx;dll=ocijdbc8;protocol=thin"
              RefreshMinutes="5" Targets="fbsserver" TestConnectionsOnRelease="true"
              TestTableName="languages" URL="jdbc:oracle:thin:@xxx:1521:xxx "/>
              <!-- Since this is our Main Datasource I would not like to use a XA
              Transaction due to performance Issues
              and the TxDataSource:
              -->
              <JDBCTxDataSource EnableTwoPhaseCommit="true"
              JNDIName="finstral.datasource.fbs" Name="finstral Content Datasource"
              PoolName="oraclePool" Targets="fbsserver"/>
              <!-- no comment required -I hope.
              Next comes the "special" Pool
              -->
              <JDBCConnectionPool CapacityIncrement="5"
              DriverName="weblogic.jdbc.oci.xa.XADataSource" InitialCapacity="1"
              LoginDelaySeconds="1" MaxCapacity="2" Name="oracleSecurityPool"
              Properties="user=xxx;password=xxx;server=xxx.xxx.xxx"
              RefreshMinutes="5" Targets="fbsserver" TestConnectionsOnRelease="true"
              TestTableName="Users" SupportsLocalTransaction="true"/>
              <!-- Well since there can only be one none XARessourceManager involved
              in a 2PC
              (keyword: Two Phase Commit) I will have to use a XACapable Driver for
              the other
              Datasource. Due to all the bugs in the oracle.xxx driver. I'll be
              using the jdriver for oci.
              I activated 'SupportsLocalTransaction' hoping it would solve my
              problem - without effect. I just left in there now, since it made
              sense me. Not?
              Again the TxDataSource:
              -->
              <JDBCTxDataSource EnableTwoPhaseCommit="true"
              JNDIName="finstral.datasource.fbssecurity" Name="finstral Security
              Datasource" PoolName="oracleSecurityPool" Targets="fbsserver"/>
              <!-- The System starts right up and can locate the test tables and
              everything. So I think all of this stuff is working here -->
              ejb-jar.xml
              <ejb-jar>
                   <enterprise-beans>
                        <session>
                             <ejb-name>TPCTestBean</ejb-name>
              <home>de.sitewaerts.futuna.common.test.tpcbean.TPCHome</home>
              <remote>de.sitewaerts.futuna.common.test.tpcbean.TPC</remote>
              <ejb-class>de.sitewaerts.futuna.common.test.tpcbean.TPCBean</ejb-class>
                             <session-type>Stateless</session-type>
                             <transaction-type>Bean</transaction-type>
                        </session>
                   </enterprise-beans>
                   <assembly-descriptor/>
              </ejb-jar>
              <!-- Originally I had the assembly-descriptor full of transaction
              requirements. I thought since
              the bean is handling all of the transaction stuff itself, it might get
              confused by the 'container-transaction'
              properties, and deleted them. Do I need them anyway?-->
              weblogic-ejb-jar.xml
              <weblogic-ejb-jar>
                   <weblogic-enterprise-bean>
                        <ejb-name>TPCTestBean</ejb-name>
                        <stateless-session-descriptor/>
                        <jndi-name>finstral/ejb/test_tpc</jndi-name>
                   </weblogic-enterprise-bean>
              </weblogic-ejb-jar>
              <!-- Nothing I have to explain here -->
              BeanCode (from the implementingBeanClass:
              'de.sitewaerts.futuna.common.test.tpcbean.TPCBean')
              public void setupTables() throws RemoteException
              UserTransaction tx = getTransaction();
              //getTransaction calls: 'tx = sCtx.getUserTransaction()' and does
              some errorhandling
              log.info("Die Transaktion vor den Connections: "+tx.toString());
              //Sorry bout the German. You should get the Message though.
              log.info("Der Transaktionsstatus vor den Connections:
              "+transactionStatus(tx));
              Connection conSecurity = getConnection(DATASOURCE_SECURITY, tx);
              //gets a Connection via a DataSourceName from the JNDI tree
              Connection conContent = getConnection(DATASOURCE_CONTENT, tx);
              log.info("Die frische Connection conSecurity: "+conSecurity);
              log.info("Die frische Connection conContent: "+conContent);
              tearDownTable(conSecurity);
              //Does nothing special
              tearDownTable(conContent);
              log.info("Die Transaktion nach dem Teardown: "+tx.toString());
              log.info("Der Transaktionsstatus nach dem Teardown:
              "+transactionStatus(tx));
              Statement stmt = null;
              try
              stmt = conSecurity.createStatement();
              //Well its getting interesting now.....
              log.info("Die Transaktion vor dem createtable: "+tx.toString());
              log.info("Der Transaktionsstatus vor dem createtable:
              "+transactionStatus(tx));
              log.info("Die Connection conSecurity vor dem createtable:
              "+conSecurity);
              log.info("Die Connection conContent vor dem createtable:
              "+conContent);
              stmt.executeUpdate(CREATE_TABLE);
              //above is the row 91 -> throws: 'java.sql.SQLException: Does
              not support SQL execution with no global transaction'
              stmt.close();
              stmt = conContent.createStatement();
              stmt.executeUpdate(CREATE_TABLE);
              stmt.close();
              commitTransaction(tx);
              catch (SQLException sqle)
              log.error("Konnte kein table init machen", sqle);
              rollbackTransaction(tx);
              //The Code for this method is below
              throw new EJBException(sqle);
              finally
              closeConnection(conSecurity);
              closeConnection(conContent);
              protected void rollbackTransaction(UserTransaction tx)
              log.info("Der Transaktionsstatus vor dem Rollback:
              "+transactionStatus(tx));
              log.info("Die Transaktion vor dem Rollback: "+tx.toString());
              try
              tx.rollback();
              //above is row 200 -> throws: 'java.lang.IllegalStateException:
              Transaction does not exist'
              log.info("Der Transaktionsstatus nach dem Rollback:
              "+transactionStatus(tx));
              log.info("Die Transaktion nach dem Rollback: "+tx.toString());
              catch (Exception e)
              log.error("Konnte die Transaktion nicht backrollen.", e);
              throw new EJBException(e);
              Log Excerpt
              ===========
              INFO setupTables() (66) - Die Transaktion vor den Connections:
              [email protected]
              INFO setupTables() (67) - Der Transaktionsstatus vor den Connections:
              STATUS_NO_TRANSACTION
              INFO setupTables() (72) - Die frische Connection conSecurity:
              weblogic.jdbc.rmi.SerialConnection@7c6daa
              INFO setupTables() (73) - Die frische Connection conContent:
              weblogic.jdbc.rmi.SerialConnection@3b425
              INFO setupTables() (78) - Die Transaktion nach dem Teardown:
              [email protected]
              INFO setupTables() (79) - Der Transaktionsstatus nach dem Teardown:
              STATUS_NO_TRANSACTION
              INFO setupTables() (86) - Die Transaktion vor dem createtable:
              [email protected]
              INFO setupTables() (87) - Der Transaktionsstatus vor dem createtable:
              STATUS_NO_TRANSACTION
              INFO setupTables() (88) - Die Connection conSecurity vor dem
              createtable: weblogic.jdbc.rmi.SerialConnection@7c6daa
              INFO setupTables() (89) - Die Connection conContent vor dem
              createtable: weblogic.jdbc.rmi.SerialConnection@3b425
              ERROR setupTables() (101) - Konnte kein table init machen
              java.sql.SQLException: Does not support SQL execution with no global
              transaction
                   at
              weblogic.jdbc.oci.xa.XAConnection.beforeExecute(XAConnection.java:137)
                   at
              weblogic.jdbc.oci.xa.Statement.executeUpdate(Statement.java:112)
                   at weblogic.jdbc.jta.Statement.executeUpdate(Statement.java:185)
                   at
              weblogic.jdbc.rmi.internal.StatementImpl.executeUpdate(StatementImpl.jav
              a:42)
                   at
              weblogic.jdbc.rmi.SerialStatement.executeUpdate(SerialStatement.java:54)
                   at
              de.sitewaerts.futuna.common.test.tpcbean.TPCBean.setupTables(TPCBean.jav
              a:91)
                   at
              de.sitewaerts.futuna.common.test.tpcbean.TPCBeanImpl.setupTables(TPCBean
              Impl.java:130)
                   at
              de.sitewaerts.futuna.common.test.tpcbean.TPCBeanEOImpl.setupTables(TPCBe
              anEOImpl.java:64)
                   at
              de.sitewaerts.futuna.common.test.TwoPhaseCommitUnitTest.setUp(TwoPhaseCo
              mmitUnitTest.java:51)
                   at
              org.apache.commons.cactus.AbstractTestCase.runBareServerTest(AbstractTes
              tCase.java:297)
                   at
              org.apache.commons.cactus.server.ServletTestCaller.callTestMethod(Servle
              tTestCaller.java:148)
                   at
              org.apache.commons.cactus.server.ServletTestCaller.doTest(ServletTestCal
              ler.java:199)
                   at
              org.apache.commons.cactus.server.ServletTestRedirector.doPost(ServletTes
              tRedirector.java:149)
                   at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
                   at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
                   at
              weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.
              java:213)
                   at
              weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServl
              etContext.java:1265)
                   at
              weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.
              java:1631)
                   at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137)
                   at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
              INFO rollbackTransaction() (196) - Der Transaktionsstatus vor dem
              Rollback: STATUS_NO_TRANSACTION
              INFO rollbackTransaction() (197) - Die Transaktion vor dem Rollback:
              [email protected]
              ERROR rollbackTransaction() (206) - Konnte die Transaktion nicht
              backrollen.
              java.lang.IllegalStateException: Transaction does not exist
                   at
              weblogic.transaction.internal.TransactionManagerImpl.rollback(Transactio
              nManagerImpl.java:228)
                   at
              weblogic.transaction.internal.TransactionManagerImpl.rollback(Transactio
              nManagerImpl.java:222)
                   at
              de.sitewaerts.futuna.common.test.tpcbean.TPCBean.rollbackTransaction(TPC
              Bean.java:200)
                   at
              de.sitewaerts.futuna.common.test.tpcbean.TPCBean.setupTables(TPCBean.jav
              a:102)
                   at
              de.sitewaerts.futuna.common.test.tpcbean.TPCBeanImpl.setupTables(TPCBean
              Impl.java:130)
                   at
              de.sitewaerts.futuna.common.test.tpcbean.TPCBeanEOImpl.setupTables(TPCBe
              anEOImpl.java:64)
                   at
              de.sitewaerts.futuna.common.test.TwoPhaseCommitUnitTest.setUp(TwoPhaseCo
              mmitUnitTest.java:51)
                   at
              org.apache.commons.cactus.AbstractTestCase.runBareServerTest(AbstractTes
              tCase.java:297)
                   at
              org.apache.commons.cactus.server.ServletTestCaller.callTestMethod(Servle
              tTestCaller.java:148)
                   at
              org.apache.commons.cactus.server.ServletTestCaller.doTest(ServletTestCal
              ler.java:199)
                   at
              org.apache.commons.cactus.server.ServletTestRedirector.doPost(ServletTes
              tRedirector.java:149)
                   at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
                   at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
                   at
              weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.
              java:213)
                   at
              weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServl
              etContext.java:1265)
                   at
              weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.
              java:1631)
                   at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137)
                   at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
              CONCLUSION
              ==========
              I'm going nuts.
              I just don't get it.
              The transaction is the same. I don't change the Connection. I start
              the Transaction at the beginning before I do anything!
              Please guys help me out.
              Thx alot.
              Stefan "it's three o'clock in the morning, my girlfriend left me, and
              my only friend is that stupid linux pinguine" Siprell
              Software-Development
              <<<<<<<<<<<<<<<<<<<<<<<<<<<
              <sitewaerts> GmbH
              Hebelstraße 15
              D-76131 Karlsruhe
              Tel: +49 (721) 920 918 22
              Fax: +49 (721) 920 918 29
              http://www.sitewaerts.de
              >>>>>>>>>>>>>>>>>>>>>>>>>>>
              

    Hi Priscilla
              (did you ever see the movie ? :-))
              Well I moved away from the idea of using bean managed transaction. I'll
              be using Container Managed Transactions. To modify the
              transactionalbehaviour I'll write proxymethods which have certain
              different containermanaged transaction properties, but which all call
              the same private methods.
              But it works! Here is my experience:
              - I was doing a DDL statement: I was trying to create new Tables, which
              is a definite "no-go"
              - pay careful attention to:
              http://edocs.bea.com/wls/docs60/jta/trxejb.html#1051405
                        and
              http://edocs.bea.com/wls/docs60/jta/trxejb.html#1051741
              and use these Settings for the Pool, don't ask me why, but it took me
              hours to find it out by myself:
                   <JDBCConnectionPool CapacityIncrement="5"
              DriverName="weblogic.jdbc.oci.xa.XADataSource" InitialCapacity="1"
              LoginDelaySeconds="1" MaxCapacity="2" Name="oracleSecurityPool"
              Properties="user=xxx; password=xxx; server=xxx.xxx.xxx"
              RefreshMinutes="5" Targets="fbsserver" TestConnectionsOnRelease="true"
              TestTableName="Users" SupportsLocalTransaction="true"/>
              where as the server (shown as: xxx.xxx.xxx) is the TNS Name of the
              Oracle Driver.
              It works great.
              Another thing you guys might want to do is write a simple StatelessSB
              which does JDBC calls and two different database Connections.
              Then write a UnitTest which calls this bean a couple hundred times (with
              the same transaction). Have one test do clean writes, and another which
              causes some SQL-Exception (too long Data Columns, or likewise).
              Always count the entries and see if everything worked out. We're using
              this SetupConstruction to test new combinations of AS(sorry Priscilla) /
              Database / Db-Drivers to have a "standard test".
              I know my two cents were uncalled for, but it might save you some
              time.....
              thanx for your help
              Stefan
              -----Ursprüngliche Nachricht-----
              Von: Priscilla Fung [mailto:[email protected]]
              Bereitgestellt: Donnerstag, 2. August 2001 21:42
              Bereitgestellt in: transaction
              Unterhaltung: Two phase commit and bean managed transactions
              Betreff: Re: Two phase commit and bean managed transactions
              Hi Stefan,
              Looks like you have not actually begun a transaction by calling
              UserTransaction.begin(),
              so your setupTables method is really executing with no transaction
              context.
              Priscilla
              Stefan Siprell <[email protected]> wrote:
              >To all the Transaction GURUS!
              >
              >Hi guys (-and gals).
              >I've been doing J2EE for quite a while, but today was my first at
              >XA-Transactions and Bean Managed Transactions.
              >
              >Why am I doing this?
              >====================
              >Well I have to be able to controll the transactionalbehaviour of my
              >bean
              >during runtime, since some bean calls would cause a transactional
              >overflow due to the stress they would cause to the system, whereas
              >smaller bean calls need to run in one transaction.
              >-> Therefore I need Bean Managed Transactions
              >Since the bean does a call on two Database Connections it has to use
              >a
              >XA-Transaction.
              >-> Therefore I need XA-Transactions.
              >
              >Abstract
              >========
              >- I just can't get a User TransAction into the right Status it stays
              >in 'STATUS_NO_TRANSACTION' all the time
              >- Therefore the SQL Commands can be comitted 'java.sql.SQLException:
              >Does not support SQL execution with no global transaction'
              >- Therefore I can't do a rollback 'java.lang.IllegalStateException:
              >Transaction does not exist'
              >- Therefore I wrote this mail.
              >
              >I don't want to be a smart-"ass" writing such a detailed and indepth
              >mail. I just would like to show that I tried, and would like to have
              >some replies from you guys.
              >
              >Below are my configurations, code and logfiles.
              >
              >Thanx for taking your time and hope that the other people may learn
              >something as well.
              >
              >cu
              >
              >Stefan
              >
              >
              >Scenario
              >========
              >
              >used Software
              >-------------
              >Bea Weblogic (WL) 6.0 SPx (not real sure which SP i have)
              >Oracle 8.1.6 using the API-Version 8
              >
              >
              >I configured the system as follows:
              >(ofcourse I 'xxx'ed out all of the confidential data, sorry guys;-))
              >excerpt from:
              >
              >config.xml
              >----------
              ><JDBCConnectionPool CapacityIncrement="5"
              >DriverName="oracle.jdbc.driver.OracleDriver" InitialCapacity="2"
              >LoginDelaySeconds="1" MaxCapacity="5" Name="oraclePool"
              >Properties="user=xxx;password=xxx;dll=ocijdbc8;protocol=thin"
              >RefreshMinutes="5" Targets="fbsserver" TestConnectionsOnRelease="true"
              >TestTableName="languages" URL="jdbc:oracle:thin:@xxx:1521:xxx "/>
              >
              ><!-- Since this is our Main Datasource I would not like to use a XA
              >Transaction due to performance Issues
              >and the TxDataSource:
              >-->
              >
              ><JDBCTxDataSource EnableTwoPhaseCommit="true"
              >JNDIName="finstral.datasource.fbs" Name="finstral Content Datasource"
              >PoolName="oraclePool" Targets="fbsserver"/>
              >
              ><!-- no comment required -I hope.
              >Next comes the "special" Pool
              >-->
              >
              ><JDBCConnectionPool CapacityIncrement="5"
              >DriverName="weblogic.jdbc.oci.xa.XADataSource" InitialCapacity="1"
              >LoginDelaySeconds="1" MaxCapacity="2" Name="oracleSecurityPool"
              >Properties="user=xxx;password=xxx;server=xxx.xxx.xxx"
              >RefreshMinutes="5" Targets="fbsserver" TestConnectionsOnRelease="true"
              >TestTableName="Users" SupportsLocalTransaction="true"/>
              >
              ><!-- Well since there can only be one none XARessourceManager involved
              >in a 2PC
              >(keyword: Two Phase Commit) I will have to use a XACapable Driver for
              >the other
              >Datasource. Due to all the bugs in the oracle.xxx driver. I'll be
              >using the jdriver for oci.
              >I activated 'SupportsLocalTransaction' hoping it would solve my
              >problem - without effect. I just left in there now, since it made
              >sense me. Not?
              >Again the TxDataSource:
              >-->
              >
              ><JDBCTxDataSource EnableTwoPhaseCommit="true"
              >JNDIName="finstral.datasource.fbssecurity" Name="finstral Security
              >Datasource" PoolName="oracleSecurityPool" Targets="fbsserver"/>
              >
              ><!-- The System starts right up and can locate the test tables and
              >everything. So I think all of this stuff is working here -->
              >
              >
              >
              >ejb-jar.xml
              >-----------
              ><ejb-jar>
              >     <enterprise-beans>
              >          <session>
              >               <ejb-name>TPCTestBean</ejb-name>
              >     
              ><home>de.sitewaerts.futuna.common.test.tpcbean.TPCHome</home>
              >     
              ><remote>de.sitewaerts.futuna.common.test.tpcbean.TPC</remote>
              >     
              ><ejb-class>de.sitewaerts.futuna.common.test.tpcbean.TPCBean</ejb-class>
              >               <session-type>Stateless</session-type>
              >               <transaction-type>Bean</transaction-type>
              >          </session>
              >     </enterprise-beans>
              >     <assembly-descriptor/>
              ></ejb-jar>
              >
              ><!-- Originally I had the assembly-descriptor full of transaction
              >requirements. I thought since
              >the bean is handling all of the transaction stuff itself, it might get
              >confused by the 'container-transaction'
              >properties, and deleted them. Do I need them anyway?-->
              >
              >weblogic-ejb-jar.xml
              >--------------------
              ><weblogic-ejb-jar>
              >     <weblogic-enterprise-bean>
              >          <ejb-name>TPCTestBean</ejb-name>
              >          <stateless-session-descriptor/>
              >          <jndi-name>finstral/ejb/test_tpc</jndi-name>
              >     </weblogic-enterprise-bean>
              ></weblogic-ejb-jar>
              >
              ><!-- Nothing I have to explain here -->
              >
              >BeanCode (from the implementingBeanClass:
              >'de.sitewaerts.futuna.common.test.tpcbean.TPCBean')
              >-----------------------------------------------------------------------
              >---------------------
              >
              > public void setupTables() throws RemoteException
              > {
              > UserTransaction tx = getTransaction();
              > //getTransaction calls: 'tx = sCtx.getUserTransaction()' and does
              >some errorhandling
              >
              > log.info("Die Transaktion vor den Connections: "+tx.toString());
              > //Sorry bout the German. You should get the Message though.
              > log.info("Der Transaktionsstatus vor den Connections:
              >"+transactionStatus(tx));
              >
              > Connection conSecurity = getConnection(DATASOURCE_SECURITY, tx);
              > //gets a Connection via a DataSourceName from the JNDI tree
              > Connection conContent = getConnection(DATASOURCE_CONTENT, tx);
              >
              > log.info("Die frische Connection conSecurity: "+conSecurity);
              > log.info("Die frische Connection conContent: "+conContent);
              >
              > tearDownTable(conSecurity);
              > //Does nothing special
              > tearDownTable(conContent);
              >
              > log.info("Die Transaktion nach dem Teardown: "+tx.toString());
              > log.info("Der Transaktionsstatus nach dem Teardown:
              >"+transactionStatus(tx));
              >
              > Statement stmt = null;
              > try
              > {
              > stmt = conSecurity.createStatement();
              > //Well its getting interesting now.....
              >
              > log.info("Die Transaktion vor dem createtable: "+tx.toString());
              > log.info("Der Transaktionsstatus vor dem createtable:
              >"+transactionStatus(tx));
              > log.info("Die Connection conSecurity vor dem createtable:
              >"+conSecurity);
              > log.info("Die Connection conContent vor dem createtable:
              >"+conContent);
              >
              > stmt.executeUpdate(CREATE_TABLE);
              > //above is the row 91 -> throws: 'java.sql.SQLException: Does
              >not support SQL execution with no global transaction'
              >
              > stmt.close();
              >
              > stmt = conContent.createStatement();
              > stmt.executeUpdate(CREATE_TABLE);
              > stmt.close();
              > commitTransaction(tx);
              > }
              > catch (SQLException sqle)
              > {
              > log.error("Konnte kein table init machen", sqle);
              > rollbackTransaction(tx);
              > //The Code for this method is below
              > throw new EJBException(sqle);
              > }
              > finally
              > {
              > closeConnection(conSecurity);
              > closeConnection(conContent);
              > }
              > }
              >
              > protected void rollbackTransaction(UserTransaction tx)
              > {
              > log.info("Der Transaktionsstatus vor dem Rollback:
              >"+transactionStatus(tx));
              > log.info("Die Transaktion vor dem Rollback: "+tx.toString());
              > try
              > {
              > tx.rollback();
              > //above is row 200 -> throws: 'java.lang.IllegalStateException:
              >Transaction does not exist'
              > log.info("Der Transaktionsstatus nach dem Rollback:
              >"+transactionStatus(tx));
              > log.info("Die Transaktion nach dem Rollback: "+tx.toString());
              > }
              > catch (Exception e)
              > {
              > log.error("Konnte die Transaktion nicht backrollen.", e);
              > throw new EJBException(e);
              > }
              > }
              >
              >Log Excerpt
              >===========
              >INFO setupTables() (66) - Die Transaktion vor den Connections:
              >[email protected]
              >INFO setupTables() (67) - Der Transaktionsstatus vor den Connections:
              >STATUS_NO_TRANSACTION
              >INFO setupTables() (72) - Die frische Connection conSecurity:
              >weblogic.jdbc.rmi.SerialConnection@7c6daa
              >INFO setupTables() (73) - Die frische Connection conContent:
              >weblogic.jdbc.rmi.SerialConnection@3b425
              >INFO setupTables() (78) - Die Transaktion nach dem Teardown:
              >[email protected]
              >INFO setupTables() (79) - Der Transaktionsstatus nach dem Teardown:
              >STATUS_NO_TRANSACTION
              >INFO setupTables() (86) - Die Transaktion vor dem createtable:
              >[email protected]
              >INFO setupTables() (87) - Der Transaktionsstatus vor dem createtable:
              >STATUS_NO_TRANSACTION
              >INFO setupTables() (88) - Die Connection conSecurity vor dem
              >createtable: weblogic.jdbc.rmi.SerialConnection@7c6daa
              >INFO setupTables() (89) - Die Connection conContent vor dem
              >createtable: weblogic.jdbc.rmi.SerialConnection@3b425
              >ERROR setupTables() (101) - Konnte kein table init machen
              >java.sql.SQLException: Does not support SQL execution with no global
              >transaction
              >     at
              >weblogic.jdbc.oci.xa.XAConnection.beforeExecute(XAConnection.java:137)
              >     at
              >weblogic.jdbc.oci.xa.Statement.executeUpdate(Statement.java:112)
              >     at weblogic.jdbc.jta.Statement.executeUpdate(Statement.java:185)
              >     at
              >weblogic.jdbc.rmi.internal.StatementImpl.executeUpdate(StatementImpl.ja
              v
              >a:42)
              >     at
              >weblogic.jdbc.rmi.SerialStatement.executeUpdate(SerialStatement.java:54
              >     at
              >de.sitewaerts.futuna.common.test.tpcbean.TPCBean.setupTables(TPCBean.ja
              v
              >a:91)
              >     at
              >de.sitewaerts.futuna.common.test.tpcbean.TPCBeanImpl.setupTables(TPCBea
              n
              >Impl.java:130)
              >     at
              >de.sitewaerts.futuna.common.test.tpcbean.TPCBeanEOImpl.setupTables(TPCB
              e
              >anEOImpl.java:64)
              >     at
              >de.sitewaerts.futuna.common.test.TwoPhaseCommitUnitTest.setUp(TwoPhaseC
              o
              >mmitUnitTest.java:51)
              >     at
              >org.apache.commons.cactus.AbstractTestCase.runBareServerTest(AbstractTe
              s
              >tCase.java:297)
              >     at
              >org.apache.commons.cactus.server.ServletTestCaller.callTestMethod(Servl
              e
              >tTestCaller.java:148)
              >     at
              >org.apache.commons.cactus.server.ServletTestCaller.doTest(ServletTestCa
              l
              >ler.java:199)
              >     at
              >org.apache.commons.cactus.server.ServletTestRedirector.doPost(ServletTe
              s
              >tRedirector.java:149)
              >     at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
              >     at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
              >     at
              >weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl
              >java:213)
              >     at
              >weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServ
              l
              >etContext.java:1265)
              >     at
              >weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl
              >java:1631)
              >     at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137)
              >     at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
              >INFO rollbackTransaction() (196) - Der Transaktionsstatus vor dem
              >Rollback: STATUS_NO_TRANSACTION
              >INFO rollbackTransaction() (197) - Die Transaktion vor dem Rollback:
              >[email protected]
              >ERROR rollbackTransaction() (206) - Konnte die Transaktion nicht
              >backrollen.
              >java.lang.IllegalStateException: Transaction does not exist
              >     at
              >weblogic.transaction.internal.TransactionManagerImpl.rollback(Transacti
              o
              >nManagerImpl.java:228)
              >     at
              >weblogic.transaction.internal.TransactionManagerImpl.rollback(Transacti
              o
              >nManagerImpl.java:222)
              >     at
              >de.sitewaerts.futuna.common.test.tpcbean.TPCBean.rollbackTransaction(TP
              C
              >Bean.java:200)
              >     at
              >de.sitewaerts.futuna.common.test.tpcbean.TPCBean.setupTables(TPCBean.ja
              v
              >a:102)
              >     at
              >de.sitewaerts.futuna.common.test.tpcbean.TPCBeanImpl.setupTables(TPCBea
              n
              >Impl.java:130)
              >     at
              >de.sitewaerts.futuna.common.test.tpcbean.TPCBeanEOImpl.setupTables(TPCB
              e
              >anEOImpl.java:64)
              >     at
              >de.sitewaerts.futuna.common.test.TwoPhaseCommitUnitTest.setUp(TwoPhaseC
              o
              >mmitUnitTest.java:51)
              >     at
              >org.apache.commons.cactus.AbstractTestCase.runBareServerTest(AbstractTe
              s
              >tCase.java:297)
              >     at
              >org.apache.commons.cactus.server.ServletTestCaller.callTestMethod(Servl
              e
              >tTestCaller.java:148)
              >     at
              >org.apache.commons.cactus.server.ServletTestCaller.doTest(ServletTestCa
              l
              >ler.java:199)
              >     at
              >org.apache.commons.cactus.server.ServletTestRedirector.doPost(ServletTe
              s
              >tRedirector.java:149)
              >     at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
              >     at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
              >     at
              >weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl
              >java:213)
              >     at
              >weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServ
              l
              >etContext.java:1265)
              >     at
              >weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl
              >java:1631)
              >     at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137)
              >     at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
              >
              >
              >CONCLUSION
              >==========
              >I'm going nuts.
              >I just don't get it.
              >The transaction is the same. I don't change the Connection. I start
              >the Transaction at the beginning before I do anything!
              >Please guys help me out.
              >Thx alot.
              >
              >Stefan "it's three o'clock in the morning, my girlfriend left me, and
              >my only friend is that stupid linux pinguine" Siprell
              >Software-Development
              ><<<<<<<<<<<<<<<<<<<<<<<<<<<
              ><sitewaerts> GmbH
              >Hebelstraße 15
              >D-76131 Karlsruhe
              >
              >Tel: +49 (721) 920 918 22
              >Fax: +49 (721) 920 918 29
              >http://www.sitewaerts.de
              >>>>>>>>>>>>>>>>>>>>>>>>>>>>
              >
              >
              >
              

Maybe you are looking for

  • Where to see the output of my Application Engine Program ?

    Folks, Hello. I am creating my first AE program in Application Designer and test it in the 2-tier mode. I open the AE program in Appication Designer and click Edit ->Run Program. Then open the log file to see its execution and know the AE program is

  • Windows vs Mac Performance - Mac wins at the moment

    I can tell you from firsthand experience that Lightroom is very useable on a Mac but significantly less so on WinXP. I have a 1yr old XP laptop, 2GHz Core Duo, 2GB RAM, 128MB ATI X1400, 7200RPM hard drive with 60% free space where my library and phot

  • Trouble creating links to files

    when publishing a PowerPoint with hyperlinks to another document the Adobe presenter does not allow the link to operate have followed the help instructions for add and edit attachments andlinks to documents without success

  • Importing tracks/albums

    Hello, what did I do wrong; I have 268 albums;268 songs. I imported to be ready for my shuffle I havent received yet and I'm already frustrated. Thanks for your help.

  • Stupid is as stupid asks...

    Hi I am new and embarrassed to write in the forum asking silly questions. Thing is I am learning all from scratch without help from anyone. I have created a database (have previous knowledge only from Access) and have managed to create a beautiful re