Entity Bean Database Access Problem

I have developed the CustomerBook application from the NetBeans 4.1 quick start tutorial with SJAS8.1Q2 (http://www.netbeans.org/kb/41/quickstart-j2ee.html) with MySQL. I get the following set of errors. I am new to SJAS. I've tried a lot of different things. For the life of me, I can't understand why this isn't working. I know the problem is with the entity bean accessing the database because the session bean communicates well with the client when calling the entity bean.
Thank you in advance for any efforts made to help me on this.
Seymour
[#|2005-08-15T15:58:50.250-0500|INFO|sun-appserver-pe8.1_02|javax.enterprise.system.container.ejb|_ThreadID=21;|EJB5018: An exception was thrown during an ejb invocation on [CustomerFacadeBean]|#]
[#|2005-08-15T15:58:50.251-0500|INFO|sun-appserver-pe8.1_02|javax.enterprise.system.container.ejb|_ThreadID=21;|
javax.ejb.TransactionRolledbackLocalException: Exception thrown from bean; nested exception is: com.sun.jdo.api.persistence.support.JDOFatalInternalException: JDO76519: Failed to identify vendor type for the data store.
NestedException: java.sql.SQLException: Error in allocating a connection. Cause: Class name is wrong or classpath is not set for : org.gjt.mm.mysql.jdbc2.optional.MysqlDataSource
com.sun.jdo.api.persistence.support.JDOFatalInternalException: JDO76519: Failed to identify vendor type for the data store.
NestedException: java.sql.SQLException: Error in allocating a connection. Cause: Class name is wrong or classpath is not set for : org.gjt.mm.mysql.jdbc2.optional.MysqlDataSource
     at com.sun.jdo.spi.persistence.support.sqlstore.impl.SQLPersistenceManagerFactory.initializeSQLStoreManager(SQLPersistenceManagerFactory.java:870)
     at com.sun.jdo.spi.persistence.support.sqlstore.impl.SQLPersistenceManagerFactory.getFromPool(SQLPersistenceManagerFactory.java:786)
     at com.sun.jdo.spi.persistence.support.sqlstore.impl.SQLPersistenceManagerFactory.getPersistenceManager(SQLPersistenceManagerFactory.java:673)
     at com.sun.jdo.spi.persistence.support.sqlstore.impl.PersistenceManagerFactoryImpl.getPersistenceManager(PersistenceManagerFactoryImpl.java:849)
     at com.sun.jdo.spi.persistence.support.sqlstore.impl.PersistenceManagerFactoryImpl.getPersistenceManager(PersistenceManagerFactoryImpl.java:681)
     at ejb.CustomersBean_2122496195_ConcreteImpl.jdoGetPersistenceManager(CustomersBean_2122496195_ConcreteImpl.java:862)
     at ejb.CustomersBean_2122496195_ConcreteImpl.ejbFindByPrimaryKey(CustomersBean_2122496195_ConcreteImpl.java:417)
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
     at java.lang.reflect.Method.invoke(Method.java:585)
     at com.sun.enterprise.security.SecurityUtil.invoke(SecurityUtil.java:147)
     at com.sun.ejb.containers.EntityContainer.invokeFindByPrimaryKey(EntityContainer.java:738)
     at com.sun.ejb.containers.EJBLocalHomeInvocationHandler.invoke(EJBLocalHomeInvocationHandler.java:181)
     at $Proxy15.findByPrimaryKey(Unknown Source)
     at ejb.CustomerFacadeBean.getCompanyInfo(CustomerFacadeBean.java:73)
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
     at java.lang.reflect.Method.invoke(Method.java:585)
     at com.sun.enterprise.security.SecurityUtil$2.run(SecurityUtil.java:153)
     at java.security.AccessController.doPrivileged(Native Method)
     at com.sun.enterprise.security.application.EJBSecurityManager.doAsPrivileged(EJBSecurityManager.java:950)
     at com.sun.enterprise.security.SecurityUtil.invoke(SecurityUtil.java:158)
     at com.sun.ejb.containers.EJBObjectInvocationHandler.invoke(EJBObjectInvocationHandler.java:128)
     at $Proxy18.getCompanyInfo(Unknown Source)
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
     at java.lang.reflect.Method.invoke(Method.java:585)
     at com.sun.corba.ee.impl.presentation.rmi.ReflectiveTie._invoke(ReflectiveTie.java:123)
     at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatchToServant(CorbaServerRequestDispatcherImpl.java:648)
     at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatch(CorbaServerRequestDispatcherImpl.java:192)
     at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequestRequest(CorbaMessageMediatorImpl.java:1709)
     at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:1569)
     at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleInput(CorbaMessageMediatorImpl.java:951)
     at com.sun.corba.ee.impl.protocol.giopmsgheaders.RequestMessage_1_2.callback(RequestMessage_1_2.java:181)
     at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:721)
     at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.dispatch(SocketOrChannelConnectionImpl.java:469)
     at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.doWork(SocketOrChannelConnectionImpl.java:1258)
     at com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.run(ThreadPoolImpl.java:409)
NestedStackTrace:
java.sql.SQLException: Error in allocating a connection. Cause: Class name is wrong or classpath is not set for : org.gjt.mm.mysql.jdbc2.optional.MysqlDataSource
     at com.sun.gjc.spi.DataSource.getConnection(DataSource.java:74)
     at com.sun.jdo.spi.persistence.support.sqlstore.ejb.TransactionHelperImpl.getConnection(TransactionHelperImpl.java:181)
     at com.sun.jdo.spi.persistence.support.sqlstore.ejb.EJBHelper.getConnection(EJBHelper.java:166)
     at com.sun.jdo.spi.persistence.support.sqlstore.impl.SQLPersistenceManagerFactory.getConnection(SQLPersistenceManagerFactory.java:892)
     at com.sun.jdo.spi.persistence.support.sqlstore.impl.SQLPersistenceManagerFactory.initializeSQLStoreManager(SQLPersistenceManagerFactory.java:857)
     at com.sun.jdo.spi.persistence.support.sqlstore.impl.SQLPersistenceManagerFactory.getFromPool(SQLPersistenceManagerFactory.java:786)
     at com.sun.jdo.spi.persistence.support.sqlstore.impl.SQLPersistenceManagerFactory.getPersistenceManager(SQLPersistenceManagerFactory.java:673)
     at com.sun.jdo.spi.persistence.support.sqlstore.impl.PersistenceManagerFactoryImpl.getPersistenceManager(PersistenceManagerFactoryImpl.java:849)
     at com.sun.jdo.spi.persistence.support.sqlstore.impl.PersistenceManagerFactoryImpl.getPersistenceManager(PersistenceManagerFactoryImpl.java:681)
     at ejb.CustomersBean_2122496195_ConcreteImpl.jdoGetPersistenceManager(CustomersBean_2122496195_ConcreteImpl.java:862)
     at ejb.CustomersBean_2122496195_ConcreteImpl.ejbFindByPrimaryKey(CustomersBean_2122496195_ConcreteImpl.java:417)
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
     at java.lang.reflect.Method.invoke(Method.java:585)
     at com.sun.enterprise.security.SecurityUtil.invoke(SecurityUtil.java:147)
     at com.sun.ejb.containers.EntityContainer.invokeFindByPrimaryKey(EntityContainer.java:738)
     at com.sun.ejb.containers.EJBLocalHomeInvocationHandler.invoke(EJBLocalHomeInvocationHandler.java:181)
     at $Proxy15.findByPrimaryKey(Unknown Source)
     at ejb.CustomerFacadeBean.getCompanyInfo(CustomerFacadeBean.java:73)
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
     at java.lang.reflect.Method.invoke(Method.java:585)
     at com.sun.enterprise.security.SecurityUtil$2.run(SecurityUtil.java:153)
     at java.security.AccessController.doPrivileged(Native Method)
     at com.sun.enterprise.security.application.EJBSecurityManager.doAsPrivileged(EJBSecurityManager.java:950)
     at com.sun.enterprise.security.SecurityUtil.invoke(SecurityUtil.java:158)
     at com.sun.ejb.containers.EJBObjectInvocationHandler.invoke(EJBObjectInvocationHandler.java:128)
     at $Proxy18.getCompanyInfo(Unknown Source)
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
     at java.lang.reflect.Method.invoke(Method.java:585)
     at com.sun.corba.ee.impl.presentation.rmi.ReflectiveTie._invoke(ReflectiveTie.java:123)
     at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatchToServant(CorbaServerRequestDispatcherImpl.java:648)
     at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatch(CorbaServerRequestDispatcherImpl.java:192)
     at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequestRequest(CorbaMessageMediatorImpl.java:1709)
     at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:1569)
     at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleInput(CorbaMessageMediatorImpl.java:951)
     at com.sun.corba.ee.impl.protocol.giopmsgheaders.RequestMessage_1_2.callback(RequestMessage_1_2.java:181)
     at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:721)
     at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.dispatch(SocketOrChannelConnectionImpl.java:469)
     at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.doWork(SocketOrChannelConnectionImpl.java:1258)
     at com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.run(ThreadPoolImpl.java:409)
