Problem with ejb 3.0 entity beans with manyToMany relationship

Hello everyone!
I am using struts 1.2.9 and java ee 5 sdk update 2 for my enterprise application. Besides others i have these entity beans Targetgroup.java and City.java, (i would upload file but i do not know how:)
with manytomany relationship with join table.
when user updates Targetgroup, by clicking on web page with checkboxes and textfields, struts dispatch action calls following method stateless bean:
public void update(String firmId, String targetgroupId, String newGender, String newMinYearsOld, String newMaxYearsOld, String[] newCities) {
TargetgroupPK pkForUpdate = new TargetgroupPK(targetgroupId, firmId);
Targetgroup targetgroupForUpdate = find(pkForUpdate);
targetgroupForUpdate.setGender(newGender);
targetgroupForUpdate.setMinyearold(Integer.parseIn t(newMinYearsOld));
targetgroupForUpdate.setMaxyearold(Integer.parseIn t(newMaxYearsOld));
//pronalazenje gradva za koje je vezana ciljna grupa
Collection<City> newCitiesCollection = new ArrayList<City>();
for(int i = 0; i < newCities.length; i++){
String tmp_city_name = newCities;
City city_obj = cityFacade.find(tmp_city_name);
newCitiesCollection.add(city_obj);
targetgroupForUpdate.setCityidCollection(newCities Collection);
parameter newCities represents names of cities which user checked on his update page. When the page is showen to him some cities are allready check because they were connected with Targetgruoup when it was created (targetgroup).
this code throws following exception:
[#|2007-07-26T12:13:36.993+0200|SEVERE|sun-appserver-pe9.0|javax.enterprise.system.container.web|_Threa dID=16;_ThreadName=httpWorkerThread-8080-0;_RequestID=f79d9c50-86b0-4b6c-96ab-97956dfb39c1;|StandardWrapperValve[action]: Servlet.service() for servlet action threw exception
javax.ejb.EJBException: Transaction aborted; nested exception is: javax.transaction.RollbackException: Transaction marked for rollback.
javax.transaction.RollbackException: Transaction marked for rollback.
at
.com.sun.enterprise.web.connector.grizzly.WorkerTh read.run(WorkerThread.java:75)
javax.ejb.EJBException: Transaction aborted; nested exception is: javax.transaction.RollbackException: Transaction marked for rollback.
at com.sun.ejb.containers.BaseContainer.completeNewTx (BaseContainer.java:3659)
at com.sun.ejb.containers.BaseContainer.postInvokeTx( BaseContainer.java:3431)
at com.sun.ejb.containers.BaseContainer.postInvoke(Ba seContainer.java:1247)
at com.sun.ejb.containers.EJBLocalObjectInvocationHan dler.invoke(EJBLocalObjectInvocationHandler.java:1 92)
at com.sun.ejb.containers.EJBLocalObjectInvocationHan dlerDelegate.invoke(EJBLocalObjectInvocationHandle rDelegate.java:71)
at $Proxy149.update(Unknown Source)
at audiotel.sms.actions.backoffice.TargetgroupDispatc hAction.updateOrDelete(TargetgroupDispatchAction.j ava:132)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.struts.actions.DispatchAction.dispatchM ethod(DispatchAction.java:270)
at org.apache.struts.actions.DispatchAction.execute(D ispatchAction.java:187)
at org.apache.struts.action.RequestProcessor.processA ctionPerform(RequestProcessor.java:431)
at org.apache.struts.action.RequestProcessor.process( RequestProcessor.java:236)
at org.apache.struts.action.ActionServlet.process(Act ionServlet.java:1196)
at org.apache.struts.action.ActionServlet.doPost(Acti onServlet.java:432)
at javax.servlet.http.HttpServlet.service(HttpServlet .java:727)
com.sun.enterprise.web.connector.grizzly.WorkerThr ead.run(WorkerThread.java:75)
|#]
exceprion is throwen ONLY when in parameter newCities are city names allready connected to Targetgroup. when NewCities contains names of
City objects which are not connected to Targetgroup it works fine, but it's of no use for me, because user must be able to add or remove certian cities from relaionship with Targetgroup. I think it's because there are rows in join table that contain primary keys of city and targetgroup which are connected so perisistence manager cann't write them again.
i thought it was going to figure it out by itself, and only update those rows.
Does anyone know what is the problem and solution?
Thanks! (forgive my spelling errors :)

solved the problem!
I moved code from sesion bean to struts action as follows:
CityFacadeLocal cityFacade = lookupCityFacade();
//prikupljanje novih podataka o ciljnoj grupi
String newGender = ctf.getGender();
String newMaxYears = ctf.getMaxyears();
String newMinYears = ctf.getMinyears();
String[] newSelectedCities = ctf.getSelectedCities();
//niz imena gradova se prevodi u kolekcju objekata City
Collection<City> newCitiesObjCollection = new Vector<City>();
for(int i = 0; i < newSelectedCities.length; i++){
String tmpCityName = newSelectedCities;
City tmpCityObj = cityFacade.find(tmpCityName);
newCitiesObjCollection.add(tmpCityObj);
//setovanje novih podataka
targetgroupForUD.setGender(newGender);
targetgroupForUD.setMinyearold(Integer.parseInt(newMinYears));
targetgroupForUD.setMaxyearold(Integer.parseInt(newMaxYears));
targetgroupForUD.setCityidCollection(newCitiesObjCollection);
//pozivanje update metdoe u session beany
targetgroupFacade.edit(targetgroupForUD);
//korisnik se vraca na stranu sa svim postojecim ciljnim grupama
forward = mapping.findForward("backend.targetgroups");
and now it works fine. I guess probelm was same transaction scope for Targetgroup and City entities. Now when they are separated it works.
Thanks!

Similar Messages

  • Problem creating EJB 3.0 Entity bean in JDeveloper

    Hello all,
    I trying to create my first entity bean in JDeveloper.
    JDevelper create the entity bean with the code below:
    package model;
    import java.io.Serializable;
    import javax.persistence.Entity;
    @Entity
    public class BatchSettlementT implements Serializable {
    public BatchSettlementT() {
    The problem is that JDeveloper don't find the import command import javax.persistence.Entity;
    What am I doing wrong?
    I'm using JDeveloper Studio Edition Version 10.1.3.1.0.3914.
    My libraries are:
    - TopLink
    - Oracle XML Parser 2
    - EJB 3.0
    - Toplink Essentials JPA
    - J2EE
    Thanks in advance.

    It's very strange, when I type import.javax. in my class there is no persistence package available, do you have any idea what's wrong.
    I did set the technology scope to EJB either.
    Thanks!

  • Problems accessing ejb 3.0 entity bean from project

    I have written some code using ejb 3.0 and was previously accessing the entity bean without problem when both ejbs and the accessing code were in the same project. However I have moved the accessing code into a different project within the same application and now when the code tries to accessing the entity bean I get the following error:
    com.colwilson.web.ingestion.IdentifiedException: java.lang.ClassCastException: __Proxy3
         at com.colwilson.web.ingestion.IngestionHandler.recordArrived(IngestionHandler.java:140)
         at com.colwilson.web.ingestion.IngestionHandler.main(IngestionHandler.java:52)
    Caused by: java.lang.ClassCastException: __Proxy3
         at com.evermind.server.ejb.StatelessSessionRemoteInvocationHandler.getFreshObject(StatelessSessionRemoteInvocationHandler.java:21)
         at com.evermind.server.rmi.RecoverableRemoteInvocationHandler.getReplacementObject(RecoverableRemoteInvocationHandler.java:64)
         at com.evermind.server.rmi.RecoverableRemoteInvocationHandler.handleRecovery(RecoverableRemoteInvocationHandler.java:41)
         at com.evermind.server.rmi.RecoverableRemoteInvocationHandler.invoke(RecoverableRemoteInvocationHandler.java:30)
         at com.evermind.server.ejb.StatelessSessionRemoteInvocationHandler.invoke(StatelessSessionRemoteInvocationHandler.java:43)
         at __Proxy1.mergeEntity(Unknown Source)
         at com.colwilson.web.ingestion.IngestionHandler.recordArrived(IngestionHandler.java:137)
         ... 1 more
    Now, of course I could move the code back into the same project, but as I understand it that is just the point of ejbs. I'm looking up the entity bean thus:
    final Context context = InitialContext();
    ingestionSessionEJB =
    (IngestionSessionEJB)context.lookup("IngestionSessionEJB");
    It may be true that I don't understand the way lookup works, but to be honest I can't find the docs that explain what I've got wrong.
    Please help.

    hi
    Double Click on the project which is goin to use the project which contains bean from the Application Navigator window. The project properties window will open. Choose the "Dependencies" item from left panel. click on the radio "User Project Settings" and select another project which contain ejb which you're goin to access...
    Best Of Luck
    Ravi A. Trivedi

  • EJB 3.0 Entity Bean

    Hi Friends,
    I am Facing a problem in EJB 3.0 Entity Bean. I am Using Eclipse 3.3.2 and JBoss 4.2 Application Server. Im getting the error such as *"javax.naming.NameNotFoundException: EntityBean not bound"* when im trying to lookup the entity bean. Herewith i had attached the servlet code. Can anyone suggest me.
    package common;
    import java.io.IOException;
    import javax.naming.InitialContext;
    import javax.naming.NamingException;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import example.BookRemote;
    public class CounterServlet extends javax.servlet.http.HttpServlet implements javax.servlet.Servlet {
    static final long serialVersionUID = 1L;
    private BookRemote hello;
         public CounterServlet() {
              super();
         protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
              // TODO Auto-generated method stub
              try
         InitialContext ctx = new InitialContext();
         hello = (BookRemote) ctx.lookup("EntityBean/remote");
         hello.test();
         Integer count = 1;
         request.setAttribute("counter", count);
         request.getRequestDispatcher("result.jsp").forward(request, response);
         catch (NamingException e)
         e.printStackTrace();
         protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
              // TODO Auto-generated method stub
         }

    I think the Bean haven't been registered. I had look into the jmx-console and this is the result which i have got for my sample application (EntityBean).
    java:comp namespace of the EntityBean.ear/EntityBeanWeb.war application:
    +- UserTransaction[link -> UserTransaction] (class: javax.naming.LinkRef)
    +- env (class: org.jnp.interfaces.NamingContext)
    | +- security (class: org.jnp.interfaces.NamingContext)
    | | +- realmMapping[link -> java:/jaas/other] (class: javax.naming.LinkRef)
    | | +- subject[link -> java:/jaas/other/subject] (class: javax.naming.LinkRef)
    | | +- securityMgr[link -> java:/jaas/other] (class: javax.naming.LinkRef)
    | | +- security-domain[link -> java:/jaas/other] (class: javax.naming.LinkRef)
    Global JNDI Namespace
    +- persistence.units:ear=EntityBean.ear,unitName=CounterServlet (class: org.hibernate.impl.SessionFactoryImpl)
    +- persistence.units:ear=TaskEnitity.ear,unitName=FirstEjb3Tutorial (class: org.hibernate.impl.SessionFactoryImpl)
    +- TopicConnectionFactory (class: org.jboss.naming.LinkRefPair)
    +- jmx (class: org.jnp.interfaces.NamingContext)
    | +- invoker (class: org.jnp.interfaces.NamingContext)
    | | +- RMIAdaptor (proxy: $Proxy48 implements interface org.jboss.jmx.adaptor.rmi.RMIAdaptor,interface org.jboss.jmx.adaptor.rmi.RMIAdaptorExt)
    | +- rmi (class: org.jnp.interfaces.NamingContext)
    | | +- RMIAdaptor[link -> jmx/invoker/RMIAdaptor] (class: javax.naming.LinkRef)
    +- HTTPXAConnectionFactory (class: org.jboss.mq.SpyXAConnectionFactory)
    +- ConnectionFactory (class: org.jboss.mq.SpyConnectionFactory)
    +- UserTransactionSessionFactory (proxy: $Proxy14 implements interface org.jboss.tm.usertx.interfaces.UserTransactionSessionFactory)
    +- HTTPConnectionFactory (class: org.jboss.mq.SpyConnectionFactory)
    +- XAConnectionFactory (class: org.jboss.mq.SpyXAConnectionFactory)
    +- TransactionSynchronizationRegistry (class: com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionSynchronizationRegistryImple)
    +- UserTransaction (class: org.jboss.tm.usertx.client.ClientUserTransaction)
    +- OnlineSurveyTool (class: org.jnp.interfaces.NamingContext)
    | +- RegisterBean (class: org.jnp.interfaces.NamingContext)
    | | +- remote (proxy: $Proxy79 implements interface online.IRegister,interface org.jboss.ejb3.JBossProxy,interface javax.ejb.EJBObject)
    | +- OnlineSurveyBean (class: org.jnp.interfaces.NamingContext)
    | | +- remote (proxy: $Proxy75 implements interface online.OnlineSurveyRemote,interface org.jboss.ejb3.JBossProxy,interface javax.ejb.EJBObject)
    +- UILXAConnectionFactory[link -> XAConnectionFactory] (class: javax.naming.LinkRef)
    +- UIL2XAConnectionFactory[link -> XAConnectionFactory] (class: javax.naming.LinkRef)
    +- queue (class: org.jnp.interfaces.NamingContext)
    | +- A (class: org.jboss.mq.SpyQueue)
    | +- testQueue (class: org.jboss.mq.SpyQueue)
    | +- ex (class: org.jboss.mq.SpyQueue)
    | +- DLQ (class: org.jboss.mq.SpyQueue)
    | +- D (class: org.jboss.mq.SpyQueue)
    | +- C (class: org.jboss.mq.SpyQueue)
    | +- B (class: org.jboss.mq.SpyQueue)
    +- topic (class: org.jnp.interfaces.NamingContext)
    | +- testDurableTopic (class: org.jboss.mq.SpyTopic)
    | +- testTopic (class: org.jboss.mq.SpyTopic)
    | +- securedTopic (class: org.jboss.mq.SpyTopic)
    +- console (class: org.jnp.interfaces.NamingContext)
    | +- PluginManager (proxy: $Proxy49 implements interface org.jboss.console.manager.PluginManagerMBean)
    +- UIL2ConnectionFactory[link -> ConnectionFactory] (class: javax.naming.LinkRef)
    +- HiLoKeyGeneratorFactory (class: org.jboss.ejb.plugins.keygenerator.hilo.HiLoKeyGeneratorFactory)
    +- UILConnectionFactory[link -> ConnectionFactory] (class: javax.naming.LinkRef)
    +- persistence.units:unitName=TestServlet (class: org.hibernate.impl.SessionFactoryImpl)
    +- QueueConnectionFactory (class: org.jboss.naming.LinkRefPair)
    +- UUIDKeyGeneratorFactory (class: org.jboss.ejb.plugins.keygenerator.uuid.UUIDKeyGeneratorFactory)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • CMP Entity Bean with ejb-ql finder methods and INFORMIX database

    Hi,
    I have some CMP Entity Beans with finder methods defined in ejb-ql. In my ejb-jar, within <entity> definitions I have something like:
        <entity>
          <abstract-schema-name>BeanName</abstract-schema-name>
          <cmp-field><field-name>fieldOne</field-name></cmp-field>
          <cmp-field><field-name>fieldTwo</field-name></cmp-field>
          <query>
            <query-method>
              <method-name>findAll</method-name>
              <method-params></method-params>
            </query-method>
            <ejb-ql>SELECT OBJECT(o) FROM BeanName o</ejb-ql>
          </query>
        <entity>
    And in persistent.xml:
    <db-properties>
         <data-source-name>datasource_name</data-source-name>
    </db-properties>
    <entity-bean>
         <ejb-name>BeanName</ejb-name>
         <table-name>table_name</table-name>
         <field-map key-type="NoKey">
         <field-name>fieldOne</field-name>
         <column><column-name>column_one</column-name></column>
          </field-map>
         <field-map key-type="NoKey">
         <field-name>fieldTwo</field-name>
         <column><column-name>column_two</column-name></column>
          </field-map>
          <finder-descriptor>
              <method-name>findAll</method-name>
              <method-params/>
         </finder-descriptor>
    Once deployed, on server side, I can found a java source file (with corresponding compiled class file) in path:
    j2ee/cluster/server0/apps/companyName/MyEARApp/EJBContainer/temp/temp38837373733/route/to/package/
    with names:
    BeanName0_0pm.java
    BeanName0_0PM.class
    and the generated java file contains this code:
      public java.util.Enumeration ejbFindAll() throws javax.ejb.FinderException, javax.ejb.EJBException  {
        TransactionContext tc = pm.getTransactionContext();
        Connection conn = null;
        PreparedStatement pSt = null;
        ResultSet ejb_rs = null;
        int status = javax.transaction.xa.XAResource.TMSUCCESS;
        try {
          conn = pm.getConnectionForFindMethod();
          pSt = conn.prepareStatement("SELECT \"O\".\"COLUMN_ONE\",\"O\".\"COLUMN_TWO\", FROM \"TABLE_NAME\" \"O\"");
          ejb_rs = pSt.executeQuery();
    I'm trying to call this method but it throws a SQLException when preparing the statement.
    It seems that Informix does not like this SQL syntax because of upper case names, doble quotes on table alias, or something else.
    When editing persistent.xml in netweaver, I can define the element <datasource-vendor> as ORACLE, SAPDB, MS_SQL_SERVER, DB2_UDB_AS400 or DB2_UDB_OS390 but INFORMIX is not an accepted value.
    Is there any way to define how this SQL query is build?
    Thanks in advance.

    The return type of the finder method defined in the remote home interface is either the entity bean's remote interface or a collection of objects implementing the entity bean's remote interface. The return type of the finder method defined in the local home interface is either the entity bean's local interface or a collection of objects implementing the entity bean's local interface

  • Error While Deploying A CMP Entity Bean With A Composite Primary Key

    Hello all,
    I have a problem deploying CMP Entity beans with composite primary keys. I have a CMP Entity Bean, which contains a composite primary key composed of two local stubs. If you know more about this please respond to my post on the EJB forum (subject: CMP Bean Local Stub as a Field of a Primary Key Class).
    In the mean time, can you please tell me what following error message means and how to resolve it? From what I understand it might be a problem with Sun ONE AS 7, but I would like to make sure it's not me doing something wrong.
    [05/Jan/2005:12:49:03] WARNING ( 1896):      Validation error in bean CustomerSubscription: The type of non-static field customer of the key class
    test.subscription.CustomerSubscriptionCMP_1530383317_JDOState$Oid must be primitive or must implement java.io.Serializable.
         Update the type of the key class field.
         Warning: All primary key columns in primary table CustomerSubscription of the bean corresponding to the generated class test.subscription.CustomerSubscriptionCMP_1530383317_JDOState must be mapped to key fields.
         Map the following primary key columns to key fields: CustomerSubscription.CustomerEmail,CustomerSubscription.SubscriptionType. If you already have fields mapped to these columns, verify that they are key fields.Is it enough that a primary key class be serializable or all fields have to implement Serializable or be a primitive?
    Please let me know if you need more information to answer my question.
    Thanks.
    Nikola

    Hi Nikola,
    There are several problems with your CMP bean.
    1. Fields of a Primary Key Class must be a subset of CMP fields, so yes, they must be either a primitive or a Serializable type.
    2. Sun Application Server does not support Primary Key fields of an arbitrary Serializable type (i.e. those that will be stored
    as BLOB in the database), but only primitives, Java wrappers, String, and Date/Time types.
    Do you try to use stubs instead of relationships or for some other reason?
    If it's the former - look at the CMR fields.
    If it's the latter, I suggest to store these fields as regular CMP fields and use some other value as the PK. If you prefer that
    the CMP container generates the PK values, use the Unknown
    PrimaryKey feature.
    Regards,
    -marina

  • Is it possible to map the cmp fields of the entity bean with out dictionary

    Dear sirs,
    I have created the EJB project module and WEB Module. Now i have to map the CMP fields of the entity bean to the underlying table. Is it possible to map the cmp fields of the entity bean with out java dictionary? If yes how can we do that.
    I have got some error while mapping an EJB's CMP fields to the table through dictionary. I was actually intended to map 79 fields but it gives an error that more than 64 fields are not allowed while building the dictionary.
    1. Can you tell me what could be the possible reason?
    2. Is it possible to map the cmp fields of the entity bean with out java dictionary? If yes how can we do that.
    Kindly helo me,
    Sudheesh K S

    Hi,
    Sudheesh please check up if the below link helps,there are other ways of writing the persistent.xml for container managed entity bean.
    http://help.sap.com/saphelp_nw04s/helpdata/en/9b/f695f0c84acf46a4e0b31f69d8a9b7/frameset.htm, probably in the studio you cannot browse through tables not in  the java dictionary,but manually editing it may still solve the problem.
    Also here is another link that specifies the databases supported by J2EE Engine.
    http://help.sap.com/saphelp_nw04s/helpdata/en/66/a5283eeb47b40be10000000a114084/frameset.htm
    The below link shows how to specify the database vendor and datasource
    http://help.sap.com/saphelp_nw04s/helpdata/en/e1/67fc3ee241ba28e10000000a114084/frameset.htm
    Hope you are able to solve the problem.
    Do let us know if you come up with the solution.
    Regards,
    Harish
    Message was edited by: HARISH SUBRAMANIAN

  • Creating entity beans with auto numbered primary key

    I have two entity bean with a CMR between them. I am successfully creating the first one but when I try and create the child entity bean I get a NullPointerException.
    Now I think this is because the gernerated code tries to get the primary key of the created entity bean and this is not set as it is set using a auto number in the database (An oracle sequence and trigger).
    Is there anyway i can get round this problem?
    Thanks in advance,
    Adrian

    This is the auto generated code:
         public dmd.sync.ejbs.entity.AppliancePackInfoLocal create_Local(dmd.sync.dataobjects.dto.AppliancePackInfoDTO appliancePackInfoDTO, dmd.sync.ejbs.entity.AmppLocal amppLocal) throws javax.ejb.CreateException, java.rmi.RemoteException {
              BeanO beanO = null;
              dmd.sync.ejbs.entity.AppliancePackInfoLocal result = null;
              boolean createFailed = false;
              boolean preCreateFlag = false;
              try {
                   beanO = super.createBeanO();
                   dmd.sync.ejbs.entity.AppliancePackInfoBean bean = (dmd.sync.ejbs.entity.AppliancePackInfoBean) beanO.getEnterpriseBean();
                   preCreateFlag = super.preEjbCreate(beanO);
                   bean.ejbCreate(appliancePackInfoDTO, amppLocal);
                   Object ejsKey = keyFromBean(bean);
                   result = (dmd.sync.ejbs.entity.AppliancePackInfoLocal) super.postCreate_Local(beanO, ejsKey, true);
                   bean.ejbPostCreate(appliancePackInfoDTO, amppLocal);
                   super.afterPostCreate(beanO, ejsKey);
    It must be falling over on the last line as it calls the ejbPostCreate fine.

  • Multiple users accessing entity bean with same PK

    Hi,
    Some body please clarify the below issue.
    (EJB 1.1, WAS3.5)
    I have two app servers and two clones each clone is running in each app server.
    Stateful session bean access Entity beans to update/read record in the database.
    According to my requirement multiple users can access the same entity data (same primary key). Suppose user A created a Stateful session bean SB1 and the SB1 created Entity1 with PK1, this is happening at clone1.
    User B accessed the site and the request went to Clone2 and a new SB2 created, but the SB2 need to access the database with Same PK1.
    For the above situation, I guess container can not create a new Entity bean with PK1 because EB with PK1 is already there and it tries to allocate same EB1 with SB2, so if two requests are concurrent do the SB2 wait to get the handle of the EB1?
    Is there any way to create two Entity beans with same Primary Key at the same time but in different clone?
    Thanks,
    Sagar

    Hi,
    The concurrency level has to be set at the level of database and the database will take care of consistency & integrity of the data. So specity the concurrency level on the database connection in each appserver.

  • Bad Performance/OutOfMemory Error in CMP Entity Bean with Large DB

    Hello:
    I have an CMP Entity deployed on WLS 7.0
    The entity bean maps to a table that has 97,480 records.
    It has a finder: findAll() -- SELECT OBJECT(e) FROM Equipment e
    I have a JSP client that invokes the findALL()
    The performance is very poor ~ 150 seconds just to perform the findAll() - (Benchmark
    from within the JSP code)
    If more than one simultaneous call is made then I get outOfMemory Error.
    WLS is started with max memory of 512MB
    EJB is deployed with <max-beans-in-cache>100000</max-beans-in-cache>
    (without max-beans-in-cache directive the performance is worse)
    Is there any documentation available to help us in deploying CMP Entity Beans
    with very large number of records (instances) ?
    Any help is greatly appreciated.
    Regards
    Rajan

    Hi
    You should use a Select Method, it does support cursors.
    Or a Home Select Method combination.
    Regards
    Thomas
    WLS is started with max memory of 512MB
    EJB is deployed with <max-beans-in-cache>100000</max-beans-in-cache>>
    (without max-beans-in-cache directive the performance is worse)>
    Is there any documentation available to help us in deploying CMP
    Entity Beans with very large number of records (instances) ? Any help
    is greatly appreciated.>
    Regards>
    Rajan>
    >
    "Rajan Jena" <[email protected]> schrieb im Newsbeitrag
    news:3dadd7d1$[email protected]..
    >
    Hello:
    I have an CMP Entity deployed on WLS 7.0
    The entity bean maps to a table that has 97,480 records.
    It has a finder: findAll() -- SELECT OBJECT(e) FROM Equipment e
    I have a JSP client that invokes the findALL()
    The performance is very poor ~ 150 seconds just to perform the findAll() -(Benchmark
    from within the JSP code)
    If more than one simultaneous call is made then I get outOfMemory Error.
    WLS is started with max memory of 512MB
    EJB is deployed with <max-beans-in-cache>100000</max-beans-in-cache>
    (without max-beans-in-cache directive the performance is worse)
    Is there any documentation available to help us in deploying CMP EntityBeans
    with very large number of records (instances) ?
    Any help is greatly appreciated.
    Regards
    Rajan

  • Clustering with automatic failover of entity beans? (Provided by any vendors)

    Do any vendors provide for clustering with automatic failover of entity
              beans? I know that WLS does not. How about Gemstone? If not is there
              a reason why it is not possible?
              It seems to me that EJB servers should be capable of automatic failover
              of entity beans.
              dan
              

    Sorry I meant to send this to the ejb newsgroup.
              dan
              dan benanav wrote:
              > Do any vendors provide for clustering with automatic failover of entity
              > beans? I know that WLS does not. How about Gemstone? If not is there
              > a reason why it is not possible?
              >
              > It seems to me that EJB servers should be capable of automatic failover
              > of entity beans.
              >
              > dan
              

  • Entity bean with primary key generated by trigger

    Hi,
    We have a table(oracle) with one column as primary key,
    but the primary key is generated by trigger every time
    a new row is inserted into this table, inside the trigger,
    it uses oracle sequence to get the next val.
    If we want to use entity bean with it, what should we specify, it's not application-managed primay key, it's
    not auto-generated primary key either. How can we resolve
    it without change the database part.
    Any thought is appreciated.
    Thanks
    afang

    The code is already there with JDBC call inserting
    into the table, the inserting trigger then will generate
    sequence key and being inserted into primary key column.
    Now wondering if it's possible to change the code to use entity bean but without modifying the trigger (since it contains other business logics).

  • Can Entity Bean with Home Business Method replace Stateless Session Bean?

    Since Entity Bean can have business methods in the Home Interface, can we use Entity Bean with Home Business Methods to replace Stateless Session Bean?
    I am assuming we can get better performance by doing this since the overhead of creating Component Object can be avoided as compared to stateless session beans.

    Requires-new makes the container start a new transaction. Only use that flag
              at the point that you are certain that a NEW transaction should BEGIN. I
              suggest you use Required as your default for all methods in the application,
              and only change that to anything else when you are certain that you should.
              Peace,
              Cameron Purdy
              Tangosol Inc.
              << Tangosol Server: How Weblogic applications are customized >>
              << Download now from http://www.tangosol.com/download.jsp >>
              "A.J,LEE" <[email protected]> wrote in message
              news:3ba5adb2$[email protected]..
              >
              > I find it result in "dead lock"
              > when I call RequiresNew attributed CMP method in session Bean.
              > Then, Is it possible to use CMP which is set with "RequiresNew"
              transaction attribute?
              >
              > I Wonder why.
              >
              > Thanx in advance.
              

  • Did elationship fields in entity bean with CMP same as foreign key in table

    did elationship fields in entity bean with CMP same as foreign key in table database.so we don't have to make some foreign key column in table database.
    did Container handle that both.
    I need some answer
    thank's

    Suppose you have Group and user entity. Relation is 1-m. One group many users. When you create user, you dont need to send group id, All you need is create user and add it in collection (cmr-field) in group(user belongs to). Container will add its group id in user entity as well as in db.

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

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

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

Maybe you are looking for

  • Getting error while importing a table partition

    Hi, I am trying to import a table partition from OEM and occurred with following error: Job IMPORT000042 has been reopened at Friday, 13 June, 2008 14:44 Restarting "SYSMAN"."IMPORT000042": Processing object type TABLE_EXPORT/TABLE/TBL_TABLE_DATA/TAB

  • Jpgs or bmps in RTFs to be stored in CLOBs?

    Which should be used in the templates of the various letterheads of RTF documents to be subsequently stored as Oracle 10G CLOBs-- JPGs or BMPs? Although JPGs start smaller than BMPs, the JPGs in RTFs have larger file sizes than those of BMPs in RTFs.

  • Create SAP RFC iView with a structure as import parameter

    Hello All, I'm creating a SAP RFC iView from Portal SAP 7.4. I try call a RFC that have as import parameter a structure with various fields, but the portal recognizes the structure as string field, then I cannot fill the fields values, and when  I do

  • No RFC authourization

    Hi, One of our user complained that she got no RFC authourization for function group RSBOLAP_BICS_PROVIDER_VAR when trying to open reports from portal that has web templates. can someone provide steps of how I can resolve this issue. thanks

  • Searching for files then renaming

    Hi all, I'm sure there is a simple fix to this but am struggling to find it! I am trying to search for some files in a given folder, then move those files that match the search criteria. I have used the following script, but it keeps producing the er