Translate to EJB-QL

hi,
can someone translate this to EJB-QL
i can't find an example if there is an embedded select statement
SELECT *
FROM table1 t1, table2 t2
WHERE t1.id = ?
AND t2.id IN
(SELECT id
FROM table3
WHERE id = ?)
thanks

Kind of tough considering that for this I have to assume that you are mapping one entity to one table. Plus how are these table organized? Does t1 have multiple t2s and t3s? If you are going to name table t? you are going to have one hell of a time actually making this thing work. Anyways this may be the answer, but since I don't know your structure I cannot be definite of what I am providing.
<![CDATA[SELECT Object(t1) FROM T1EJB AS t1, IN (t1.t3s) AS t3 WHERE t1.id = ?1 AND t1.t2.id  = ?1 AND  t3.id = ?1]]>

Similar Messages

  • Pls help - Syntax question about EJB QL

    Hello,
    I'm new learner on EJB. I went through the specification 2.0 of EJB QL released by Sun, I'm not quite understand the syntax definition of SELECT clause in finder method which described in the following words:
    "In the case of a find method, the SELECT clause is restricted to contain either a single range variable or a single value path expression that evaluates to the abstract schema type of the entity bean for which the finder method is defined.
    Because finder method cannot return arbitrary types, the SELECT clause of an EJB QL defined for a finder method must always correspond to the abstract shcema type fo the entity bean for which the finder method is defined.In contrast, the SELECT clause of a query defined for a select method can return the abstract schema types of other entity beans or the values of cmp-fields."
    As my understanding, I think the SELECT clause of finder method can only contain a single range variable instead of single value path expresson, it should have only one format, which is "SELECT [DISTINCT] OBJECT(identification_variable)".
    For example: the query below is defined in OrderBean findByProductType();
    SELECT OBJECT(o) FROM Order o, IN(o.lineItems) l
    WHERE l.product.product_type = 'schoolsupplies'
    how it could be a single value path expression , I think this format can only be used in Select method.
    The other thing is EJB QL2.0 does not support subquery and "NOT EXIST" clause, does this mean that a SQL query with subquery or "NOT EXIST" clause can't be translated to EJB QL?
    I don't know if I'm correct or not. I'd appreciate if anybody can help me with this.
    Thanks!
    Maggie

    Hi,
    Weblogic
    =======
    In the Weblogic-cmp-rdbms-jar.xml file, we define the Table name as created in the DBMS along with cmp-field mapped to the dbms-columns of the table as described below
    <table-map>
    <table-name>SalesAccounts</table-name>
    <field-map>
    <cmp-field>salesaccountId</cmp-field>
    <dbms-column>sales_acctid</dbms-column>
    </field-map>
    <field-map>
    <cmp-field>salesbalance</cmp-field>
    <dbms-column>sales_bal</dbms-column>
    </field-map>
    <field-map>
    <cmp-field>salesaccountType</cmp-field>
    <dbms-column>sales_type</dbms-column>
    </field-map>
    </table-map>
    Here SalesAccounts is the actual table defined in DBMSD like Oracle say which has columns sales_acctid, sales_bal and sales_type.
    In ejb-jar.xml, you define an abstract schema name ie some sort of alias for your table name (SalesAccounts) along with defining the cmp fields required for writing a EJB-QL.
    <abstract-schema-name>SalesAccountBean</abstract-schema-name>
    <cmp-field><field-name>salesaccountId</field-name>
    </cmp-field>
    <cmp-field><field-name>salesbalance</field-name>
    </cmp-field>
    <cmp-field><field-name>salesaccountType</field-name>
    </cmp-field>
    <primkey-field>salesaccountId</primkey-field>
    Here salesaccountid is defined as a Primary key.
    Now your EJB-QL can be defined in the ejb-jar.xml file as follows
    <query>
    <query-method>
    <method-name>findSalesAccountsCondition</method-name>
    <method-params>
    <method-param>double</method-param>
    </method-params>
    </query-method>
    <ejb-ql>
         <![CDATA[SELECT OBJECT(a) FROM SalesAccountBean AS a WHERE a.salesbalance > ?1]]>
    </ejb-ql>
    </query>
    This should clear ur doubts. Case u have any, revert back to me.
    Rgds,
    Seetesh

  • J2ee web-based DB table editor

    Hi all
    I need to develop a j2ee application through which i can access/edit data in the tables of an oracle DB installed on a remote server. It wud b great if someone can show me right direction so that i can start coding.
    Gurpreet Singh

    If you have trouble with where to start coding then you did not work enough on designing your application.
    You should have well formulate business requirements that you can translate into EJB's or DAO's.
    Think about your requirements and model your J2EE architecture. Once you have a model to work with that covers your requirements then you can start implementing and coding your J2EE objects and you can test them to verify correctness of data.
    The rest is just filling in the blanks.

  • Can not deploy VSM1.3 to oc4j10g 10, can not translate EJB QL

    the OS is win2k
    oc4j version is oc4j 10g(10.0.3.0.0)
    started oc4j by java -Ddefault.cmp.pm=native_cmp -jar oc4j.jar
    when deploying vsm, the following EJB QL error:
    deploy-oc4j:
    [java] Error: Deploy error: deploy failed!: ; nested exception is:
    [java] oracle.oc4j.admin.internal.DeployerException: java.lang.Instanti
    ationException: Error initializing ejb-module, Exception: Compile error: Error t
    ranslating EJBQL: java.lang.NullPointerException
    [java] com.evermind.client.orion.AdminCommandException: Deploy error: deplo
    y failed!: ; nested exception is:
    [java] oracle.oc4j.admin.internal.DeployerException: java.lang.Instanti
    ationException: Error initializing ejb-module, Exception: Compile error: Error t
    ranslating EJBQL: java.lang.NullPointerException
    [java] at com.evermind.client.orion.DeployCommand.execute(DeployCommand
    .java:95)
    [java] at com.evermind.client.orion.Oc4jAdminConsole.executeCommand(Oc4
    jAdminConsole.java:117)
    [java] at com.evermind.client.orion.Oc4jAdminConsole.main(Oc4jAdminCons
    ole.java:26)
    [java] java.rmi.RemoteException: deploy failed!: ; nested exception is:
    [java] oracle.oc4j.admin.internal.DeployerException: java.lang.Instanti
    ationException: Error initializing ejb-module, Exception: Compile error: Error t
    ranslating EJBQL: java.lang.NullPointerException
    [java] at com.evermind.server.rmi.RMIConnection.EXCEPTION_ORIGINATES_FR
    OM_THE_REMOTE_SERVER(RMIConnection.java:908)
    [java] at com.evermind.server.rmi.RMIConnection.invokeMethod(RMIConnect
    ion.java:802)
    [java] at com.evermind.server.rmi.RemoteInvocationHandler.invoke(Remote
    InvocationHandler.java:69)
    [java] at com.evermind.server.rmi.RecoverableRemoteInvocationHandler.in
    voke(RecoverableRemoteInvocationHandler.java:22)
    [java] at __Proxy0.deploy(Unknown Source)
    [java] at com.evermind.client.orion.DeployCommand.execute(DeployCommand
    .java:92)
    [java] at com.evermind.client.orion.Oc4jAdminConsole.executeCommand(Oc4
    jAdminConsole.java:117)
    [java] at com.evermind.client.orion.Oc4jAdminConsole.main(Oc4jAdminCons
    ole.java:26)
    [java] Caused by: oracle.oc4j.admin.internal.DeployerException: java.lang.I
    nstantiationException: Error initializing ejb-module, Exception: Compile error:
    Error translating EJBQL: java.lang.NullPointerException
    [java] at oracle.oc4j.admin.internal.DeployerBase.execute(DeployerBase.
    java:75)
    [java] at com.evermind.server.administration.DefaultApplicationServerAd
    ministrator.internalDeploy(DefaultApplicationServerAdministrator.java:376)
    [java] at com.evermind.server.administration.DefaultApplicationServerAd
    ministrator.deploy(DefaultApplicationServerAdministrator.java:276)
    [java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    [java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcces
    sorImpl.java:39)
    [java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMet
    hodAccessorImpl.java:25)
    [java] at java.lang.reflect.Method.invoke(Method.java:324)
    [java] at com.evermind.server.rmi.RMICallHandler.run(RMICallHandler.jav
    a:86)
    [java] at com.evermind.server.rmi.RMICallHandler.run(RMICallHandler.jav
    a:56)
    [java] at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.r
    un(ReleasableResourcePooledExecutor.java:291)
    [java] at java.lang.Thread.run(Thread.java:534)
    [java] Caused by: java.lang.InstantiationException: Error initializing ejb-
    module, Exception: Compile error: Error translating EJBQL: java.lang.NullPointer
    Exception
    [java] at com.evermind.server.ejb.EJBContainer.postInit(EJBContainer.ja
    va:1076)
    [java] at com.evermind.server.Application.postInit(Application.java:688
    [java] at com.evermind.server.Application.setConfig(Application.java:20
    1)
    [java] at com.evermind.server.ApplicationServer.addApplication(Applicat
    ionServer.java:1947)
    [java] at oracle.oc4j.admin.internal.ApplicationDeployer.addApplication
    (ApplicationDeployer.java:382)
    [java] at oracle.oc4j.admin.internal.ApplicationDeployer.doDeploy(Appli
    cationDeployer.java:134)
    [java] at oracle.oc4j.admin.internal.DeployerBase.execute(DeployerBase.
    java:61)
    [java] ... 10 more
    [java] Caused by: java.lang.InstantiationException: Compile error: Error tr
    anslating EJBQL: java.lang.NullPointerException
    [java] at com.evermind.server.ejb.EJBContainer.postInit(EJBContainer.ja
    va:1021)
    [java] ... 16 more
    [java] Caused by: com.evermind.compiler.CompilationException: Error transla
    ting EJBQL: java.lang.NullPointerException
    [java] at com.evermind.server.ejb.compilation.Compilation.translateEjbq
    lQeries(Compilation.java:229)
    [java] at com.evermind.server.ejb.compilation.Compilation.compile(Compi
    lation.java:265)
    [java] at com.evermind.server.ejb.EJBContainer.postInit(EJBContainer.ja
    va:930)
    [java] ... 16 more
    [java] ---- Embedded exception
    [java] oracle.oc4j.admin.internal.DeployerException: java.lang.Instantiatio
    nException: Error initializing ejb-module, Exception: Compile error: Error trans
    lating EJBQL: java.lang.NullPointerException
    [java] at oracle.oc4j.admin.internal.DeployerBase.execute(DeployerBase.
    java:75)
    [java] at com.evermind.server.administration.DefaultApplicationServerAd
    ministrator.internalDeploy(DefaultApplicationServerAdministrator.java:376)
    [java] at com.evermind.server.administration.DefaultApplicationServerAd
    ministrator.deploy(DefaultApplicationServerAdministrator.java:276)
    [java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    [java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcces
    sorImpl.java:39)
    [java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMet
    hodAccessorImpl.java:25)
    [java] at java.lang.reflect.Method.invoke(Method.java:324)
    [java] at com.evermind.server.rmi.RMICallHandler.run(RMICallHandler.jav
    a:86)
    [java] at com.evermind.server.rmi.RMICallHandler.run(RMICallHandler.jav
    a:56)
    [java] at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.r
    un(ReleasableResourcePooledExecutor.java:291)
    [java] at java.lang.Thread.run(Thread.java:534)
    [java] Caused by: java.lang.InstantiationException: Error initializing ejb-
    module, Exception: Compile error: Error translating EJBQL: java.lang.NullPointer
    Exception
    [java] at com.evermind.server.ejb.EJBContainer.postInit(EJBContainer.ja
    va:1076)
    [java] at com.evermind.server.Application.postInit(Application.java:688
    [java] at com.evermind.server.Application.setConfig(Application.java:20
    1)
    [java] at com.evermind.server.ApplicationServer.addApplication(Applicat
    ionServer.java:1947)
    [java] at oracle.oc4j.admin.internal.ApplicationDeployer.addApplication
    (ApplicationDeployer.java:382)
    [java] at oracle.oc4j.admin.internal.ApplicationDeployer.doDeploy(Appli
    cationDeployer.java:134)
    [java] at oracle.oc4j.admin.internal.DeployerBase.execute(DeployerBase.
    java:61)
    [java] ... 10 more
    [java] Caused by: java.lang.InstantiationException: Compile error: Error tr
    anslating EJBQL: java.lang.NullPointerException
    [java] at com.evermind.server.ejb.EJBContainer.postInit(EJBContainer.ja
    va:1021)
    [java] ... 16 more
    [java] Caused by: com.evermind.compiler.CompilationException: Error transla
    ting EJBQL: java.lang.NullPointerException
    [java] at com.evermind.server.ejb.compilation.Compilation.translateEjbq
    lQeries(Compilation.java:229)
    [java] at com.evermind.server.ejb.compilation.Compilation.compile(Compi
    lation.java:265)
    [java] at com.evermind.server.ejb.EJBContainer.postInit(EJBContainer.ja
    va:930)
    [java] ... 16 more
    [java] Java Result: 1
    [java] Error: bindWebApp() failed!; nested exception is:
    [java] oracle.oc4j.admin.internal.DeployerException: Web module VSMWeb
    does not exist in application vsm
    [java] com.evermind.client.orion.AdminCommandException: bindWebApp() failed
    !; nested exception is:
    [java] oracle.oc4j.admin.internal.DeployerException: Web module VSMWeb
    does not exist in application vsm
    [java] at com.evermind.client.orion.BindWebAppCommand.execute(BindWebAp
    pCommand.java:31)
    [java] at com.evermind.client.orion.Oc4jAdminConsole.executeCommand(Oc4
    jAdminConsole.java:117)
    [java] at com.evermind.client.orion.Oc4jAdminConsole.main(Oc4jAdminCons
    ole.java:26)
    [java] java.rmi.RemoteException: bindWebApp() failed!; nested exception is:
    [java] oracle.oc4j.admin.internal.DeployerException: Web module VSMWeb
    does not exist in application vsm
    [java] at com.evermind.server.rmi.RMIConnection.EXCEPTION_ORIGINATES_FR
    OM_THE_REMOTE_SERVER(RMIConnection.java:908)
    [java] at com.evermind.server.rmi.RMIConnection.invokeMethod(RMIConnect
    ion.java:802)
    [java] at com.evermind.server.rmi.RemoteInvocationHandler.invoke(Remote
    InvocationHandler.java:69)
    [java] at com.evermind.server.rmi.RecoverableRemoteInvocationHandler.in
    voke(RecoverableRemoteInvocationHandler.java:22)
    [java] at __Proxy0.bindWebApp(Unknown Source)
    [java] at com.evermind.client.orion.BindWebAppCommand.execute(BindWebAp
    pCommand.java:28)
    [java] at com.evermind.client.orion.Oc4jAdminConsole.executeCommand(Oc4
    jAdminConsole.java:117)
    [java] at com.evermind.client.orion.Oc4jAdminConsole.main(Oc4jAdminCons
    ole.java:26)
    [java] Caused by: oracle.oc4j.admin.internal.DeployerException: Web module
    VSMWeb does not exist in application vsm
    [java] at oracle.oc4j.admin.internal.WebApplicationBinder.bindWebApp(We
    bApplicationBinder.java:187)
    [java] at com.evermind.server.administration.DefaultApplicationServerAd
    ministrator.bindWebApp(DefaultApplicationServerAdministrator.java:362)
    [java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    [java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcces
    sorImpl.java:39)
    [java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMet
    hodAccessorImpl.java:25)
    [java] at java.lang.reflect.Method.invoke(Method.java:324)
    [java] at com.evermind.server.rmi.RMICallHandler.run(RMICallHandler.jav
    a:86)
    [java] at com.evermind.server.rmi.RMICallHandler.run(RMICallHandler.jav
    a:56)
    [java] at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.r
    un(ReleasableResourcePooledExecutor.java:297)
    [java] at java.lang.Thread.run(Thread.java:534)
    [java] ---- Embedded exception
    [java] oracle.oc4j.admin.internal.DeployerException: Web module VSMWeb does
    not exist in application vsm
    [java] at oracle.oc4j.admin.internal.WebApplicationBinder.bindWebApp(We
    bApplicationBinder.java:187)
    [java] at com.evermind.server.administration.DefaultApplicationServerAd
    ministrator.bindWebApp(DefaultApplicationServerAdministrator.java:362)
    [java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    [java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcces
    sorImpl.java:39)
    [java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMet
    hodAccessorImpl.java:25)
    [java] at java.lang.reflect.Method.invoke(Method.java:324)
    [java] at com.evermind.server.rmi.RMICallHandler.run(RMICallHandler.jav
    a:86)
    [java] at com.evermind.server.rmi.RMICallHandler.run(RMICallHandler.jav
    a:56)
    [java] at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.r
    un(ReleasableResourcePooledExecutor.java:297)
    [java] at java.lang.Thread.run(Thread.java:534)
    [java] Java Result: 17

    I have a 10.1.2 app that deploys and binds just fine,
    but when I try to deploy the same app on a 10.1.3
    version it seems to deploy just fine but I can not
    access the application. When I go into the web
    frontend of the 10.1.3 server I see my app is
    deployed, status is shown as green but when I click
    on the web app it says that no JSPs were found also
    it is not bound. I deploy using the auto deploy
    feature.Can you check and see that the http-web-site.xml has a valid <web-app> entry for your web module?
    Have you tried to access a specific JSP and see the same error? Or are you trying to access just the root context?
    Can you try deploying the application using the deployment function in Application Server Control (http://host:1810) and see if it works and/or reports any error messages?
    -steve-

  • Need help translating SQL to EJB QL

    Hi all.
    I've been having issues with a EJB QL join not returning the results I would like. In my application we have SKUs (Sku table), and we have instances of inventory that are linked to a particular SKU (SkuInventory table). I want to find all the SKUs, and how many unpurchased inventory we have for each SKU. A SkuInventory is unpurchased if its purchaserAccount field is null. Here's my EJB QL as it stands:
    SELECT s, count(inventory) FROM Sku s LEFT OUTER JOIN s.skuInventoryCollection as inventory where inventory.purchaserAccount IS NULL GROUP BY s ORDER BY s.name
    This finds all the SKUs that have unpurchased inventory (returning the count of unpurchased inventory), and the SKUs that have no inventory at all (returning a count of 0), but does not return SKUs that do have inventory, but the inventory has all been purchased. I want the query to return that last category of SKU also, with a count of 0. Any help is very much appreciated. I can get the results I want in regular SQL as follows:
    select s.*, count(i.id) from sku s LEFT JOIN sku_inventory i on i.sku_id = s.id and i.purchaser_account_id IS NULL GROUP BY s.id, s.name;
    Thanks,
    Andrew
    Edited by: aocole on Nov 14, 2008 9:36 AM

    I have solved this problem. The WITH clause is the equivalent of ON in SQL with regard to adding extra conditions to a join. My final EJB QL was:
    SELECT s, count(inventory) FROM Sku s LEFT OUTER JOIN s.skuInventoryCollection as inventory WITH inventory.purchaseDate IS NULL GROUP BY s ORDER BY s.name
    You'll notice that I changed to using inventory.purchaseDate instead of inventory.purchaserAccount because the query processor complained about "with clause can only reference columns in the driving table" when I used the purchaserAccount (which is a join column to an account table). Is that a bug in EJB QL? it seems like it.
    It seems like there is very little documentation of the WITH clause. It is not mentioned in the O'Reilly EJB 3.0 5th Ed. book, nor in a few EJB QL references I found online.
    Andrew

  • Translating custom flat file database to an EJB

    Hello all
    I'm very new to JEE, so bare with me. ;-)
    I'm working on an application where we have a very large database spread across many flat files. The database contains key value pairs. We also have an index. Currently, our non-JEE application instantiates an object that loads the indexes from disk and handles lookups from a method call. A lookup involves finding the approximate location of a key value pair by looking at the index and then doing a search through one of the larger files.
    How does one translate this database to something that runs inside a JEE application server? Since we have multiple clients doing lookups, I'm guessing this custom database could be realized as a message-driven bean. However, how does one create these beans so that the indexes are only loaded once during the lifetime of the application? Also, how does one handle things like configuration of where the bean should find the indexes and flat files on disk?
    Loading our data into an SQL database and using JDBC isn't going to work in this case due to the size of the data we're dealing with.
    Thanks for any help.
    Regards,

    You can use the following as a guideline to do this. The loadIndexes() method must be called from (every) your business method. You can optimize this by calling loadIndex from a @PostConstruct method.
    As far as configuration, this code assumes that you have an environment entry called location that points to the location of your indexes.
    Example
    public class Foo implements MyBusinessInterface {
    private static Object lock = new Object();
    private static boolean loadedIndexes = false;
    public Foo() {
    public void loadIndexes() {
    synchronized (lock) {
    if (loadedIndexes == false) {
    String location = (String) ctx.lookup("java:comp/ejn/location");
    //location now contains the location of index.
    //Read and load index here
    loadedIndex = tue;
    public void someBusinessMethod() {
    loadIndexes();
    //doWork.......
    }

  • RE: [iPlanet-JATO] EJB in iMT

    Matt,
    Thanks for your clarifications.That helps a lot.
    We have found in a lot of cases, that your new components can be
    implemented as JATO ModelsI don't understand this.Is it that EJB acts as the Data Model or something
    Thanks,
    Gajendran.
    "Matthew Stevens"
    Subject: RE: [iPlanet-JATO]
    EJB in iMT
    10/30/01 07:34 PM
    Please respond to
    iPlanet-JATO
    Gajendran,
    The iMT for NetDynamics does not current have any translation requirement
    for EJBs. If you have a ND 3.x or ND 4.x application then you have no
    pre-existing EJBs. ND 5.0 provided an EJB 1.0 container for Session Beans
    but the Migration leaves the EJBs untouched. The migration path for ND 5.0
    EJBs to J2EE EJBs is clear - it simply requires a recompiling and packaging
    and tweaking. I have done this at some customer sites and it is very
    straight forward. In many cases, you may find that your choice of an EJB
    implementation does not truely take advantage of the features of the EJB
    container and you EJBs are simply business objects (stateless and
    stateful).
    We have found that migrating stateless and stateful ND 5.0 EJBs to JATO
    Models is very simple and greatly improves the performance in many cases.
    Now that your ND application is migated to J2EE/JATO you can easily add
    EJBs
    to the application; JATO does not prevent this in any way. Some customers
    are even adapting existing or 3rd party EJBs to JATO Models interfaces, but
    this is not necessary. Your EJBs will be packaged separately in JAR file
    and combined with JATO Application WAR file in an EAR file. We recommend
    using a good tool like Forte to generate your EJBs. I personally suggest
    that you carefully plan and analyze your requirements before moving forward
    with the EJBs. Please make sure that you your new components 'need' the
    features of the EJB container/framework. If you need an Entity bean then
    use it. We have found in a lot of cases, that your new components can be
    implemented as JATO Models. It all depends on the dynamics of the
    application and constitution of your data.
    matt
    -----Original Message-----
    From: gajendran.gopinathan@i...
    [mailto:<a href="/group/SunONE-JATO/post?protectID=123166177056078154218098066036192063041102166009043241114211116056004136218164200193244096076095219">gajendran.gopinathan@i...</a>]
    Sent: Tuesday, October 30, 2001 6:40 AM
    Subject: [iPlanet-JATO] EJB in iMT
    We have migrated an application in ND3.0 to J2EE using iMT 1.1.1.
    Is there any provision in iMT which could generate EJBs?
    What is the recommended approach towards this?
    Thanks,
    Gajendran
    For more information about JATO, please visit:
    http://developer.iplanet.com/tech/appserver/framework/index.jsp
    For more information about JATO, please visit:
    http://developer.iplanet.com/tech/appserver/framework/index.jsp
    ------------------------Disclaimer------------------------
    The views of the author may not necessarily reflect those
    of the Company. All liability is excluded to the extent
    permitted by law for any claims arising as a result of the
    use of this medium to transmit information by or to
    IT Solutions (India) Pvt. Ltd.
    We have taken precautions to minimize the risk of
    transmitting software viruses, but we advise you to
    carry out your own virus checks on any attachment to
    this message. We cannot accept liability for any loss or
    damage caused by software viruses.
    ------------------------Disclaimer------------------------

    Matt,
    Thanks for your clarifications.That helps a lot.
    We have found in a lot of cases, that your new components can be
    implemented as JATO ModelsI don't understand this.Is it that EJB acts as the Data Model or something
    Thanks,
    Gajendran.
    "Matthew Stevens"
    Subject: RE: [iPlanet-JATO]
    EJB in iMT
    10/30/01 07:34 PM
    Please respond to
    iPlanet-JATO
    Gajendran,
    The iMT for NetDynamics does not current have any translation requirement
    for EJBs. If you have a ND 3.x or ND 4.x application then you have no
    pre-existing EJBs. ND 5.0 provided an EJB 1.0 container for Session Beans
    but the Migration leaves the EJBs untouched. The migration path for ND 5.0
    EJBs to J2EE EJBs is clear - it simply requires a recompiling and packaging
    and tweaking. I have done this at some customer sites and it is very
    straight forward. In many cases, you may find that your choice of an EJB
    implementation does not truely take advantage of the features of the EJB
    container and you EJBs are simply business objects (stateless and
    stateful).
    We have found that migrating stateless and stateful ND 5.0 EJBs to JATO
    Models is very simple and greatly improves the performance in many cases.
    Now that your ND application is migated to J2EE/JATO you can easily add
    EJBs
    to the application; JATO does not prevent this in any way. Some customers
    are even adapting existing or 3rd party EJBs to JATO Models interfaces, but
    this is not necessary. Your EJBs will be packaged separately in JAR file
    and combined with JATO Application WAR file in an EAR file. We recommend
    using a good tool like Forte to generate your EJBs. I personally suggest
    that you carefully plan and analyze your requirements before moving forward
    with the EJBs. Please make sure that you your new components 'need' the
    features of the EJB container/framework. If you need an Entity bean then
    use it. We have found in a lot of cases, that your new components can be
    implemented as JATO Models. It all depends on the dynamics of the
    application and constitution of your data.
    matt
    -----Original Message-----
    From: gajendran.gopinathan@i...
    [mailto:<a href="/group/SunONE-JATO/post?protectID=123166177056078154218098066036192063041102166009043241114211116056004136218164200193244096076095219">gajendran.gopinathan@i...</a>]
    Sent: Tuesday, October 30, 2001 6:40 AM
    Subject: [iPlanet-JATO] EJB in iMT
    We have migrated an application in ND3.0 to J2EE using iMT 1.1.1.
    Is there any provision in iMT which could generate EJBs?
    What is the recommended approach towards this?
    Thanks,
    Gajendran
    For more information about JATO, please visit:
    http://developer.iplanet.com/tech/appserver/framework/index.jsp
    For more information about JATO, please visit:
    http://developer.iplanet.com/tech/appserver/framework/index.jsp
    ------------------------Disclaimer------------------------
    The views of the author may not necessarily reflect those
    of the Company. All liability is excluded to the extent
    permitted by law for any claims arising as a result of the
    use of this medium to transmit information by or to
    IT Solutions (India) Pvt. Ltd.
    We have taken precautions to minimize the risk of
    transmitting software viruses, but we advise you to
    carry out your own virus checks on any attachment to
    this message. We cannot accept liability for any loss or
    damage caused by software viruses.
    ------------------------Disclaimer------------------------

  • Error EJB:010116 and what is the best fix?

    I got an EJB:010116 error and need some advice on how to fix it (quickly, I am
    running out of time).
    My basic understanding of the problem is:
    1. I defined a many2many relationship with a join table, say ProviderEJB to ProviderKeyEJB,
    the cmr field for ProviderEJB is providerKeys and a correcponding abstract method
    with default transaction-attribute (not specified):
    abstract public Set getProviderKeys();
    2. generated code with ejbgen 215
    3. deployed to weblogic 8.1 SP1 JDK141_03
    4. at run time, my facade session ejb find a local ejb instance of ProviderEJB,
    call its method getProviderKeys() to get a set of local instance of ProviderKeyEJB.
    all works OK up to this point.
    5. then the facade session ejb try to iterate through this set of object and at
    this point I got an exception from weblogic:
    java.lang.IllegalStateException: [EJB:010116]Attempted to access the collection
    valued cmr field, 'providerKeys' for bean 'ProviderEJB', outside of the scope
    of a transaction. All access to the collection must be performed during the transaction
    in which the collection was initially retrieved.
    6. Very clear message. I can understand the meaning of it. However, the getProviderKeys()
    method was declared abstract and was generated and implemented by ejbgen. So how
    can I access this collection INSIDE of the transaction?
    In general, does that mean I will have to turn off the transactions on my entity
    beans and let the facade session ejbs to manage the transactions? if so, why do
    I need the CMP entity beans in the first place?
    So assume I have to do this way, does that mean I have to add the ejbgen tag "transaction-attribute
    = Supported" for those methods that I do not want to have a transaction?
    On another separate issue, just read weblogic 8.1 doc on ejbs and it recomends
    that do not use facade session beans and DTO (value objects) from the web tie,
    simply access local entity beans directly. Any experience on this, in terms of
    design issues. Obviously I understand it will go faster without a facade, but
    what about clean architect of your software design?
    Many thanks and best regards.
    Charles

    Hi,
    for this particular case, you should implement a transfer routine at IObj level (general TAB in RSD1/0MATERIAL)
    the code is as easy as
    TRANSLATE RESULT TO UPPER CASE.
    RETURNCODE = 0.
    this will be executed whenever you load 0MATERIAL.
    hope this helps....
    Olivier.

  • Why is it so hard to deploy EJBs that contain SQLJ???

    The SQLJ translator creates _SJProfilex.ser files by default that
    contain the SQL statements the SQLJ file uses. When trying to
    use a SQLJ file for an EJB, I can't get it to deploy right--in
    fact I'm thrawted at every turn! (THIS SHOULD BE EASY!)
    1) .ser files aren't deployed by default. O.K., I added the .ser
    rule in the deployment file. No dice, still doesn't show up in
    the JAR file!
    2) Even if I force the .ser file to be in the JAR (by including
    it in the project), still no dice! After deployment, the .ser
    file doesn't make it to the server.
    3) O.K., there's a nice -ser2class option to SQLJ that turns it
    into a class file instead of a .ser file. But where to add that
    option? It's not in the SQLJ options of the project properties.
    I also tried an SQLJ_OPTIONS environment variable, and putting an
    sqlj.properties file in all the suggested places. Nothing works!
    The only way I've been able to get it to work is to manually JAR
    the .ser file, ftp it to the server, and run loadjava on it.
    THERE HAS GOT TO BE AN EASIER WAY! ...so much for one-click
    deployment.
    Please help!
    null

    Hi John,
    There is an issue with deploying SQLJ files in 8.1.5.
    The doc (help sytem ) gives more details on how to deploy them.
    Open Online Help system
    Double click on the Sample Applications book icon
    Double click on the "web Application for Oracle8i" book
    Open "Deploying the EJB's"
    On the right hand window you will find a topic
    "Deploying the SQLJ files used by the Rentals EJB"
    this should take you through the deployment of SQLJ files.
    regards
    raghu
    John K. Peterson (guest) wrote:
    : The SQLJ translator creates _SJProfilex.ser files by default
    that
    : contain the SQL statements the SQLJ file uses. When trying to
    : use a SQLJ file for an EJB, I can't get it to deploy right--in
    : fact I'm thrawted at every turn! (THIS SHOULD BE EASY!)
    : 1) .ser files aren't deployed by default. O.K., I added the
    .ser
    : rule in the deployment file. No dice, still doesn't show up in
    : the JAR file!
    : 2) Even if I force the .ser file to be in the JAR (by including
    : it in the project), still no dice! After deployment, the .ser
    : file doesn't make it to the server.
    : 3) O.K., there's a nice -ser2class option to SQLJ that turns it
    : into a class file instead of a .ser file. But where to add
    that
    : option? It's not in the SQLJ options of the project
    properties.
    : I also tried an SQLJ_OPTIONS environment variable, and putting
    an
    : sqlj.properties file in all the suggested places. Nothing
    works!
    : The only way I've been able to get it to work is to manually
    JAR
    : the .ser file, ftp it to the server, and run loadjava on it.
    : THERE HAS GOT TO BE AN EASIER WAY! ...so much for one-click
    : deployment.
    : Please help!
    null

  • EJB 3.0 JPA: java.lang.NullPointerException at  JdbcOdbcDriver.initialize()

    Hello every body,
    I'm trying to implement EJB 3.0 JPA .
    The entities Users ,and Products are created ,
    and the client is as shown below:
    package com.prapansol.demos;
    import java.util.List;
    import javax.ejb.EJB;
    import com.xyz.demos.ejb30.Users;
    import javax.persistence.EntityManager;
    import javax.persistence.EntityManagerFactory;
    import javax.persistence.Persistence;
    import javax.persistence.PersistenceContext;
    public class Client {
    private EntityManager manager;
    public Client() {
    EntityManagerFactory emf = Persistence.createEntityManagerFactory("EJB");
    EntityManager em=emf.createEntityManager();
    this.setEntityManager(em);
    /** <code>select o from Users o</code> */
    public List<Users> queryUsersFindAll() {
    List<Users> users =null;
    try{
    users= getEntityManager().createNamedQuery("Users.findAll").getResultList();
    //@NamedQuery(name = "Users.findAll", query = "select o from Users o") has been defined in Users entity
    }catch(Exception e){
    System.out.println(e.getClass().getName());
    System.out.println(e.getMessage());
    e.printStackTrace();
    return users;
    public void shutDown(){
    getEntityManager().close();
    public void setEntityManager(EntityManager manager) {
    this.manager = manager;
    public EntityManager getEntityManager() {
    return manager;
    public static void main(String[] args) {
    Client client = new Client();
    List<Users> users=client.queryUsersFindAll();
         for(Users user : users ){System.out.println(""+user.getFirstName()+user.getLastName()); }
    The persistence.xml file is:
    <?xml version="1.0" encoding="UTF-8" ?>
    <persistence xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
    version="1.0" xmlns="http://java.sun.com/xml/ns/persistence">
    <persistence-unit name="EJB">
    <provider>oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider</provider>
    <class>com.xyz.demos.ejb30.Users</class>
    <class>com.xyz.demos.ejb30.Products</class>
    <class>com.xyz..demos.ejb30.ServiceRequests</class>
    <class>com.xyz.demos.ejb30.ServiceHistories</class>
    <class>com.xyz.demos.ejb30.ExpertiseAreas</class>
    <properties>
    <property name="jdbc.driver" value="oracle.jdbc.driver.OracleDriver"/>
    <property name="jdbc.connection.string" value="jdbc:oracle:thin:@localhost:1521:ORCL"/>
    <property name="jdbc.user" value="scott"/>
    <property name="jdbc.password" value="tiger"/>
    <property name="toplink.logging.level" value="INFO"/>
    </properties>
    </persistence-unit>
    </persistence>
    Here are the log messages :
    [TopLink Finest]: 2007.03.23 01:36:15.095--ServerSession(32012057)--Thread(Thread[main,5,main])--property=toplink.weaving; value=true
    [TopLink Config]: 2007.03.23 01:36:15.323--ServerSession(32012057)--Thread(Thread[main,5,main])--The alias name for the entity class [class com.prapansol.demos.technology.Users] is being defaulted to: Users.
    [TopLink Config]: 2007.03.23 01:36:15.335--ServerSession(32012057)--Thread(Thread[main,5,main])--The table name for entity [class com.prapansol.demos.technology.Users] is being defaulted to: USERS.
    [TopLink Config]: 2007.03.23 01:36:15.360--ServerSession(32012057)--Thread(Thread[main,5,main])--The column name for element [private java.lang.String com.prapansol.demos.technology.Users.city] is being defaulted to: CITY.
    [TopLink Config]: 2007.03.23 01:36:15.377--ServerSession(32012057)--Thread(Thread[main,5,main])--The column name for element [private java.lang.String com.prapansol.demos.technology.Users.email] is being defaulted to: EMAIL.
    [TopLink Config]: 2007.03.23 01:36:15.431--ServerSession(32012057)--Thread(Thread[main,5,main])--The alias name for the entity class [class com.prapansol.demos.technology.ServiceHistories] is being defaulted to: ServiceHistories.
    [TopLink Config]: 2007.03.23 01:36:15.435--ServerSession(32012057)--Thread(Thread[main,5,main])--The column name for element [private java.lang.String com.prapansol.demos.technology.ServiceHistories.notes] is being defaulted to: NOTES.
    [TopLink Config]: 2007.03.23 01:36:15.456--ServerSession(32012057)--Thread(Thread[main,5,main])--The alias name for the entity class [class com.prapansol.demos.technology.ServiceRequests] is being defaulted to: ServiceRequests.
    [TopLink Config]: 2007.03.23 01:36:15.460--ServerSession(32012057)--Thread(Thread[main,5,main])--The column name for element [private java.lang.String com.prapansol.demos.technology.ServiceRequests.status] is being defaulted to: STATUS.
    [TopLink Config]: 2007.03.23 01:36:15.461--ServerSession(32012057)--Thread(Thread[main,5,main])--The alias name for the entity class [class com.prapansol.demos.technology.Products] is being defaulted to: Products.
    [TopLink Config]: 2007.03.23 01:36:15.464--ServerSession(32012057)--Thread(Thread[main,5,main])--The table name for entity [class com.prapansol.demos.technology.Products] is being defaulted to: PRODUCTS.
    [TopLink Config]: 2007.03.23 01:36:15.466--ServerSession(32012057)--Thread(Thread[main,5,main])--The column name for element [private java.lang.String com.prapansol.demos.technology.Products.description] is being defaulted to: DESCRIPTION.
    [TopLink Config]: 2007.03.23 01:36:15.466--ServerSession(32012057)--Thread(Thread[main,5,main])--The column name for element [private java.lang.String com.prapansol.demos.technology.Products.image] is being defaulted to: IMAGE.
    [TopLink Config]: 2007.03.23 01:36:15.467--ServerSession(32012057)--Thread(Thread[main,5,main])--The column name for element [private java.lang.String com.prapansol.demos.technology.Products.name] is being defaulted to: NAME.
    [TopLink Config]: 2007.03.23 01:36:15.468--ServerSession(32012057)--Thread(Thread[main,5,main])--The alias name for the entity class [class com.prapansol.demos.technology.ExpertiseAreas] is being defaulted to: ExpertiseAreas.
    [TopLink Config]: 2007.03.23 01:36:15.470--ServerSession(32012057)--Thread(Thread[main,5,main])--The column name for element [private java.lang.String com.prapansol.demos.technology.ExpertiseAreas.notes] is being defaulted to: NOTES.
    [TopLink Config]: 2007.03.23 01:36:15.574--ServerSession(32012057)--Thread(Thread[main,5,main])--The target entity (reference) class for the one to many mapping element [private java.util.List com.prapansol.demos.technology.ServiceRequests.serviceHistoriesList] is being defaulted to: class com.prapansol.demos.technology.ServiceHistories.
    [TopLink Config]: 2007.03.23 01:36:15.579--ServerSession(32012057)--Thread(Thread[main,5,main])--The target entity (reference) class for the many to one mapping element [private com.prapansol.demos.technology.ServiceRequests com.prapansol.demos.technology.ServiceHistories.serviceRequests] is being defaulted to: class com.prapansol.demos.technology.ServiceRequests.
    [TopLink Config]: 2007.03.23 01:36:15.592--ServerSession(32012057)--Thread(Thread[main,5,main])--The target entity (reference) class for the one to many mapping element [private java.util.List com.prapansol.demos.technology.Users.serviceHistoriesList] is being defaulted to: class com.prapansol.demos.technology.ServiceHistories.
    [TopLink Config]: 2007.03.23 01:36:15.593--ServerSession(32012057)--Thread(Thread[main,5,main])--The target entity (reference) class for the many to one mapping element [private com.prapansol.demos.technology.Users com.prapansol.demos.technology.ServiceHistories.users] is being defaulted to: class com.prapansol.demos.technology.Users.
    [TopLink Config]: 2007.03.23 01:36:15.593--ServerSession(32012057)--Thread(Thread[main,5,main])--The target entity (reference) class for the one to many mapping element [private java.util.List com.prapansol.demos.technology.Users.expertiseAreasList] is being defaulted to: class com.prapansol.demos.technology.ExpertiseAreas.
    [TopLink Config]: 2007.03.23 01:36:15.594--ServerSession(32012057)--Thread(Thread[main,5,main])--The target entity (reference) class for the many to one mapping element [private com.prapansol.demos.technology.Users com.prapansol.demos.technology.ExpertiseAreas.users] is being defaulted to: class com.prapansol.demos.technology.Users.
    [TopLink Config]: 2007.03.23 01:36:15.594--ServerSession(32012057)--Thread(Thread[main,5,main])--The target entity (reference) class for the many to one mapping element [private com.prapansol.demos.technology.Products com.prapansol.demos.technology.ExpertiseAreas.products] is being defaulted to: class com.prapansol.demos.technology.Products.
    [TopLink Config]: 2007.03.23 01:36:15.595--ServerSession(32012057)--Thread(Thread[main,5,main])--The target entity (reference) class for the one to many mapping element [private java.util.List com.prapansol.demos.technology.Products.expertiseAreasList] is being defaulted to: class com.prapansol.demos.technology.ExpertiseAreas.
    [TopLink Finer]: 2007.03.23 01:36:15.600--ServerSession(32012057)--Thread(Thread[main,5,main])--Weaver processing class [com.prapansol.demos.technology.Users].
    [TopLink Finer]: 2007.03.23 01:36:15.601--ServerSession(32012057)--Thread(Thread[main,5,main])--Weaver processing class [com.prapansol.demos.technology.ServiceHistories].
    [TopLink Finer]: 2007.03.23 01:36:15.601--ServerSession(32012057)--Thread(Thread[main,5,main])--Weaver processing class [com.prapansol.demos.technology.ServiceRequests].
    [TopLink Finer]: 2007.03.23 01:36:15.601--ServerSession(32012057)--Thread(Thread[main,5,main])--Weaver processing class [com.prapansol.demos.technology.ExpertiseAreas].
    [TopLink Finer]: 2007.03.23 01:36:15.602--ServerSession(32012057)--Thread(Thread[main,5,main])--Weaver processing class [com.prapansol.demos.technology.Products].
    [TopLink Finer]: 2007.03.23 01:36:15.604--Thread(Thread[main,5,main])--cmp_init_globalInstrumentation_is_null
    [TopLink Finest]: 2007.03.23 01:36:15.613--ServerSession(32012057)--Thread(Thread[main,5,main])--begin deploying Persistence Unit EJB; state Predeployed; deploymentCount 0
    [TopLink Finest]: 2007.03.23 01:36:15.633--ServerSession(32012057)--Thread(Thread[main,5,main])--property=toplink.logging.level; value=FINEST; translated value=FINEST
    [TopLink Finest]: 2007.03.23 01:36:15.634--ServerSession(32012057)--Thread(Thread[main,5,main])--property=toplink.logging.level; value=FINEST; translated value=FINEST
    [TopLink Info]: 2007.03.23 01:36:15.639--ServerSession(32012057)--Thread(Thread[main,5,main])--TopLink, version: Oracle TopLink Essentials - 2006.8 (Build 060829)
    [TopLink Finest]: 2007.03.23 01:36:15.646--ServerSession(32012057)--Thread(Thread[main,5,main])--end deploying
    Persistence Unit EJB; state Undeployed; deploymentCount 0
    Here is the Stack Trace:
    Exception in thread "main" java.lang.NullPointerException
         at sun.jdbc.odbc.JdbcOdbcDriver.initialize(JdbcOdbcDriver.java:436)
         at sun.jdbc.odbc.JdbcOdbcDriver.connect(JdbcOdbcDriver.java:153)
         at java.sql.DriverManager.getConnection(DriverManager.java:525)
         at java.sql.DriverManager.getConnection(DriverManager.java:140)
         at oracle.toplink.essentials.sessions.DefaultConnector.connect(DefaultConnector.java:85)
         at oracle.toplink.essentials.sessions.DatasourceLogin.connectToDatasource(DatasourceLogin.java:170)
         at oracle.toplink.essentials.internal.sessions.DatabaseSessionImpl.loginAndDetectDatasource(DatabaseSessionImpl.java:537)
         at oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider.login(EntityManagerFactoryProvider.java:180)
         at oracle.toplink.essentials.internal.ejb.cmp3.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:230)
         at oracle.toplink.essentials.internal.ejb.cmp3.base.EntityManagerFactoryImpl.getServerSession(EntityManagerFactoryImpl.java:84)
         at oracle.toplink.essentials.internal.ejb.cmp3.base.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:127)
         at oracle.toplink.essentials.internal.ejb.cmp3.base.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:121)
         at oracle.toplink.essentials.internal.ejb.cmp3.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:76)
         at com.prapansol.demos.Client.<init>(Client.java:29)
         at com.prapansol.demos.Client.main(Client.java:83)
    where am I doing wrong?
    Why does sun.jdbc.odbc.JdbcOdbcDriver.initialize method get called when I'm using Oracle DataBase?
    Am I missing any thing ?
    I'll be thankful if any one help me find my fault?
    Thanking you in Advance,
    Regards,
    Samba

    Check the property names for configuring TopLink's internal connection pool. All of the JDBC property names should be prefixed with toplink.
    Refer to the TopLink JPA extensions guide for more information.
    http://www.oracle.com/technology/products/ias/toplink/jpa/resources/toplink-jpa-extensions.html
    Doug

  • Class not Found Exception while running an EJB

    I have created and published a EJB in Oracle 8i (in a particular
    schema) by running the deployejb tool supplied. The ejb was
    published successfully. On running the client program I get an
    error saying that the mybeans's HomeHelper class cannot be
    found. This error occurs when there is a lookup to the home
    interface of the bean. The exception thrown says Reasons are
    unknown. On checking the objects of type 'JAVA CLASS' I found
    that the homeHelper class object had been created automatically
    be the deploy process. What is the reason for the class not
    found exception and what can I do to correct it. ?
    The code for the beans is as given below :
    Home Interface
    package mituser ;
    import javax.ejb.*;
    import java.rmi.RemoteException;
    public interface MITUserHome extends EJBHome {
    public MITUser create()
    throws CreateException, RemoteException;
    Remote Interface
    package mituser ;
    import javax.ejb.EJBObject;
    import java.rmi.RemoteException;
    public interface MITUser extends EJBObject {
    public int validateUserName (String username)
    throws java.sql.SQLException, RemoteException;
    public int validatePassword (String username, String password)
    throws java.sql.SQLException, RemoteException;
    public String validateSearchAccess (String username, String
    password)
    throws java.sql.SQLException, RemoteException;
    Bean
    package mituserServer ;
    import java.sql.*;
    import java.rmi.RemoteException;
    import javax.ejb.*;
    public class MITUserBean implements SessionBean {
    SessionContext ctx;
    public void ejbCreate() throws CreateException,
    RemoteException {
    public void ejbActivate() {
    public void ejbPassivate() {
    public void ejbRemove() {
    public void setSessionContext(SessionContext ctx) {
    this.ctx = ctx;
    public int validateUserName (String username) throws
    SQLException, RemoteException
    int count = 0 ;
    Connection conn =
    new oracle.jdbc.driver.OracleDriver().defaultConnection ();
    PreparedStatement ps =
    conn.prepareStatement ("select count(username) from
    useraccountinfo where username = ?");
    try {
    ps.setString (1, username);
    ResultSet rset = ps.executeQuery ();
    if (!rset.next ())
    throw new RemoteException ("no registered user with User
    Name " + username);
    count = rset.getShort(1) ;
    return count ;
    } finally {
    ps.close();
    public int validatePassword (String username, String password)
    throws SQLException, RemoteException
    int count = 0 ;
    Connection conn =
    new oracle.jdbc.driver.OracleDriver().defaultConnection ();
    PreparedStatement ps =
    conn.prepareStatement ("select count(username) from
    useraccountinfo where username = ? and password = ?");
    try {
    ps.setString (1, username);
    ps.setString(2, password);
    ResultSet rset = ps.executeQuery ();
    if (!rset.next ())
    throw new RemoteException ("Invalid Password ");
    count = rset.getShort(1) ;
    return count ;
    } finally {
    ps.close();
    public String validateSearchAccess (String username, String
    password) throws SQLException, RemoteException
    String searchaccess = "" ;
    Connection conn =
    new oracle.jdbc.driver.OracleDriver().defaultConnection ();
    PreparedStatement ps =
    conn.prepareStatement ("select searchprofileaccess from
    useraccountinfo where username = ? and password = ?");
    try {
    ps.setString (1, username);
    ps.setString(2, password);
    ResultSet rset = ps.executeQuery ();
    if (!rset.next ())
    throw new RemoteException ("Access Denied for " +
    username );
    searchaccess = rset.getString(1) ;
    return searchaccess ;
    } finally {
    ps.close();
    Client program
    import mituser.MITUser;
    import mituser.MITUserHome;
    import oracle.aurora.jndi.sess_iiop.ServiceCtx;
    import javax.naming.Context;
    import javax.naming.InitialContext;
    import java.util.Hashtable;
    public class Client {
    public static void main (String [] args) throws Exception {
    int count = 0 ;
    String access = "" ;
    if (args.length != 4) {
    System.out.println("usage: Client serviceURL objectName
    user password");
    System.exit(1);
    String serviceURL = args [0];
    String objectName = args [1];
    String user = args [2];
    String password = args [3];
    Hashtable env = new Hashtable();
    env.put(Context.URL_PKG_PREFIXES, "oracle.aurora.jndi");
    env.put(Context.SECURITY_PRINCIPAL, user);
    env.put(Context.SECURITY_CREDENTIALS, password);
    env.put(Context.SECURITY_AUTHENTICATION,
    ServiceCtx.NON_SSL_LOGIN);
    Context ic = new InitialContext(env);
    MITUserHome home = (MITUserHome)ic.lookup (serviceURL +
    objectName);
    MITUser testBean = home.create ();
    count = testBean.validateUserName("MITA");
    if (count > 0 )
    System.out.println ("Valid User");
    else
    System.out.println ("Invalid User");
    count = testBean.validatePassword("MITA", "MITA");
    if (count > 0 )
    System.out.println ("Valid Password");
    else
    System.out.println ("Invalid Password");
    access = testBean.validateSearchAccess("MITA", "MITA");
    if ( access.equalsIgnoreCase("YES") )
    System.out.println ("Search Access Available");
    else
    System.out.println ("Search Access Denied");
    The Descriptor file
    // MIT UserBean EJB deployment descriptor
    SessionBean mituserServer.MITUserBean {
    BeanHomeName = "test/mitUserJDBCBean";
    RemoteInterfaceClassName = mituser.MITUser;
    HomeInterfaceClassName = mituser.MITUserHome;
    AllowedIdentities = {MIT};
    SessionTimeout = 20;
    StateManagementType = STATEFUL_SESSION;
    RunAsMode = CLIENT_IDENTITY;
    TransactionAttribute = TX_REQUIRED;
    Batch File for deploying the ejb
    @echo off
    if (%ORACLE_HOME%)==() goto usage
    if (%ORACLE_SERVICE%)==() goto usage
    if (%JDK_CLASSPATH%)==() goto usage
    @echo on
    set CLASSPATH=.;%ORACLE_HOME%\lib\aurora_client.jar;%ORACLE_HOME%
    \jdbc\lib\classes111.zip;%ORACLE_HOME%\sqlj\lib\translator.zip;%
    ORACLE_HOME%\lib\vbjorb.jar;%ORACLE_HOME%\lib\vbjapp.jar;%
    JDK_CLASSPATH%
    javac -g mituser\MITUser.java
    javac -g mituser\MITUserHome.java
    javac -g mituserServer\MITUserBean.java
    jar cf0 mituser.jar mituser\MITUser.class
    mituser\MITUserHome.class mituserServer\MITUserBean.class
    javac -g Client.java
    call deployejb -republish -temp temp -u mit -p mit -s %
    ORACLE_SERVICE% -descriptor mituser.ejb mituser.jar
    @echo off
    goto done
    :usage
    @echo -------------------------------------------------------
    @echo Following are the requirements to run this script
    @echo set ORACLE_HOME to installed Oracle home
    @echo set ORACLE_SERVICE to the CORBA service name of
    your databae
    @echo for example sess_iiop://localhost:2481:ORCL
    @echo set JDK_CLASSPATH to the full path of your JDK
    classes.zip
    @echo -------------------------------------------------------
    :done
    Batch file for running the cleint program
    @echo off
    if (%ORACLE_HOME%)==() goto usage
    if (%ORACLE_SERVICE%)==() goto usage
    if (%JDK_CLASSPATH%)==() goto usage
    @echo on
    set CLASSPATH=.;%ORACLE_HOME%\lib\aurora_client.jar;%ORACLE_HOME%
    \jdbc\lib\classes111.zip;%ORACLE_HOME%\sqlj\lib\translator.zip;%
    ORACLE_HOME%\lib\vbjorb.jar;%ORACLE_HOME%\lib\vbjapp.jar;%
    JDK_CLASSPATH%;server_generated.jar
    java Client %ORACLE_SERVICE% /test/mitUserJDBCBean mit mit
    @echo off
    goto done
    :usage
    @echo -------------------------------------------------------
    @echo Following are the requirements to run this script
    @echo set ORACLE_HOME to installed Oracle home
    @echo set ORACLE_SERVICE to the CORBA service name of
    your databae
    @echo for example sess_iiop://localhost:2481:ORCL
    @echo set JDK_CLASSPATH to the full path of your JDK
    classes.zip
    @echo -------------------------------------------------------
    :done
    I know this is not strictly to do with JDBC but there appears to
    be no discussion forum for EJB
    Hoping for a response soon as it us very URGENT
    Thanks
    Mita
    null

    I have created and published a EJB in Oracle 8i (in a particular
    schema) by running the deployejb tool supplied. The ejb was
    published successfully. On running the client program I get an
    error saying that the mybeans's HomeHelper class cannot be
    found. This error occurs when there is a lookup to the home
    interface of the bean. The exception thrown says Reasons are
    unknown. On checking the objects of type 'JAVA CLASS' I found
    that the homeHelper class object had been created automatically
    be the deploy process. What is the reason for the class not
    found exception and what can I do to correct it. ?
    The code for the beans is as given below :
    Home Interface
    package mituser ;
    import javax.ejb.*;
    import java.rmi.RemoteException;
    public interface MITUserHome extends EJBHome {
    public MITUser create()
    throws CreateException, RemoteException;
    Remote Interface
    package mituser ;
    import javax.ejb.EJBObject;
    import java.rmi.RemoteException;
    public interface MITUser extends EJBObject {
    public int validateUserName (String username)
    throws java.sql.SQLException, RemoteException;
    public int validatePassword (String username, String password)
    throws java.sql.SQLException, RemoteException;
    public String validateSearchAccess (String username, String
    password)
    throws java.sql.SQLException, RemoteException;
    Bean
    package mituserServer ;
    import java.sql.*;
    import java.rmi.RemoteException;
    import javax.ejb.*;
    public class MITUserBean implements SessionBean {
    SessionContext ctx;
    public void ejbCreate() throws CreateException,
    RemoteException {
    public void ejbActivate() {
    public void ejbPassivate() {
    public void ejbRemove() {
    public void setSessionContext(SessionContext ctx) {
    this.ctx = ctx;
    public int validateUserName (String username) throws
    SQLException, RemoteException
    int count = 0 ;
    Connection conn =
    new oracle.jdbc.driver.OracleDriver().defaultConnection ();
    PreparedStatement ps =
    conn.prepareStatement ("select count(username) from
    useraccountinfo where username = ?");
    try {
    ps.setString (1, username);
    ResultSet rset = ps.executeQuery ();
    if (!rset.next ())
    throw new RemoteException ("no registered user with User
    Name " + username);
    count = rset.getShort(1) ;
    return count ;
    } finally {
    ps.close();
    public int validatePassword (String username, String password)
    throws SQLException, RemoteException
    int count = 0 ;
    Connection conn =
    new oracle.jdbc.driver.OracleDriver().defaultConnection ();
    PreparedStatement ps =
    conn.prepareStatement ("select count(username) from
    useraccountinfo where username = ? and password = ?");
    try {
    ps.setString (1, username);
    ps.setString(2, password);
    ResultSet rset = ps.executeQuery ();
    if (!rset.next ())
    throw new RemoteException ("Invalid Password ");
    count = rset.getShort(1) ;
    return count ;
    } finally {
    ps.close();
    public String validateSearchAccess (String username, String
    password) throws SQLException, RemoteException
    String searchaccess = "" ;
    Connection conn =
    new oracle.jdbc.driver.OracleDriver().defaultConnection ();
    PreparedStatement ps =
    conn.prepareStatement ("select searchprofileaccess from
    useraccountinfo where username = ? and password = ?");
    try {
    ps.setString (1, username);
    ps.setString(2, password);
    ResultSet rset = ps.executeQuery ();
    if (!rset.next ())
    throw new RemoteException ("Access Denied for " +
    username );
    searchaccess = rset.getString(1) ;
    return searchaccess ;
    } finally {
    ps.close();
    Client program
    import mituser.MITUser;
    import mituser.MITUserHome;
    import oracle.aurora.jndi.sess_iiop.ServiceCtx;
    import javax.naming.Context;
    import javax.naming.InitialContext;
    import java.util.Hashtable;
    public class Client {
    public static void main (String [] args) throws Exception {
    int count = 0 ;
    String access = "" ;
    if (args.length != 4) {
    System.out.println("usage: Client serviceURL objectName
    user password");
    System.exit(1);
    String serviceURL = args [0];
    String objectName = args [1];
    String user = args [2];
    String password = args [3];
    Hashtable env = new Hashtable();
    env.put(Context.URL_PKG_PREFIXES, "oracle.aurora.jndi");
    env.put(Context.SECURITY_PRINCIPAL, user);
    env.put(Context.SECURITY_CREDENTIALS, password);
    env.put(Context.SECURITY_AUTHENTICATION,
    ServiceCtx.NON_SSL_LOGIN);
    Context ic = new InitialContext(env);
    MITUserHome home = (MITUserHome)ic.lookup (serviceURL +
    objectName);
    MITUser testBean = home.create ();
    count = testBean.validateUserName("MITA");
    if (count > 0 )
    System.out.println ("Valid User");
    else
    System.out.println ("Invalid User");
    count = testBean.validatePassword("MITA", "MITA");
    if (count > 0 )
    System.out.println ("Valid Password");
    else
    System.out.println ("Invalid Password");
    access = testBean.validateSearchAccess("MITA", "MITA");
    if ( access.equalsIgnoreCase("YES") )
    System.out.println ("Search Access Available");
    else
    System.out.println ("Search Access Denied");
    The Descriptor file
    // MIT UserBean EJB deployment descriptor
    SessionBean mituserServer.MITUserBean {
    BeanHomeName = "test/mitUserJDBCBean";
    RemoteInterfaceClassName = mituser.MITUser;
    HomeInterfaceClassName = mituser.MITUserHome;
    AllowedIdentities = {MIT};
    SessionTimeout = 20;
    StateManagementType = STATEFUL_SESSION;
    RunAsMode = CLIENT_IDENTITY;
    TransactionAttribute = TX_REQUIRED;
    Batch File for deploying the ejb
    @echo off
    if (%ORACLE_HOME%)==() goto usage
    if (%ORACLE_SERVICE%)==() goto usage
    if (%JDK_CLASSPATH%)==() goto usage
    @echo on
    set CLASSPATH=.;%ORACLE_HOME%\lib\aurora_client.jar;%ORACLE_HOME%
    \jdbc\lib\classes111.zip;%ORACLE_HOME%\sqlj\lib\translator.zip;%
    ORACLE_HOME%\lib\vbjorb.jar;%ORACLE_HOME%\lib\vbjapp.jar;%
    JDK_CLASSPATH%
    javac -g mituser\MITUser.java
    javac -g mituser\MITUserHome.java
    javac -g mituserServer\MITUserBean.java
    jar cf0 mituser.jar mituser\MITUser.class
    mituser\MITUserHome.class mituserServer\MITUserBean.class
    javac -g Client.java
    call deployejb -republish -temp temp -u mit -p mit -s %
    ORACLE_SERVICE% -descriptor mituser.ejb mituser.jar
    @echo off
    goto done
    :usage
    @echo -------------------------------------------------------
    @echo Following are the requirements to run this script
    @echo set ORACLE_HOME to installed Oracle home
    @echo set ORACLE_SERVICE to the CORBA service name of
    your databae
    @echo for example sess_iiop://localhost:2481:ORCL
    @echo set JDK_CLASSPATH to the full path of your JDK
    classes.zip
    @echo -------------------------------------------------------
    :done
    Batch file for running the cleint program
    @echo off
    if (%ORACLE_HOME%)==() goto usage
    if (%ORACLE_SERVICE%)==() goto usage
    if (%JDK_CLASSPATH%)==() goto usage
    @echo on
    set CLASSPATH=.;%ORACLE_HOME%\lib\aurora_client.jar;%ORACLE_HOME%
    \jdbc\lib\classes111.zip;%ORACLE_HOME%\sqlj\lib\translator.zip;%
    ORACLE_HOME%\lib\vbjorb.jar;%ORACLE_HOME%\lib\vbjapp.jar;%
    JDK_CLASSPATH%;server_generated.jar
    java Client %ORACLE_SERVICE% /test/mitUserJDBCBean mit mit
    @echo off
    goto done
    :usage
    @echo -------------------------------------------------------
    @echo Following are the requirements to run this script
    @echo set ORACLE_HOME to installed Oracle home
    @echo set ORACLE_SERVICE to the CORBA service name of
    your databae
    @echo for example sess_iiop://localhost:2481:ORCL
    @echo set JDK_CLASSPATH to the full path of your JDK
    classes.zip
    @echo -------------------------------------------------------
    :done
    I know this is not strictly to do with JDBC but there appears to
    be no discussion forum for EJB
    Hoping for a response soon as it us very URGENT
    Thanks
    Mita
    null

  • Multi-lingual Translator component in java?

    hello all,
    I want to make a Multi-lingual Translator component in java
    which can be used to convert any existing web site(developed
    using any technology asp/jsp etc) to any foreign language
    viz german, spanish,italian and other major foreign
    languages.
    Please let me know how do i proceed in java with respect to
    the following?:
    1. It has to be developed as a component in java such that
    it can be included in any existing web site as a control
    which simply gives the users the option of converting
    either the current web page from english to any other
    foreign language or simply the entire web site from
    english to any other foreign language
         How to develop it as a component so that it can be
    independently merged into any existing web site(whether
    asp or jsp) as a control? which technology should i be
    using here EJB's or Applets or any other?
    I personally think it can be a applet because with EJB's
    container/application server is required.
    what do you all suggest?
    2. I don't want to use any free translators that are
    available freely on net these days, because a lot of them
    re-directs to their own translation page and includes
    their own banners and or advertisements etc., which may
    not be feasible with us as we have to include this
    utility on our company's web sites
    3. How much time it should take approximately to develop?
    4. If there's any free tool available however without the
    limitations as mentioned above in point 2, then i am not
    averse to using it please let me know if such a tool is
    available.
    5. Please also let me know if there exists already a multi-
    lingual component in java with source code freely
    available anywhere on net, then please give me the link.
    This will help me save a lot of time in developing it.
    Please let me know the answers to above of my queries and
    u"ll be doing a great deal of help here.
    Thanks in advance
    sd76

    JS supports UTF-8... assuming the browser has the proper fonts.
    // _lang.jsp
    <%@ page language="java" contentType="text/html; charset=UTF-8" %>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <html>
    <head>
         <title>Language Test</title>
         <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    </head>
    <body bgcolor="#ffffff" background="" text="#000000" link="#ff0000" vlink="#800000" alink="#ff00ff">
    <%
    request.setCharacterEncoding("UTF-8");
    String str = "\u7528\u6237\u540d";
    String name = request.getParameter("name");
    // OR instead of setCharacterEncoding...
    //if(name != null) {
    //     name = new String(name.getBytes("ISO8859_1"), "UTF8");
    System.out.println(application.getRealPath("/"));
    System.out.println(application.getRealPath("/src"));
    %>
    req enc: <%= request.getCharacterEncoding() %><br />
    rsp enc: <%= response.getCharacterEncoding() %><br />
    str: <%= str %><br />
    name: <%= name %><br />
    <script language="Javascript">
    alert('<%= name %>'); // should show correctly
    </script>
    <form method="POST" action="_lang.jsp">
    Name: <input type="text" name="name" value="" >
    <input type="submit" name="submit" value="Submit POST" />
    </form>
    <br />
    <form method="GET" action="_lang.jsp">
    Name: <input type="text" name="name" value="" >
    <input type="submit" name="submit" value="Submit GET" />
    </form>
    </body>
    </html>

  • HOW TO: "Hello World" EJB Style

    The following Session EJB quick tutorial requires an IIOP datasource. This EJB should work in Oracle databases
    greater than 8.1.5.
    1. Create a new project for an Enterprise JavaBean.
    2. Name your project "Hello".
    3. Select Enterprise JavaBean from "A project containing a new..."
    4. Click Finish to close the Project wizard.
    The Enterprise JavaBeans wizard opens.
    5. For the EJB type, select Session Bean (Stateless)
    6. For the EJB name, enter "Hello" (no quotes!)
    The resulting interface names are created for you. Don't change them!
    7. Click Finish for the EJB wizard to generate the EJB project for you.
    8. Select Save All from the File menu. Call this workspace "Hello".
    You'll see that the EJB wizard generated the home, remote, and bean logic files for you. Now you'll need to
    add the business logic to the HelloBean.java file.
    9. Double click the HelloBean.java file, then click the Source tab to bring it into view.
    10. Before the last closing brace (}), add this line of code:
    public String hello() { return "Hello World!"; }
    11. Select File | Save All.
    12. In the Navigator, double-click the Hello.java file so that you can add the remote interface.
    13. Click the Source tab to bring Hello.java into view.
    14. Add the following line before the last brace (}):
    public String hello() throws java.rmi.RemoteException;
    15. Select File | Save All.
    16. Add the Oracle8i JVM classes to the Hello project by selecting Project | Project Properties and clicking
    the Libraries tab.
    17. Click Add, then click Oracle 8i JVM, then click OK.
    18. Click OK to dismiss the Project Properties dialog.
    19. Select Project | Make Project to compile the Hello project.
    20. In the Navigator, right-click the Hello folder and select Create EJB/8i Deployment Profile.
    21. In the Deployment Profile Wizard that appears, click the Advanced Button.
    Only the first (Automatically include files added to project) and the last (Redirect messages
    to the Message View) boxes should be selected.
    22. Click Done to close the Advanced dialog.
    23. Click the Connection tab and select an IIOP datasource. If there is none, you'll have to create one.
    All three checkboxes at the top of the page should be selected.
    24. Click Done. You'll be prompted to deploy now or later. Click Yes.
    JDeveloper will use the IIOP datasource you specified to deploy the Hello EJB project.
    Now you need to add the generated files that were created during deployment to the class path so that
    the client can find them.
    25. From the Project menu, select Project Properties, then click Add, then click New.
    26. Click the Elipses to the right of the Class path field, then click Add Jar/Zip.
    27. Navigate to the file called HelloGenerated.jar and double-click it to add it to the path.
    28. Click OK to close the two dialogs and Project Properties.
    After JDeveloper completes the deployment, you need to make a client to call the EJB methods and display the results.
    29. From the File menu, select New, then click on the Snippets tab.
    30. Double-click the EJB Oracle 8i Client icon.
    31. Click the Parameters button in the Snippet dialog.
    32. Enter the IIOP connection information you specified earlier.
    33. Enter the EJB Home and Remote interface names ("HelloHome" and "Hello").
    34. Click OK to close the Parameters button.
    The Client file is added to the project.
    35. In the Navigator, right-click the MyEJBJSClient.java file and select run.
    Check the Message View to see the output of your EJB!
    null

    I got the msg when I try to deployment EJB and I use the 8.1.7. andJdev 3.2. Please advise what is wrong for my IIOP connection. From the listener.log, the connection looks good.
    ======================================
    Compiling the project...done
    Validating the profile...done
    Initializing deployment...done
    Scanning project files...done
    Generating classpath dependencies...done
    Generating archive entries table...done
    *** Archive generation completed ***
    *** Deploying the EJB to 8i JVM ***
    EJB deployment argument list:
    "C:\Program Files\Oracle\JDeveloper 3.2\java1.2\jre\bin\javaw"
    "-DPATH=C:\Program Files\Oracle\JDeveloper 3.2\bin;C:\Program Files\Oracle\JDeveloper 3.2\java1.2\bin"
    -classpath
    "C:\Program Files\Oracle\JDeveloper 3.2\aurora\lib\aurora_client.jar;C:\Program Files\Oracle\JDeveloper 3.2\lib\javax-ssl-1_2.jar;C:\Program Files\Oracle\JDeveloper 3.2\aurora\lib\jasper.zip;C:\Program Files\Oracle\JDeveloper 3.2\aurora\lib\vbjorb.jar;C:\Program Files\Oracle\JDeveloper 3.2\aurora\lib\vbjapp.jar;C:\Program Files\Oracle\JDeveloper 3.2\aurora\lib\vbjtools.jar;C:\Program Files\Oracle\JDeveloper 3.2\aurora\lib\vbj30ssl.jar;C:\Program Files\Oracle\JDeveloper 3.2\aurora\lib\aurora.zip;C:\Program Files\Oracle\JDeveloper 3.2\sqlj\lib\translator.zip;C:\Program Files\Oracle\JDeveloper 3.2\sqlj\lib\runtime.zip;C:\Program Files\Oracle\JDeveloper 3.2\aurora\lib\mts.jar;C:\Program Files\Oracle\JDeveloper 3.2\myclasses;C:\Program Files\Oracle\JDeveloper 3.2\lib\jdev-rt.zip;C:\Program Files\Oracle\JDeveloper 3.2\jdbc\lib\oracle8.1.7\classes12.zip;C:\Program Files\Oracle\JDeveloper 3.2\lib\connectionmanager.zip;C:\Program Files\Oracle\JDeveloper 3.2\lib\javax_ejb.zip;C:\Program Files\Oracle\JDeveloper 3.2\auro
    a\lib\aurora_client.jar;C:\Program Files\Oracle\JDeveloper 3.2\lib\javax-ssl-1_2.jar;C:\Program Files\Oracle\JDeveloper 3.2\aurora\lib\jasper.zip;C:\Program Files\Oracle\JDeveloper 3.2\aurora\lib\vbjorb.jar;C:\Program Files\Oracle\JDeveloper 3.2\aurora\lib\vbjapp.jar;C:\Program Files\Oracle\JDeveloper 3.2\aurora\lib\vbjtools.jar;C:\Program Files\Oracle\JDeveloper 3.2\aurora\lib\vbj30ssl.jar;C:\Program Files\Oracle\JDeveloper 3.2\aurora\lib\aurora.zip;C:\Program Files\Oracle\JDeveloper 3.2\sqlj\lib\translator.zip;C:\Program Files\Oracle\JDeveloper 3.2\sqlj\lib\runtime.zip;C:\Program Files\Oracle\JDeveloper 3.2\aurora\lib\mts.jar;C:\Program Files\Oracle\JDeveloper 3.2\java1.2\jre\lib\rt.jar;C:\Program Files\Oracle\JDeveloper 3.2\lib\xmlparserv2.jar"
    oracle.aurora.ejb.deployment.GenerateEjb
    -u
    scott
    -p
    tiger
    -s
    sess_iiop://localhost:2482:test
    -republish
    -keep
    -temp
    TEMP
    -descriptor
    "C:\Program Files\Oracle\JDeveloper 3.2\myprojects\Demo\EJB\DemoHelloEJB.xml"
    -oracledescriptor
    C:\Program Files\Oracle\JDeveloper 3.2\myprojects\Demo\EJB\DemoHelloEJB_oracle.xml
    -generated
    "C:\Program Files\Oracle\JDeveloper 3.2\myprojects\Demo\EJB\DemoHelloEJBGenerated.jar"
    "C:\Program Files\Oracle\JDeveloper 3.2\myprojects\Demo\EJB\DemoHelloEJBSource.jar"
    Cannot connect to service: sess_iiop://localhost:2482:test
    *** Errors occurred while deploying the EJB to 8i JVM ***
    *** Deployment completed ***
    ============================================

  • Using SQLJ in Session EJB  (WebLogic 6.1) - connection giving ClassCastError

    Hi All
    I have one SQLJ file which i have translated to a .java file and , its contents ( methods) have ben pasted in a Session bean , which is deployed in Weblogic 6.1 App Server .
    Now in Session bean i am using the jndi lookup of my datasource in Weblogic and creating a conection to the database .
    with this connection the normal jdbc methods connects to the databse , but the sqlj method gives a class cast error when i try to allocate the Connection Object to the DefaultContext .
    *********************** CODE SNIP ********************
    new sqlj.runtime.ref.DefaultContext m_dx = new sqlj.runtime.ref.DefaultContext(conn);
    sqlj.runtime.ref.DefaultContext.setDefaultContext(m_dx);
    "conn"is the jndi dsn's
    DataSourse.getConnection ();
    /*In the Method */
    sqlj.runtime.ConnectionContext __sJT_connCtx = sqlj.runtime.ref.DefaultContext.getDefaultContext();
    the bean compiles , and is deployed sucessfully , and after lookup the conn and m_dx objects are created sucessfully , but when the sqlj method runs it gives a class cast exception .
    java.lang.ClassCastException: weblogic.jdbc.rmi.SerialConnection
    Is it that Weblogic will not support SQLJ translated code ?
    Please help me out , Will i be able to use the Good features of SQLJ in my EJB beans to be Deployed in Weblogic 6.1 Application Server .
    Thanks

    Hi Nicolas,
    Have you tried to turn on testOnReserve setting of the coneection pool?
    Regards,
    "Nicolas Devos" <[email protected]> wrote in message
    news:3c5fa916$[email protected]..
    >
    Hi,
    I am using weblogic 6.1 and oracle 8.1.6, and experiences
    problems with connections pools and database crash.
    When the database server crashes during an EJB transactions,
    the connection used by that transaction seems to be lost and
    is never rebuilt when the database server restarts, therefore
    the number of connections within the pool shrinks thoroughly
    if I have several connections used while the database crashes
    or is shutdown for maintenance.
    If this db crash takes time to recover, all connections
    are destroyed and the pool become unusable.
    As soon as all connections have been 'destroyed' I have
    the following exception:
    'connection pool - none available' when trying to get
    a connection.
    When I restart the database server, the pool does not rebuilt
    itself.
    (I am using a test table to test the presence of the database
    with a frequency set to 60s)
    I did the same operation without EJB transactions and the pool
    could rebuilt itself after the database has been restarted.
    I had that problem with weblogic 6.0 already and in the
    release notes of 6.0_sp2, 2 issues are fixed concerning
    the pool fail-over: 044223 and 041793.
    I would like to know if these issues are fixed in 6.1 as well,
    and if they are related to my problem (Their description is
    quite short).
    Thank you
    Nicolas

  • Using rownum in EJB-QL ..Pagination using CMP 2.1

    Hi ,
    Hope this is the right forum .. rather than JDBC .
    My requirement is to implement Pagination using EJB2.1 on weblogic with Oracle DB. This is for an application which is quite old system and is not ready yet to be migrated to EJB3.0. So we are struck with EJB2.1 at the moment.
    We are using EJB-QL to get Search result and now need to add Pagination logic in it. I can find weblogic.ejb.PreparedQuery.setMaxElements() API to specify the upper limit but what am looking for is a lower limit ..somthing like setFirstRow() ..
    Can it be done using CMP Entity Bean 2.1 .. EJBQL or someother way ?
    I have the sql for pagination but am not sucessful in translating it to EJB-QL
    select * from
    select /*+ FIRST_ROWS(n) */ a.*, ROWNUM rnum from
    (your_query_goes_here) a
    where ROWNUM <=:MAX_ROW_TO_FETCH
    where rnum >= :MIN_ROW_TO_FETCH;
    Thanks in advance ! I hope I get a solution soon ..
    Edited to get some answers !!!
    is it possible to use rownum in EJBQL ? I know rownum is specific to Oracle and my application will stay with Oracle. I get this exception
    "EJB QL compilation encountered error: [EJB:013042]The Identifier 'rownum' is neither a cmp-field nor a cmr-field. Re-examine your query."
    Edited by: user11305835 on Oct 12, 2009 10:48 PM

    Beevin
      Both two are not even validated,
      but with the first one as select max(c.id) from customer as c , in this case it is validated but while deploying it is error as , object must be return
      But when i saw  the ejb2.1 specification we can write this type of queries also ?
      Is it problem with was any thing
    Regards
    Somaraju

Maybe you are looking for

  • While create inbound delviery Material number is not showing

    Hi All, I am trying to create inbound delivery with reference to Purchase Order. While using BBP_INB_DELIVERY_CREATE to create inbound deliveries, the material number is not showing up in the VL33N screen but Material Description is coming. As you ha

  • Error logging for servlets in Weblogic 5.1?

    Where are errors that occur in servlets logged in 5.1? I have a servlet           that one of the classes it instantiates during the init() method to load a           native library (.dll). On the console, there is a message saying           "unavail

  • Calendar is missing events?

    Hi, When I tell Siri: "Remind me that I have a doctors appointment tomorrow at 14:00". I look on the calendar and the appointment is not there. What am I doing wrong? It's simple: I say "remind me to x on x date", I look at the calendar and it's not

  • Plzzz help: formsweb.cfg testmode false

    Greetings: I have installed Oracle Developer Suite on a Windows XP SP3 pc. When I run the form, Internet Explorer gives me a message: Internet Explorer encountered a problem and needs to close. I run the OC4J before running the form. And I am sure th

  • VAT summary report of South Korea (RFUMSV45R) in ECC 6.0

    Dear all, is there someone who has some experience on the VAT reporting for Korea. We are doing a roll out in Korea and need some support. My question is about the submission of the electronic file available in RFUMSV45R. After comparing the output f