javax.ejb.TransactionRolledbackLocalException: Exception thrown from bean; nested exception is: com.sun.jdo.api.persistence.support.JDOFatalInternalException: JDO76519: Failed to identify vendor type for the data store.
NestedException: java.sql.SQLException: Error in allocating a connection. Cause: Class name is wrong or classpath is not set for : org.gjt.mm.mysql.jdbc2.optional.MysqlDataSource
     at com.sun.ejb.containers.BaseContainer.checkExceptionClientTx(BaseContainer.java:2674)
     at com.sun.ejb.containers.BaseContainer.postInvokeTx(BaseContainer.java:2526)
     at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:819)
     at com.sun.ejb.containers.EJBLocalHomeInvocationHandler.invoke(EJBLocalHomeInvocationHandler.java:199)
     at $Proxy15.findByPrimaryKey(Unknown Source)
     at ejb.CustomerFacadeBean.getCompanyInfo(CustomerFacadeBean.java:73)
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
     at java.lang.reflect.Method.invoke(Method.java:585)
     at com.sun.enterprise.security.SecurityUtil$2.run(SecurityUtil.java:153)
     at java.security.AccessController.doPrivileged(Native Method)
     at com.sun.enterprise.security.application.EJBSecurityManager.doAsPrivileged(EJBSecurityManager.java:950)
     at com.sun.enterprise.security.SecurityUtil.invoke(SecurityUtil.java:158)
     at com.sun.ejb.containers.EJBObjectInvocationHandler.invoke(EJBObjectInvocationHandler.java:128)
     at $Proxy18.getCompanyInfo(Unknown Source)
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
     at java.lang.reflect.Method.invoke(Method.java:585)
     at com.sun.corba.ee.impl.presentation.rmi.ReflectiveTie._invoke(ReflectiveTie.java:123)
     at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatchToServant(CorbaServerRequestDispatcherImpl.java:648)
     at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatch(CorbaServerRequestDispatcherImpl.java:192)
     at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequestRequest(CorbaMessageMediatorImpl.java:1709)
     at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:1569)
     at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleInput(CorbaMessageMediatorImpl.java:951)
     at com.sun.corba.ee.impl.protocol.giopmsgheaders.RequestMessage_1_2.callback(RequestMessage_1_2.java:181)
     at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:721)
     at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.dispatch(SocketOrChannelConnectionImpl.java:469)
     at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.doWork(SocketOrChannelConnectionImpl.java:1258)
     at com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.run(ThreadPoolImpl.java:409)

NestedException: java.sql.SQLException: Error in allocating a connection. Cause: Class name is wrong or classpath is not set for : org.gjt.mm.mysql.jdbc2.optional.MysqlDataSourcePlease check that you have the driver in appserver's class path.

Similar Messages

  • Report with entity beans - BIG performance problem

    I have several EJBs (CMP entity beans).
    I need to build a report using linked EJBs and show this report
    to a user (so, updates are not needed - report is only for web page demonstration).
    the problem is: such report is generated too slow.
    I have ~100 records in table 'TestResult' and ~500 records in table 'TestObject'.
    these tables are linked like this:
    one testobject <--> many testresults
    for each testresult I need to show a line with some info which should be retrieved
    from bound EJBs (e.g. testresult-testobject-assigneduser-prioritylevel)
    how to optimize such report generation?
    I have heard something about session beans with Value Objects.
    do I need to use such session beans here?
    what is a general solution for generating reports using linked EJBs?
    I tried to solve the problem by using DB View, but it didn't help.
    I have used 'TestResultView' - info is retrieved fast enough from this view
    (several msecs), but displaying this info is still very costly.
    please, help!
    Oracle 8.1.7,
    WebLogic 6.1

    Hi,
    because I have checked the time required to
    1) retrieve EJBS (several msec)Let me share some of my views with you.Once you retrieve the EJBS ie ie the collection of remote interface from the finder method the container is firing single "select " query and gets all the primary keys back.
    2) cycle through it - get fields and display them
    (~4000 msec)Now the cycle of getting the value you are getting the bean from the PooledState to ready state which will get the fields by firing the "select" query (ejbload()). Now in the instance you are invoking the multiple methods and at the end it will remain there in ready till you call the remove which u are not doing so the time out will bring it back to the pooledstate.
    And if you are calling the bean very frequently then all the instances will go to the ready state and the activation & passivation will start developing ......
    So at the end when the bean moves back to the pooled state after timeout the ejbStore() fires the "update " query!!!!
    Let us consider the activation/passivation not appearing for simple understanding !!!!!!!!
    So for each iteration you are firing 2 queries to the database.So if you have 500 records then the queries generatted will be 1(select from finder)+2(1 by select(ejbload)+1 by update(ejbStore))*500. So the flow is calling 1001 queries ...Thus quering about 1000 queries will definetly take some time...
    So what is the solution????
    Any way you dont require to fire the update query as you are just viewing the data...So u can stop calling the ejbStore().
    Hence you queries will drop to half.Now how we can do this is by using the BMP.....
    The other solution is using the Sessionbean and store the data all 500 records in the Object which can be called across the n/w. This object should implements the Serializable interface and this tech is the Transfer Object feature.....
    Hope you find this useful..
    regards
    Vicky

  • Applet database access problems!

    Hi,
    I have a major problem. I'm trying to design an applet that can talk to a database server which is not the same server where the applet is hosted. I keep getting an exception like below: (note I changed my db server name)
    java.sql.SQLException: Unable to connect to any hosts due to exception: java.security.AccessControlException: access denied (java.net.SocketPermission aaaa.bbbbb.net resolve)
         at com.mysql.jdbc.Connection.createNewIO(Connection.
    help?

    Ok, I went back and re-read the answer to a similar question I asked earlier. Since I can't talk directly to the other db server, what is the work around?
    Make a php page that updates the database, then call that page from within the applet?

  • Database access problem in JApplet

    Hi,
    I have a Swing application that accesses MS Access to store, query data. This app is running absolutely fine. I'm using Sun's ODBC-JDBC bridge driver and created a DSN in Windows for this.
    Now I have changed the main program (the main menu program) a bit, by coding "extends JApplet" etc. so that it can run as an Applet.
    Now, while I run this, I'm able to call programs, but there seems error while it's accessing MS Access tables.
    As applet is not executed from a Command Window, I'm not able to see the System.out.println () outputs. So, I don't have exact clue where is the error. (Though I know it's because of access to MS Access tables as I have coded JOptionPane for popping up a window for this).
    In this regard, I needed:
    1. A way to see the Console (or command window) or some way to see the outputs fom println () .
    2. What I can do so that the app can access MS Access?
    Any help is appreciated.
    Thanks in advance.
    Rajeev.

    Once again!
    You will probably need to sign your Applet jar file.
    http://java.sun.com/docs/books/tutorial/jar/sign/signing.html
    http://java.sun.com/developer/Books/javaprogramming/JAR/sign/signing.html

  • Database access problem

    I tried to commit database table after locking that table in the database. As a result I got following unhandled exception.
    "Could not do a physical-order read to fetch next row" .
    I am using sun java creator as a developing IDE and the server is sun application server. And I'm using Informix database. Please help me on this.
    Thank You

    I did not find any method that I can handle to avoid raising this exception. It may be rising when it is trying to bind the data to table or combo box component in the page. I can add error page to my project. But I like to show only a mesageBox that shows "Table is Locked" on relevant page by handling the above mentioned exception. Do you know how to handle it within the project.
    Anyway Bulus , Thanks a lot.

  • CMS Database Access Problem during installation BO XI 3.0

    Hi all,
    Very urgent question
    How can I install my CMS Repository in an Oracle Database and create a Service on the BO server as Oracle Client to the Oracle Database Server?
    I am not familiar with oracle and not be able to create an oracle service name.
    Regards
    Edited by: Love NDONGBOU on Oct 29, 2008 4:27 PM
    Edited by: Love NDONGBOU on Oct 29, 2008 4:27 PM
    Edited by: Love NDONGBOU on Oct 29, 2008 4:44 PM

    Note 852688 - "SSL Client PSE DFAULT does not exist" in Transaction SM59
    Please go through the above note. This is a program error. We implemented this note and it resolved our issue. But before implementing, make sure that SSL connection is set to H or G.
    Reward points if it helped.
    Thanks
    Subbu

  • Problems accessing fields in a CMP entity bean from a session bean

    Hello everybody,
    I'm getting the next problem: when I try to access a field in a CMP entity bean that I have instantiated from a session bean (trhoug entitybean.getNameOfField), I get the error "the entity bean does not exist in the database".
    This entity bean is accessing a table in an external database (not the DB of the WAS), but I know that it's getting the correct data from the table, since  I check the entitybean.size() and the entitybean.findByPrimaryKey(), and I get the right information. For some reason, the only thing that it doesn't work in the entity bean are the getter/setter methods (I created them automatically after having created the entity fields).
    I access the entity bean through its local interface...
    I know it's really difficult to give an answer with so few details, but... does anybody think I forgot something important to configure??
    Thank very much in advance!!
    Isidro

    getter and setter methods for cmp-fields are abstract.
    getter and setter methods for cmr-fields are abstract.
    "John Lee" <[email protected]> wrote:
    >
    Hi:
    Which method in a CMP Entity bean should be abstract? just only SetXXX
    and
    GetXXX?
    Thanks!
    John Lee

  • Problem with cache refresh entity bean / server node

    Hello,
    ive got a big problem and not found answer in sdn until now.
    Ive got a job that gets data from maxdb by sapjob - jco - session bean - entity bean - database.
    this job works daily. the data to work with is written directly to database from external.
    on first execute it works, but second etc not. i search for answer and i guess something:
    entity bean is cached (increase percormance?) with results of the select and do not know about new database entries when they are written directly to database. so second select says: there is no new data (but they are there).
    i only get this new data when i restart netweaver server node, then it works, but only for one time. then result is in cache and then i have to do same procedure before it goes (restart server).
    how can i get this data? is there any setting for force node to refresh cache? or any other settings to affect something like this?
    we have to go live with this in august.
    thx for help.
    Version: NW04, SP21

    thanks at first.
    OSS was the next step i consider, enforcedly.
    I hoped that there was a kind of timeout in visual admin or somewhere else where (for example) i can set a special time (seconds?) for refreshig the cache. Or i can set a flag for "do not cache entity beans".
    Someone else any idea?
    Nowadays on test system whe have made a task that starts windows every night so that netweaver also is "fresh". a kind of resolution but not the best and no resolution for the productiv system. or whe have to write a kind of batch job that only restarts server node once a day.
    New Info:
    I think cache was filled directly after restart.
    when we restart, then data are written, and then our application wanted to read them, they are also not seen.
    The data are only seen by bean when the restart takes place AFTER the data are written into db.
    So we change restart time to point after data are written. so we will test if this works, on monday we will see.
    Edited by: Torsten on Jul 11, 2008 11:27 AM

  • Problem with entity bean

    Hi friends, i am using cmp entity bean to access my relational data base. In my table i am using a sequence (oracle) to generate a sequentiel number as a unique identifier so in my entity bean i am not inserting a primery key. The problem is that i need to get the primary key of the bean after creating and storing it to use the key for other treatment. Any idea, thank a lot

    Hi,
    It seems you just need to move all "after creation" stuff (including getId()) into ejbPostCreate method.
    If I don't miss anything, think that's all.
    Good luck

  • Wrong version of an entity bean object being updated

    We are having a problem with an entity bean that uses bean managed persistence. The "order" entity bean has
    been used as part of our Order Routing System for the last 2 years with no problems. The entity bean is
    accessed via calls from a "Order Manager" session bean. No change has been done to the entity bean but the
    frequency of calls from the session bean to update the entity bean have increased significantly.
    The "order" entity bean wraps an Order object that contains order properties (i.e. id, quantity, price,
    version, etc). The entity bean has a "void setOrder(Order param)" function that writes the Order to a database
    and a "Order getOrder()" function that clones and returns the internal Order object. The "ejbLoad()" function
    reads the Order object from the database and the "ejbStore()" function is not implemented.
    The "OrderEntityPK ejbFindByPrimaryKey()" function checks if the order entity primary key (an "int") exists
    on the database.
    We are using the SilverStream 3.5 application server as our EJB container. According to the SilverStream manual
    it does not maintain a pool of idle/unused entity beans, instead it instantiates beans as requested.
    Our problem is:
    1) The wrong version of the entity object is sometimes being updated (i.e. an old instance of the order entity is being
    picked up and updated on the database).
    2) We sometimes get a TransactionRequired exception thrown when we have concurrent updates to two different
    objects of the entity bean.
    Any idea as to what our problem could be?
    Thanks in advance for your help,
    The following are the main code snippets:
    Original Code
    Session Bean A
    Method 1 --- gets entity Bean B and calls a method on a different object passing this entity bean
              in as a parameter to enable a method on this bean to be called.
    EntityBean lOrderEntity = findOrderEntity(callerUnixLogin, currOrderId);
                   currOrder = lOrderEntity.getOrder();
                   //Logic to update the currOrder object via a method call.
                   persistManager.persistOrder(lOrderEntity, callerUnixLogin, currOrder, psTransactionType);
         persistManager.persistOrder Method:
                   lOrderEntity.setOrder(callerUnixLogin, order);
         findOrderEntity method:
    OrderEntity lOrderEntity = null;
              OrderEntityBeanPK orderPK = new OrderEntityBeanPK(orderId);
              try
                   if (orderEntityHome == null)
                        connectToOrderEntityBean(callerUnixLogin);
                   lOrderEntity = orderEntityHome.findByPrimaryKey(orderPK);
              ... etc
    Current Code
    Session Bean C
    Method 2 ---- calls method 1 in Session Bean A
    Calls to method 2 above happens in quick succession.
    OrderEntityBean class
    ... important methods ...
         private Order order = null;
         public OrderEntityBeanPK ejbFindByPrimaryKey(OrderEntityBeanPK primaryKey)
              throws FinderException, RemoteException, DBOException
              try
                   orderObjectManager.orderIdExists(primaryKey.orderId);
              catch (OMOrderValidationException exc)
                   throw new FinderException(exc.getMessage());
              return primaryKey;
         public void setOrder(String userUnixLogin, Order newOrder)
              throws EJBException, RemoteException, DBOException, OMFormattingException, OMOrderValidationException
              callerUnixLogin = userUnixLogin;
              int version = newOrder.getOrderVersion().intValue();
              if (order.getOrderVersion().intValue() == version)
                   order = null;
                   order = newOrder;
                   Integer newVersion = new Integer(version + 1);
                   order.setOrderVersion(newVersion);
                   newVersion = null;
                   order.setSysUser(callerUnixLogin);
                   orderObjectManager.updateOrder(callerUnixLogin, order);
              else
                   Debug.Print(userUnixLogin, "OrderEntityBean.setOrder: wrong version number for order " + newOrder.getOrdId() +
                        ": expected " + order.getOrderVersion() + " and got " + newOrder.getOrderVersion(), 0);
                   throw new OMOrderValidationException("wrongVersion", order, order.getOrdId(), IName.Order.VERSION, newOrder.getOrderVersion());
         public Order getOrder()
              throws EJBException, RemoteException
    return ((Order)order.clone());
    The following transactions exists for the entity bean ...
    Required:
         create and setOrder methods
    Not Supported
         findByPrimary and getOrder methods

    "The entity bean has a "void setOrder(Order param)" function that writes the Order to a database"
    This functionality should be performed in the ejbStore method().
    "a "Order getOrder()" function that clones and returns the internal Order object."
    Sounds reasonable, except for the cloning part.
    "The "ejbLoad()" function reads the Order object from the database"
    Cool.
    ""ejbStore()" function is not implemented."
    Whoops. Looks like your setOrder method is doing too much. It should do the inverse of getOrder (namely, setting the interal Order object), nothing more. Defer the persistence code to the ejbStore method.
    "According to the SilverStream manual it does not maintain a pool of idle/unused entity beans, instead it instantiates beans as requested."
    Manual? What's that? Assuming that is correct, better hope you don't ever get a high load. You might wanna look into JBoss.
    "2) We sometimes get a TransactionRequired exception thrown when we have concurrent updates to two different objects of the entity bean."
    How can you have concurrent access to two different objects?? Concurrency is inherently applicable to only one object.
    In summary:
    Write your beans properly, ejbLoad populates the bean with data, ejbStore persists the bean's data.
    Get a better (and possibly free) appserver.

  • Cmp Entity Beans and collections

    I am doing a proof of concept application and I have implemented an Entity bean which accesses through a DAO object to my Informix database and returns records based on a serial field called sightID. This works fine and I can access the records and store new records. I now need to demonstrate the power of CMP beans and return a collection showing all records for a particular field called Type. Here is where my problems start. If I am using CMP I need to map the primary key field to the primary key field of the database (this is sightID) the field I need to get the collection on is not a key field and is only a text field with one of four values. How can I use CMP to return a collection based on a non priomary key field? is this possible? I am willing to post all my code but there is 14 pages.
    any help greatly appreciated
    Connie

    EJBQL???..
    SELECT object(o) from table_object 0 where non_primarykey = 'value i want'
    sanjay.

  • Object locking of entity bean in a SSBean[Environment: WebLogic 10.0, EJB3.0, Kodo/OpenJPA]

    Hello friends,
    I am facing bottle neck with Object Locking for an Entity bean using OpenJPA Persistence Manager under Weblogic 10.0 application server deployments.
    I want to block [ for the specific method ] entity bean being accessed from other client programs when they invoke common method in a Stateless Session EJB. Particularly, Consider the situation:
    Client1: Modifying Customer entity with id: 100. Then I locked that entity using OpenJPA Entity Manager within the transaction block. And i entered that thread to sleep before committing the transaction.
    At this time, started new thread, Client2: Modifying the same Customer entity with id:100. I expected this thread will be get blocked when control pass to the lock() method. But it doesn't happened. It goes through the line of codes and also put into sleep.
    After thread sleep timeout, first thread Client1 commit successfully. But the second gets Rollback Exception due to optimistic lock exception occurring since customer entity is modified in another transaction.
    This exception is occurred because of Database level concurrency control for optimistic locking in a weblogic server. Its default to weblogic.
    But, what i expected is to assert lock at the object level, thereby the 2nd thread - Client2 will be blocked while Client1 is in the middle of a transaction and then Client2 use modified Customer entity . But it doesn't happened. I used Kodo Persistance Provider as Persistence Unit, OpenJPAEntityManager to do transaction, locking , finding and merging the entity bean.
    Can anyone provide help to fine grain this object locking functionality ??? I look forward to your brilliant thoughts......
    Rajesh KR
    Geojit Technologies

    Dear Chicon,
    I made thread to sleep for checking the "Object Locking" functionality of OpenJPAEntityManager. My intention was to block the second thread when the first thread being locked when a concurrent access occurs. But it doesn't happened and code execution passed to thread sleep.
    I mean when 2 client access the same entity at same time (in same milliseconds) , and what happens to 2nd thread when 1st thread locks the entity object.
    I guarantee you that i started the 2nd thread before the 4sec time stamp given to the object locking. I tested it with a bigger timestamp, still it given concurrent blocking of the same entity bean.
    My question is why the object locking is not working with concurrent access to same entity bean from more than one thread???
    I think you get the correct question what i intended ????
    Regards,
    Raj...

  • Caching CMP Entity Beans with 9.0.2

    Hi,
    my CMP Entity Bean is accessed from a JSP-Page through a Stateless Session Bean. The Session-Bean executes findAll() on the Entity-Bean and the JSP-Page iterates over the Collection and displays the Fields through their getter-Methods. It turns out that every getXXX Methods results in a complete load of the Bean from the Database, so for 3 database-records with 4 attributes i get 12 SELECT - statements and 12 Activate/Load/Passivate cycles of the Entity Bean!!!!
    I tried to setup the attributes in orion-ejb-jar.xml correctly, but that didn't show a difference:
    -) exclusive-write-access="true" does only work in "read-only" mode (see oc4j_ejb_guide_r2.pdf)
    -) setting timeouts didnt work
    My Entity Bean settings are:
    exclusive-write-access="true"
    instance-cache-timeout="60"
    max-instances="100"
    max-tx-retries="0"
    pool-cache-timeout="100"
    The EJB-Callbacks are:
    first the Session-Bean is created, and findAll() is executed - then all Entity-Beans are passivated again:
    TestManBean Constructor called 1
    TestManBean.setSessionContext() 1
    TestManBean.ejbCreate() 1
    PersonBean Constructor called 1
    PersonBean.setEntityContext() 1
    PersonBean.ejbActivate() 1
    PersonBean.ejbLoad() 1
    PersonBean Constructor called 2
    PersonBean.setEntityContext() 2
    PersonBean.ejbActivate() 2
    PersonBean.ejbLoad() 2
    PersonBean Constructor called 3
    PersonBean.setEntityContext() 3
    PersonBean.ejbActivate() 3
    PersonBean.ejbLoad() 3
    PersonBean.ejbPassivate() 1
    PersonBean.ejbPassivate() 2
    PersonBean.ejbPassivate() 3
    now for every getXXX-Methods the following occurs:
    PersonBean.ejbActivate() 3
    PersonBean.ejbLoad() 3
    PersonBean.ejbPassivate() 3
    I user OC4J 9.0.2 Production with Oracle 8.1.6.
    How can I turn on Entity-Bean Caching?
    Thanks,
    Gilbert

    Hi Gilbert,
    Someone recently asked a similar question to yours. Perhaps that thread will
    be helpful to you?
    Author: Valeri Kireitchik
    Subject: how to set exclusive-write-access="true"
    Date: May 17, 2002 10:18 PT
    URL:
    Re: Get the Table name by providing the Sequence name
    The same person (Valeri) also asked his question on two other forums:
    http://www.elephantwalker.com/rfa?id=549
    http://www.mail-archive.com/orion-interest%40orionserver.com/msg19037.html
    Good Luck,
    Avi.

  • Entity Beans not getting garbage collected

    Hi,
    I am developing an application that is using EJBs utilizing several common design patterns (i.e. Session Facade, DAO, and Fast Lane Reader). All of the patterns used have come from books by Sun Microsystems Press.
    As I have understood the pattern, the Session Facade pattern uses Stateless Session Beans (SLSB) to implement a desired functionality and accesses the entity beans locally. The results from the entity beans are placed into Value Objects and passed back to the client separating any direct access with the entity beans from the client. In my case, I am using BMP for my entity beans.
    The problem I am seeing with Optimizeit is that none of my entity beans are getting garbage collected despite no references to them. The SLSB creates what entities it needs to perform a task at the local level, puts the data into a value object and goes out of scope.
    Shouldn't the entity beans get removed if the object that references them has gone away or am I missing something?
    Is there a proper way to set an entity bean (or any EJB for that matter) for garbage collection.
    thanks in advance for any help...

    You might even discover that entity beans can get created even before you use them.
    Your application server creates "pools" of bean instances that it can use when it needs to. It is part of this role, and is done in order to optimize performances.
    You cannot force them to be garbage collected. Even if you stop referencing them, the app server will.
    When your create references to a bean, it (usually) won't create an instance. It will take an existing one, and load data into it, using ejbCreate or ejbActivate.
    Hope this helps.
    /Stephane

  • Very Basic Question about Entity Beans !!!  Need your help.

    Hi,
    I have the following requirement:-
    ==============================
    There is an application A, whose multiple instances can run
    at the same time. There is some data/variable which is to be
    globally shared (i.e by all the instances). I have thought of using
    Entity Beans and putting that data in a single record in DB.
    Approach A:-
    ~~~~~~~~~~~
    Instance 1 of A (with Entity Bean ) -
    -> Database (only 1 row exist)
    Instance 2 of A (with Entity Bean ) -
    Approach B:-
    ~~~~~~~~~~~
    Instance 1 of A
    -> Entity Bean -> Database (only 1 row exist)
    Instance 2 of A
    My Query is:-
    1) In Approach A, both the instances of Application
    have their own Entity Bean (running in same JVM as them,
    packaged with Application)..Now both the entity bean instances
    represent 1 row on Database...At one time only 1 Entity bean
    will be performing the operation (read/write, other will be
    disallowed).
    2) In Approach B, both the instances of application(or Client) using
    the same Entity Bean - which is representing 1 row of Database
    Which is correct....I have read somewhere instance of Entity Bean
    corresponds to 1 row of database....If that is the case, Approach
    A would be wrong..
    Please help.

    1 Entity bean for 1 row is not true. An entity bean can represent data from multiple tables also. The correct statement is 1Entitybean for 1 resultset.
    So in case 1, u have 2 instances of Application running so it should not be an issue.

Maybe you are looking for

  • How To Connect My PB To An iBook...

    My cousin just bought a new ibook - I'll be going to over to help him set it up and it would be nice to transfer some of the family pics / files I have on my powerbook over to his machine to load up into iphoto etc. I'd like to find a way of connecti

  • How can I make "Call Phones" my default view? Skype 7.6

    Hello,Does anyone know how I can make CALL PHONES my default view. Skype defaults to the SKYPE HOME which is pretty useless.Thank you.Bruce

  • Producing links to other websites

    I am putting an article into someone elses blog but would like 3 links to others websites to help explain technical concerns. Is there a method like in e-mail messaging?

  • Adding mouselistener on Panel and Canvas

    Hi, I m building an application in which I m making a frame, adding a panel on it and then adding a Canvas on the panel. On this Canvas my Native C code is drawing an Image. This image is very small with respect to the size of the frame. The size of

  • How do you add a "back" and Next" capability to a Disjointed Rollover?

    I am having trouble linking two behaviors because I don't understand the code very well. I've seen what I am trying to do at other artists' websites like this one: http://www.emilyberger.net/paintings.html# I have a nice Disjointed Rollover to show a