Can i create an entity bean to part of a table

Hi there,
I am using EJB 2.0.
Can i create an entity bean to part of a table.
Thanks
Edited by: vamseebobby on Nov 5, 2007 11:11 AM

of course,provided the other parts left out have not constraints.
sumelong

Similar Messages

  • [persistence] all work, but can't persist new entity bean

    Hi,
    I have a FacadeBean which is working fine ... I can contact the BD oracle for retrieving my entity beans, update an entity bean etc...
    BUT... I can't create an entity bean :( I don't understand why!!!
    With the same code, I can create, list, etc... on OC4J and JBoss but the create method won't work with WebLogic :|
    Here is the error present in console:
    <09-mars-2007 15 h 03 min 47 s CET> <Error> <EJB> <BEA-010026> <Exception occurr
    ed during commit of transaction Name=[EJB be.starapic.test.ejb.MyEntityFacadeBea
    n.create(be.starapic.test.ejb.MyEntity)],Xid=BEA1-007A82AF3A953057A4BD(30283302)
    ,Status=Rolled back. [Reason=weblogic.transaction.internal.AppSetRollbackOnlyExc
    eption],numRepliesOwedMe=0,numRepliesOwedOthers=0,seconds since begin=1,seconds
    left=30,XAServerResourceInfo[weblogic.jdbc.wrapper.JTSXAResourceImpl]=(ServerRes
    ourceInfo[weblogic.jdbc.wrapper.JTSXAResourceImpl]=(state=rolledback,assigned=Ad
    minServer),xar=weblogic.jdbc.wrapper.JTSXAResourceImpl@110563c,re-Registered = f
    alse),SCInfo[base_domain+AdminServer]=(state=rolledback),properties=({weblogic.t
    ransaction.name=[EJB be.starapic.test.ejb.MyEntityFacadeBean.create(be.starapic.
    test.ejb.MyEntity)], weblogic.jdbc=t3://192.168.100.188:7001}),OwnerTransactionM
    anager=ServerTM[ServerCoordinatorDescriptor=(CoordinatorURL=AdminServer+192.168.
    100.188:7001+base_domain+t3+, XAResources={weblogic.jdbc.wrapper.JTSXAResourceIm
    pl},NonXAResources={})],CoordinatorURL=AdminServer+192.168.100.188:7001+base_dom
    ain+t3+): weblogic.transaction.RollbackException: Unknown reason
    at weblogic.transaction.internal.TransactionImpl.throwRollbackException(
    TransactionImpl.java:1808)
    at weblogic.transaction.internal.ServerTransactionImpl.internalCommit(Se
    rverTransactionImpl.java:333)
    at weblogic.transaction.internal.ServerTransactionImpl.commit(ServerTran
    sactionImpl.java:227)
    at weblogic.ejb.container.internal.BaseRemoteObject.postInvoke1(BaseRemo
    teObject.java:606)
    at weblogic.ejb.container.internal.BaseRemoteObject.postInvokeTxRetry(Ba
    seRemoteObject.java:426)
    at weblogic.ejb.container.internal.StatefulRemoteObject.postInvokeTxRetr
    y(StatefulRemoteObject.java:100)
    at be.starapic.test.ejb.myentityfacade_opn58i_MyEntityFacadeRemoteImpl.c
    reate(myentityfacade_opn58i_MyEntityFacadeRemoteImpl.java:158)
    at be.starapic.test.ejb.myentityfacade_opn58i_MyEntityFacadeRemoteImpl_C
    BV.create(Unknown Source)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
    java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
    sorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at weblogic.ejb.container.internal.RemoteBusinessIntfProxy.invoke(Remote
    BusinessIntfProxy.java:42)
    at $Proxy152.create(Unknown Source)
    at be.starapic.test.web.HelloServlet.doGet(HelloServlet.java:88)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
    at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run
    (StubSecurityHelper.java:226)
    at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecuri
    tyHelper.java:124)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.jav
    a:283)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.jav
    a:175)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationActio
    n.run(WebAppServletContext.java:3334)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(Authenticate
    dSubject.java:321)
    at weblogic.security.service.SecurityManager.runAs(Unknown Source)
    at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppS
    ervletContext.java:2081)
    at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletC
    ontext.java:1987)
    at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.j
    ava:1359)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:200)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:172)
    .>
    <09-mars-2007 15 h 03 min 47 s CET> <Error> <HTTP> <BEA-101020> <[weblogic.servl
    et.internal.WebAppServletContext@144a314 - appName: 'testDeploy', name: '/testDe
    ploy', context-path: '/testDeploy'] Servlet failed with Exception
    javax.ejb.EJBException: nested exception is: weblogic.transaction.internal.AppSe
    tRollbackOnlyException
    at weblogic.ejb.container.internal.RemoteBusinessIntfProxy.invoke(Remote
    BusinessIntfProxy.java:57)
    at $Proxy152.create(Unknown Source)
    at be.starapic.test.web.HelloServlet.doGet(HelloServlet.java:88)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
    Truncated. see log file for complete stacktrace
    That say nothing good...
    at $Proxy152.create(Unknown Source) is the problem I think but why ...?
    Here is the entity bean:
    @Entity
    @Table(name="table_myentity")
    public class MyEntity implements Serializable
    private static final long serialVersionUID = -5806278646729410835L;
    private int id;
    private String name;
    private int number;
    public void setName(String name) {
    this.name = name;
    public String getName() {
    return name;
    public void setNumber(int number) {
    this.number = number;
    @Column(name="mynumber")
    public int getNumber() {
    return number;
    public void setId(int id) {
    this.id = id;
    @Id
    @GeneratedValue(strategy=GenerationType.AUTO)
    public int getId() {
    return id;
    May be a problem of auto-generate for the ID...
    Here is the facade bean:
    @Stateful(name="myentityfacade", mappedName="myentityfacade")
    @Remote(MyEntityFacadeRemote.class)
    @Local(MyEntityFacadeLocal.class)
    public class MyEntityFacadeBean implements MyEntityFacadeRemote, MyEntityFacadeLocal {
    @PersistenceContext
    private EntityManager em;
    public MyEntity create(MyEntity meb) {
    em.persist(meb);
    return meb;
    public void update(MyEntity meb) throws IllegalAccessException {
    if (null == em.find(MyEntity.class, meb.getId())) {
    throw new IllegalAccessException("Attempt to update a non existing entity");
    em.merge(meb);
    public void delete(int id) {
    MyEntity meb = em.find(MyEntity.class, id);
    em.remove(meb);
    public void delete(MyEntity meb) {
    meb = em.merge(meb);
    em.remove(meb);
    public MyEntity findById(int id) {
    return em.find(MyEntity.class, id);
    public List<MyEntity> listAll() {
    return em.createQuery("SELECT o FROM MyEntity AS o").getResultList(); //TOPLINK, HIBERNATE
    public List<MyEntity> listFiltered(String filter) {
    return em.createQuery("SELECT o FROM MyEntity AS o "+filter).getResultList(); //TOPLINK, HIBERNATE
    public int getNbMyEntityBean() {
    return this.listAll().size();
    Sorry for the long post... And finnaly here is the code present in the servlet:
    // CREATE
    MyEntity meb1 = new MyEntity();
    meb1.setName("bbb");
    meb1.setNumber(2);
    meb1 = remoteMyEntityFacade.create(meb1);
    Note that the remoteMyEntityFacade is working, because I can call any other buisness method without crashing the application.. Just the create can't work and so, persistence can't be used :(
    Any suggestions ?

    There is a problem with generated key
    that code won't work:
    @Id
    @GeneratedValue(strategy=GenerationType.AUTO)
    public int getId() {
    return id;
    But, if I remove line "GeneratedValue", it can insert into the BD, once only :s
    The ID is set to 0 by default, so I can't add more than one entity :s

  • Create CMP Entity Beans from Tables Wizard - Can't see any tables with DB2

    Hi,
    I'm trying to use the "Create CMP Entity Beans from Tables Wizard" to create an entity from a table in a DB2 database. The problem is, on page 2, I can't see any available tables. I have verified that the connection works (I can open the connection in the Navigator frame and I can see that table).
    Note that if I try this wizard on an Oracle database, I can see tables.
    WTF? Can someone please help?

    I second the motion. I too work in an environment with centralized data management (DBA's) that create and maintain all tables under a generic schema. This has prevented me from using the Create Entity Beans from Table feature of Jdev r3 preview.
    At least I can see that I'm not alone.
    Thanks
    When I select the "Create CMP Entity Beans from Tables Wizard," no tables or views are available to select. The JDev database connection is using an ID assigned to me.
    The tables that I am looking for were created by the DBA under his ID and are therefore in that schema. He did create Public Synonyms for them, but the tables still do not show up in the wizard.
    Is there a configuration step that I need to do to have those tables show up?
    Tables created by a DBA and then accessed by developers using a public synonym is a very common scenario and should be supported by JDeveloper (IMO).
    Thanks.
    I'm using JDev 9.0.2.8.2.

  • I can not fine the Entity Bean's advantage than Java Bean?

    I can not fine the Entity Bean's advantage than Java Bean,
    can you tell me, thanks a lot?

    I can not fine the Entity Bean's advantage than Java
    Bean,
    can you tell me, thanks a lot?I think you should read more of the EJB Spec. You'll find your answer there. But mainly with entities you can have the container manage all the lifecyle of the Bean (transactions, caching, creation, etc...). But entities are not only to map columns in the database, they are supposed to have business code. See more by reading the spec.
    MSB

  • Can't use an entity bean

    Hi
    I'm new at this, please excuse me if this problem's solution is too obvious. I have no compilation errors, but i'm still receiving errors in the console when i try to access anything from an entity bean.
    The story:
    I'm using Jdeveloper 10.1.3.0.4. I'm using Oc4J, starting it with a .bat file:
    "cd c:\jdeveloper\j2ee\home"
    "java -jar oc4j.jar"
    Database is MySQL 5.0.7. I had to configure Jdeveloper to use mysql-connector-java-3.1.13-bin.jar.
    I created an entity called Tarjeta_Entity, using the "create CMP from tables" wizard. All fields created match the ones in the mysql table. Some error told me to manually "map" some fields. In the toplink-ejb.jar structure view, i used the "automap" function, and now Tarjeta_EntityBean points to MYSCHEMA.tarjeta.
    I added a "New Sample Java Client" for the entity bean. When i run it, i get the following:
    C:\jdeveloper\jdk\bin\javaw.exe -ojvm -classpath C:\jdeveloper\jdev\mywork\SDP\SDP\classes;C:\jdeveloper\j2ee\home\oc4j.jar;C:\jdeveloper\j2ee\home\lib\oc4j-internal.jar;C:\jdeveloper\opmn\lib\optic.jar;C:\jdeveloper\j2ee\home\lib\activation.jar;C:\jdeveloper\j2ee\home\lib\ejb.jar;C:\jdeveloper\j2ee\home\lib\jms.jar;C:\jdeveloper\j2ee\home\lib\jta.jar;C:\jdeveloper\j2ee\home\lib\mail.jar;C:\jdeveloper\j2ee\home\lib\servlet.jar;C:\jdeveloper\lib\xmlparserv2.jar;C:\jdeveloper\lib\xml.jar;C:\jdeveloper\j2ee\home\oc4jclient.jar;C:\jdeveloper\j2ee\home\lib\persistence.jar;C:\jdeveloper\j2ee\home\lib\ejb30.jar;C:\jdeveloper\j2ee\home\lib\asm.jar;C:\jdeveloper\j2ee\home\lib\asm-attrs.jar;C:\jdeveloper\toplink\jlib\toplink.jar;C:\jdeveloper\toplink\jlib\toplink-oc4j.jar;C:\jdeveloper\toplink\jlib\antlr.jar;C:\jdeveloper\j2ee\home\lib\ojsp.jar;C:\jdeveloper\j2ee\home\jsp\lib\taglib\ojsputil.jar;C:\jdeveloper\jdev\lib\ojc.jar;C:\jdeveloper\jdev\system\oracle.j2ee.10.1.3.36.73\embedded-oc4j\.client sdp.Tarjeta_EntityClient
    oracle.oc4j.rmi.OracleRemoteException: java.lang.NullPointerException
         at com.evermind.server.ejb.EJBUtils.getUserException(EJBUtils.java:333)
         at com.evermind.server.ejb.interceptor.system.AbstractTxInterceptor.convertAndHandleMethodException(AbstractTxInterceptor.java:69)
         at com.evermind.server.ejb.interceptor.system.TxRequiredInterceptor.invoke(TxRequiredInterceptor.java:57)
         at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:69)
         at com.evermind.server.ejb.interceptor.system.DMSInterceptor.invoke(DMSInterceptor.java:52)
         at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:69)
         at com.evermind.server.ejb.interceptor.system.RunningStateInterceptor.invoke(RunningStateInterceptor.java:33)
         at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:69)
         at com.evermind.server.ejb.DBEntityEJBHome.OC4J_invokeMethod(DBEntityEJBHome.java:320)
         at Tarjeta_EntityHome_RemoteEntityHomeWrapper10.findAll(Tarjeta_EntityHome_RemoteEntityHomeWrapper10.java:44)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
         at java.lang.reflect.Method.invoke(Unknown Source)
         at com.evermind.server.rmi.RmiMethodCall.run(RmiMethodCall.java:53)
         at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
         at java.lang.Thread.run(Unknown Source)
    at connection to localhost/127.0.0.1
         at com.evermind.server.ejb.EJBUtils.getUserException(EJBUtils.java:333)
         at com.evermind.server.ejb.interceptor.system.AbstractTxInterceptor.convertAndHandleMethodException(AbstractTxInterceptor.java:69)
         at com.evermind.server.ejb.interceptor.system.TxRequiredInterceptor.invoke(TxRequiredInterceptor.java:57)
         at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:69)
         at com.evermind.server.ejb.interceptor.system.DMSInterceptor.invoke(DMSInterceptor.java:52)
         at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:69)
         at com.evermind.server.ejb.interceptor.system.RunningStateInterceptor.invoke(RunningStateInterceptor.java:33)
         at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:69)
         at com.evermind.server.ejb.DBEntityEJBHome.OC4J_invokeMethod(DBEntityEJBHome.java:320)
         at Tarjeta_EntityHome_RemoteEntityHomeWrapper10.findAll(Tarjeta_EntityHome_RemoteEntityHomeWrapper10.java:44)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
         at java.lang.reflect.Method.invoke(Unknown Source)
         at com.evermind.server.rmi.RmiMethodCall.run(RmiMethodCall.java:53)
         at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
         at java.lang.Thread.run(Unknown Source)
         Nested exception is:
    java.lang.NullPointerException
         at oracle.toplink.internal.ejb.cmp.oc4j.Oc4jPersistenceManager.findMultiValuedBean(Oc4jPersistenceManager.java:237)
         at com.evermind.server.ejb.interceptor.joinpoint.ToplinkCollectionFinderJoinPointImpl.invoke(ToplinkCollectionFinderJoinPointImpl.java:20)
         at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:69)
         at com.evermind.server.ejb.interceptor.system.SetContextActionInterceptor.invoke(SetContextActionInterceptor.java:28)
         at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:69)
         at com.evermind.server.ejb.interceptor.system.TxRequiredInterceptor.invoke(TxRequiredInterceptor.java:55)
         at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:69)
         at com.evermind.server.ejb.interceptor.system.DMSInterceptor.invoke(DMSInterceptor.java:52)
         at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:69)
         at com.evermind.server.ejb.interceptor.system.RunningStateInterceptor.invoke(RunningStateInterceptor.java:33)
         at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:69)
         at com.evermind.server.ejb.DBEntityEJBHome.OC4J_invokeMethod(DBEntityEJBHome.java:320)
         at Tarjeta_EntityHome_RemoteEntityHomeWrapper10.findAll(Tarjeta_EntityHome_RemoteEntityHomeWrapper10.java:44)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
         at java.lang.reflect.Method.invoke(Unknown Source)
         at com.evermind.server.rmi.RmiMethodCall.run(RmiMethodCall.java:53)
         at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
         at java.lang.Thread.run(Unknown Source)
    at connection to localhost/127.0.0.1
         at oracle.toplink.internal.ejb.cmp.oc4j.Oc4jPersistenceManager.findMultiValuedBean(Oc4jPersistenceManager.java:237)
         at com.evermind.server.ejb.interceptor.joinpoint.ToplinkCollectionFinderJoinPointImpl.invoke(ToplinkCollectionFinderJoinPointImpl.java:20)
         at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:69)
         at com.evermind.server.ejb.interceptor.system.SetContextActionInterceptor.invoke(SetContextActionInterceptor.java:28)
         at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:69)
         at com.evermind.server.ejb.interceptor.system.TxRequiredInterceptor.invoke(TxRequiredInterceptor.java:55)
         at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:69)
         at com.evermind.server.ejb.interceptor.system.DMSInterceptor.invoke(DMSInterceptor.java:52)
         at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:69)
         at com.evermind.server.ejb.interceptor.system.RunningStateInterceptor.invoke(RunningStateInterceptor.java:33)
         at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:69)
         at com.evermind.server.ejb.DBEntityEJBHome.OC4J_invokeMethod(DBEntityEJBHome.java:320)
         at Tarjeta_EntityHome_RemoteEntityHomeWrapper10.findAll(Tarjeta_EntityHome_RemoteEntityHomeWrapper10.java:44)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
         at java.lang.reflect.Method.invoke(Unknown Source)
         at com.evermind.server.rmi.RmiMethodCall.run(RmiMethodCall.java:53)
         at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
         at java.lang.Thread.run(Unknown Source)
    Process exited with exit code 0.
    I also tried using a session bean to do something similar. getter and setter methods for fields inside the same session bean work fine, but the method that invokes the entity bean, throws me the same load of errors.
    Any suggestions will be appreciated,
    saludos,
    Francisco

    I solved it.
    I don't know what the exact problem was, but it was somehow related to foreign keys from a nub (tarjeta_x_tarjeta, yes, a nub to itself). I probably defined them wrong in toplink.
    I deleted those FKs from the database, created the entity beans and test classes again, and they worked. Hopefully i won't need referential integrity in this project.
    Thanks anyway,
    saludos,
    Francisco.

  • Can anyone describe using entity beans for persitance in Software Architect

    Can anyone describe using entity beans for persitance in Software Architecture you built for a product?

    Although this forum is supposed to help you gain knowledge on entity beans, its not a free rider that's supposed regurgitate everyone's knowledge to you.
    Read something first and then clarify your thoughts with this forum.

  • Can I create a Stored Procedure That access data from tables of another servers?

    I'm developing a procedure and within it I'm trying to access another server and make a select into a table that belongs to this another server. When I compile this procedure I have this error message: " PLS-00904: insufficient privilege to access object BC.CADPAP", where BC.CADPAP is the problematic table.
    How can I use more than one connection into an Oracle Stored Procedure?
    How I can access tables of a server from a Stored Procedure since the moment I'm already connected with another server?
    Can I create a Stored Procedure That access data from tables of another servers?

    You need to have a Database Link between two servers. Then you could do execute that statement without any problem. Try to create a database link with the help of
    CREATE DATABASE LINK command. Refer Document for further details

  • CAN'T LOOKUP SIMPLE ENTITY BEAN : ''JAVAX.NAMING.NAMINGEXCEPTION: LOOKUP ERROR''

    Hello, we were forwarded to this forum from TAR section of Metalink. We are facing a problem with JDev-RC2/OC4J-9.0.3 and seems that we are hitting Bug 2276197. The BUG is marked as internal and therefore we can't see it. So, it's not clear where the problem is, if in JDev or OC4J or both ?
    Testcase Step-by-step:
    1. Invoke JDeveloper 9.0.3.815
    2. Create a workspace & a project.
    3. Create an default Container-managed Entity Beans frim Tables.
    4. Create Sample Java Client with "Connect to OC4J Embedded in Jdeveloper" and run it, it gives above error.
    You can download a testcase that is part of TAR-2125538.995, that we opened on Metalink.
    Please help. Thanks in advance.

    Hi Radim,
    Personally, I have played a little with JDeveloper, but I am not
    actively using it for my development -- I prefer to do most things
    myself. True, the JDeveloper wizards do a lot of the work for you,
    but at least (with my way), when something goes wrong, I have a
    better idea of where to look.
    So I can't help you much on the JDeveloper side, but an app is an
    app regardless of how you develop it, so I'll offer a list of things
    to check (just in case you haven't already done so :-).
    I haven't looked at your test case, but from your description, I
    assume you have a standalone java client. Again, I assume JDeveloper
    handles the details for you (and it may be doing it wrong -- as
    you suggest), but the way you do your JNDI lookup depends on the
    type of client you use. For a standalone java client (that is also
    deployed to OC4J), your "initial context factory" class should be:
    com.evermind.server.ApplicationClientInitialContextFactory
    and your "provider URL" should be:
    ormi://<host>/<app-name>
    where <host> is the name of the computer where OC4J is running
    (you can also use "localhost") and <app-name> is the name given
    to your application at deployment time. Again, JDeveloper handles
    the deployment, but the "app-name" should also appear in the
    "server.xml" configuration file which is usually located in the
    "config" subdirectory of the OC4J home directory.
    The lookup string for your entity bean should be the "logical"
    name, meaning the name of your bean prefixed with "java:comp/env".
    Again, I guess JDeveloper handles the bean name part for you,
    but the bean name appears in the "ejb-jar.xml" file under the
    "ejb-name" element.
    So if you've already checked all of the above, then please excuse
    me for not telling you anything you don't already know.
    Good Luck,
    Avi.

  • How do I create an Entity Bean with unknown primary keys

    Hi,
    Can a good folk help me.
    I am mapping an entity bean to an oracle table for the purpose of logging . I do not need a primary key contraint on this table. How do I specify in my entity bean file descriptor not to use any field for primary key ...
    I have done this so far...
    in my ejb.xml file - I set....
    <prim-key-class>java.lang.Object</prim-key-class>
    and deleted ....
    <primkey-field>...</primkey-field>
    My table structure is .....
    CREATE TABLE FAMS_REQUEST_LOG (
    EDITEDBY VARCHAR2(20),
    OLDTRANSDATE DATE,
    REQUESTID VARCHAR2(30) NOT NULL,
    OLDQTY NUMBER(20),
    NEWQTY NUMBER(20),
    NEWTRANSDATE DATE)
    but I still get this error message on deploying...
    [#|2006-03-01T14:30:29.250+0100|INFO|sun-appserver-pe8.1_02|javax.enterprise.system.tools.deployment|_ThreadID=19;|Total Deployment Time: 11000 msec, Total EJB Compiler Module Time: 0 msec, Portion spent EJB Compiling: 0%|#]
    [#|2006-03-01T14:30:29.265+0100|SEVERE|sun-appserver-pe8.1_02|javax.enterprise.system.tools.deployment|_ThreadID=19;|Exception occured in J2EEC Phase
    com.sun.enterprise.deployment.backend.IASDeploymentException: Fatal Error from EJB Compiler -- JDO74046: JDOCodeGenerator: Caught a MappingConversionException loading or creating mapping model for application 'fixassetenterpriseapp' module 'FixAssetEnterpriseApp-EJBModule': JDO71030: There is no column in table FAMS_REQUEST_LOG which can be used to support the servers implementation of unknown key classes.
    at com.sun.ejb.codegen.CmpCompiler.compile(CmpCompiler.java:274)
    at com.sun.ejb.codegen.IASEJBC.doCompile(IASEJBC.java:615)
    at com.sun.ejb.codegen.IASEJBC.ejbc(IASEJBC.java:563)
    at com.sun.enterprise.deployment.backend.EJBCompiler.preDeployApp(EJBCompiler.java:340)
    at com.sun.enterprise.deployment.backend.EJBCompiler.compile(EJBCompiler.java:209)
    at com.sun.enterprise.deployment.backend.AppDeployer.runEJBC(AppDeployer.java:284)
    at com.sun.enterprise.deployment.backend.AppDeployer.deploy(AppDeployer.java:176)
    at com.sun.enterprise.deployment.backend.AppDeployer.doRequestFinish(AppDeployer.java:107)
    at com.sun.enterprise.deployment.phasing.J2EECPhase.runPhase(J2EECPhase.java:146)
    at com.sun.enterprise.deployment.phasing.DeploymentPhase.executePhase(DeploymentPhase.java:71)
    at com.sun.enterprise.deployment.phasing.PEDeploymentService.executePhases(PEDeploymentService.java:633)
    at com.sun.enterprise.deployment.phasing.PEDeploymentService.deploy(PEDeploymentService.java:188)
    at com.sun.enterprise.deployment.phasing.PEDeploymentService.deploy(PEDeploymentService.java:520)
    at com.sun.enterprise.management.deploy.DeployThread.deploy(DeployThread.java:143)
    at com.sun.enterprise.management.deploy.DeployThread.run(DeployThread.java:172)
    |#]
    Dotun

    you will have to create a sequence and a trigger
    CREATE SEQUENCE <SEQUENCE NAME>
    INCREMENT BY  1
    START WITH  1
    NOCACHE
    /this sequence will guarantee that each requested number is unique
    the trigger will select from this sequence and insert the obtained value in the new record
    CREATE OR REPLACE TRIGGER <TRIGGER NAME>
    BEFORE INSERT ON <TABLE NAME>
    REFERENCING NEW AS NEW OLD AS OLD
    FOR EACH ROW
        BEGIN
            select
                <SEQUENCE NAME>.nextval
            into
                :NEW.<COLUMN NAME>
            from
                dual;
        END;
    [/CODE]
    this will always take the value from the sequence, even if you already provided a value yourself
    (otherwise you will first have to test if :NEW.<column name> is null, but I wouldn't do this for a key column.
    if you need the generated key back for further processing (inserting it into a child table for example), you can use the returning clause on the insert statement
    see the oracle documentation for more information about sequences, triggers and the returning clause
    greetings
    Freek D
    I am new to Oracle and need to know how to create a table that uses an automatic incrementation on a primay key for it's default. I need the uniqueness automatically managed by the DBMS.. This activity is know as setting the Column (primary key with identity) in Ms-SQL..
    Your help would be appreciated greatly....
    Thanks....

  • Can I create a BI Beans compliant cube using OWB?

    Can I create a cube that I can browse using BI beans through OWB 9.0.4 or are there additional steps that I need to take using other tools such as Enterprise manager?
    Are there any known incompatibilities between OWB 9.0.4 and BI beans 9.03.1.?
    I will also pose this question in the BI Beans forum.
    Thanks for any replies.
    Cor

    Hi,
    I am trying to build an Analytic workspace using OWB (9.0.4.8) Transfer Brigde and I got the similar error.
    None of the view/mv sqls are generated and the analytic workspace was not created either.
    FYI.
    **! Transfer logging started at Wed May 14 18:07:41 EDT 2003 !**
    OWB Bridge processed arguments
    Default local= en_US
    Exporting project:OM_SAMPLE
    initializing project:OM_SAMPLE
    Initializing module :WH
    Exporting cube:SALES
    Exporting dimension:CHANNELS
    Exporting dimension:COUNTRIES
    Exporting dimension:CUSTOMERS
    Exporting dimension:PRODUCTS
    Exporting mappings
    Exporting table:CHANNELS
    Exporting table:COUNTRIES
    Exporting table:CUSTOMERS
    Exporting table:PRODUCTS
    Exporting table:SALES
    Exporting datatypes
    Exporting project OM_SAMPLE complete.
    setting parameter: olapimp.deploytoaw = Y
    setting parameter: olapimp.awname = OWBTARDEMO
    setting parameter: olapimp.awobjprefix = OWBTAR_
    setting parameter: olapimp.awuser =
    setting parameter: olapimp.createviews = Y
    setting parameter: olapimp.viewprefix = OWBTAR_
    setting parameter: olapimp.viewaccesstype = OLAP
    setting parameter: olapimp.creatematviews = Y
    setting parameter: olapimp.viewscriptdir = /opt/oracle
    setting parameter: olapimp.deploy = N
    setting parameter: olapimp.username = OLAPSYS
    setting parameter: olapimp.password = manager
    setting parameter: olapimp.host = 10.215.79.139
    setting parameter: olapimp.port = 1521
    setting parameter: olapimp.sid = INDEXDB
    setting parameter: olapimp.inputfilename = C:\TEMP\bridges\null-nullMy_Metadata_Transfer1052950061353.XMI
    setting parameter: olapimp.outputfilename = C:\Panneer\owbtardemo.sql
    Loading Metadata
    Loading XMI input file
    processing dim: CHANNELS
    processing level: CHANNELin dimension CHANNELS
    processing level attribute use: CHL_ID in level CHANNEL for level attribute ID
    processing level attribute : ID in level CHANNEL
    processing level attribute use: CHL_LLABEL in level CHANNEL for level attribute LLABEL
    processing level attribute : LLABEL in level CHANNEL
    processing level attribute use: CHL_SLABEL in level CHANNEL for level attribute SLABEL
    processing level attribute : SLABEL in level CHANNEL
    processing level: CLASSin dimension CHANNELS
    processing level attribute use: CLS_ID in level CLASS for level attribute ID
    processing level attribute : ID in level CLASS
    processing level attribute use: CLS_LLABEL in level CLASS for level attribute LLABEL
    processing level attribute : LLABEL in level CLASS
    processing level attribute use: CLS_SLABEL in level CLASS for level attribute SLABEL
    processing level attribute : SLABEL in level CLASS
    processing hierarchy: CHANNEL_HIERARCHY in dimension CHANNELS
    processing dim: COUNTRIES
    processing level: REGIONin dimension COUNTRIES
    processing level attribute use: RGN_ID in level REGION for level attribute ID
    processing level attribute : ID in level REGION
    processing level attribute use: RGN_LLABEL in level REGION for level attribute LLABEL
    processing level attribute : LLABEL in level REGION
    processing level attribute use: RGN_SLABEL in level REGION for level attribute SLABEL
    processing level attribute : SLABEL in level REGION
    processing level: COUNTRYin dimension COUNTRIES
    processing level attribute use: CTY_ID in level COUNTRY for level attribute ID
    processing level attribute : ID in level COUNTRY
    processing level attribute use: CTY_LLABEL in level COUNTRY for level attribute LLABEL
    processing level attribute : LLABEL in level COUNTRY
    processing level attribute use: CTY_SLABEL in level COUNTRY for level attribute SLABEL
    processing level attribute : SLABEL in level COUNTRY
    processing hierarchy: COUNTRY_HIERARCHY in dimension COUNTRIES
    processing dim: CUSTOMERS
    processing level: CUSTOMERin dimension CUSTOMERS
    processing level attribute use: CTR_CREDIT_LIMIT in level CUSTOMER for level attribute CREDIT_LIMIT
    processing level attribute : CREDIT_LIMIT in level CUSTOMER
    processing level attribute use: CTR_EMAIL in level CUSTOMER for level attribute EMAIL
    processing level attribute : EMAIL in level CUSTOMER
    processing level attribute use: CTR_ID in level CUSTOMER for level attribute ID
    processing level attribute : ID in level CUSTOMER
    processing level attribute use: CTR_NAME in level CUSTOMER for level attribute NAME
    processing level attribute : NAME in level CUSTOMER
    processing dim: PRODUCTS
    processing level: PRODUCTin dimension PRODUCTS
    processing level attribute use: PDT_DESCRIPTION in level PRODUCT for level attribute DESCRIPTION
    processing level attribute : DESCRIPTION in level PRODUCT
    processing level attribute use: PDT_ID in level PRODUCT for level attribute ID
    processing level attribute : ID in level PRODUCT
    processing level attribute use: PDT_LIST_PRICE in level PRODUCT for level attribute LIST_PRICE
    processing level attribute : LIST_PRICE in level PRODUCT
    processing level attribute use: PDT_MIN_PRICE in level PRODUCT for level attribute MIN_PRICE
    processing level attribute : MIN_PRICE in level PRODUCT
    processing level attribute use: PDT_NAME in level PRODUCT for level attribute NAME
    processing level attribute : NAME in level PRODUCT
    processing level: CATEGORYin dimension PRODUCTS
    processing level attribute use: CTY_ID in level CATEGORY for level attribute ID
    processing level attribute : ID in level CATEGORY
    processing level attribute use: CTY_LLABEL in level CATEGORY for level attribute LLABEL
    processing level attribute : LLABEL in level CATEGORY
    processing level attribute use: CTY_SLABEL in level CATEGORY for level attribute SLABEL
    processing level attribute : SLABEL in level CATEGORY
    processing hierarchy: PRODUCT_HIERARCHY in dimension PRODUCTS
    processing cube: SALES
    processing classification type is := Warehouse Builder Business Area
    processing catalog name := SALESCOLLECTION ,and description is := null
    processing catalog entry element name := SALES
    processing Cube
    processing catalog entity cube := SALES
    processing measure := COSTS , in a cube := SALES
    processing measure := SALES , in a cube := SALES
    processing catalog entry element name := CHANNELS
    processing catalog entry element name := COUNTRIES
    processing catalog entry element name := CUSTOMERS
    processing catalog entry element name := PRODUCTS
    processing catalog entry element name := CHANNELS
    Class Name CHANNELS is TableImpl@405ffd not supported
    processing catalog entry element name := COUNTRIES
    Class Name COUNTRIES is TableImpl@5e1b8a not supported
    processing catalog entry element name := CUSTOMERS
    Class Name CUSTOMERS is TableImpl@6232b5 not supported
    processing catalog entry element name := PRODUCTS
    Class Name PRODUCTS is TableImpl@6f144c not supported
    processing catalog entry element name := SALES
    Class Name SALES is TableImpl@14013 not supported
    processing classification type is := Dimensional Attribute Descriptor
    Classification type Dimensional Attribute Descriptor is not supported
    closing output file
    closing log stream
    **! Transfer process 2 of 2 completed with status = 0 !**
    **! Transfer logging stopped at Wed May 14 18:07:47 EDT 2003 !**
    But when I ran the "select * from dba_registry" everything seems to be valid.
    CATALOG     Oracle9i Catalog Views     9.2.0.2.0     VALID     24-APR-2003 09:39:24     SYS     SYS     DBMS_REGISTRY_SYS.VALIDATE_CATALOG
    CATPROC     Oracle9i Packages and Types     9.2.0.2.0     VALID     24-APR-2003 09:39:24     SYS     SYS     DBMS_REGISTRY_SYS.VALIDATE_CATPROC
    OWM     Oracle Workspace Manager     9.2.0.1.0     VALID     24-APR-2003 09:39:27     SYS     WMSYS     OWM_VALIDATE
    JAVAVM     JServer JAVA Virtual Machine     9.2.0.2.0     VALID     23-APR-2003 22:19:09     SYS     SYS     [NULL]
    XML     Oracle XDK for Java     9.2.0.2.0     VALID     24-APR-2003 09:39:32     SYS     SYS     XMLVALIDATE
    CATJAVA     Oracle9i Java Packages     9.2.0.2.0     VALID     24-APR-2003 09:39:32     SYS     SYS     DBMS_REGISTRY_SYS.VALIDATE_CATJAVA
    ORDIM     Oracle interMedia     9.2.0.2.0     LOADED     23-APR-2003 23:16:42     SYS     SYS     [NULL]
    SDO     Spatial     9.2.0.2.0     LOADED     23-APR-2003 23:17:06     SYS     MDSYS     [NULL]
    CONTEXT     Oracle Text     9.2.0.2.0     VALID     23-APR-2003 23:17:26     SYS     SYS     [NULL]
    XDB     Oracle XML Database     9.2.0.2.0     VALID     24-APR-2003 09:39:39     SYS     XDB     DBMS_REGXDB.VALIDATEXDB
    WK     Oracle Ultra Search     9.2.0.2.0     VALID     24-APR-2003 09:39:42     SYS     WKSYS     WK_UTIL.VALID
    OLS     Oracle Label Security     9.2.0.2.0     VALID     24-APR-2003 09:39:43     SYS     LBACSYS     LBAC_UTL.VALIDATE
    ODM     Oracle Data Mining     9.2.0.1.0     LOADED     12-MAY-2002 17:59:03     SYS     ODM     [NULL]
    APS     OLAP Analytic Workspace     9.2.0.2.0     LOADED     23-APR-2003 22:49:51     SYS     SYS     [NULL]
    XOQ     Oracle OLAP API     9.2.0.2.0     LOADED     23-APR-2003 22:51:49     SYS     SYS     [NULL]
    AMD     OLAP Catalog     9.2.0.2.0     VALID     02-MAY-2003 15:00:13     SYS     OLAPSYS     CWM2_OLAP_INSTALLER.VALIDATE_CWM2_INSTALL
    Your help is appreciated!
    Thanks
    Panneer

  • Recurring CacheFullException when creating new Entity Bean

    Normally I can create new instances of my Entity Bean just fine. However, at some point (whether it's after a rollback or not, I don't yet know), I get a CacheFullException when trying to create a new Entity Bean.
    The CacheFullException exception shows a size that increments by one each time this error occurs. The reported size in the exception continually increases way past the max-beans-in-cache amount of 1000. Yet, the Administrator console reports the "Cached beans current count" as zero. So, the cache appears empty, yet every attempt to create a new entity bean fails with a CacheFullException!
    I am using Weblogic Server 8.1 SP3, database concurrency strategy, BMP, and Oracle 9i. The Entity Bean's primary key class was generated by EJBGen (primary key is a java long).
    Stopping and restarting the Weblogic server fixes the problem temporarily.
    Any help would be greatly appreciated.
    Jim

    Yes, but if objects are equal they should have same
    hashCode. If it is not happening, you have a problem.Yes, and equal objects do have the same hash code. Please see below for primary key class implementation as generated by EJBGen 2.16.
    There can be a bug in reporting number of beans.OK, are you saying there is a bug that sometimes shows 0 beans in the cache when the cache is actually full? And even if the cache were full, all the beans would have to be involved in transactions for there not to be room for one more new bean in the cache. And I know that there are no other transactions going on, because this is an isolated system that only I am using. Again, Weblogic Server 8.1 SP3.
    It is possible if your PKs don't implement
    equals/hashCode correctly.They look correct to me. Here is the primary key class implementation as generated by EJBGen 2.16. The primary key is a java long, and I am using CMP (not BMP as I mistakenly reported earlier).
    public class StatusPK implements Serializable {
    public long statusID;
    public StatusPK() {}
    public StatusPK(long statusID) {
    this.statusID = statusID;
    private int m_hashCode = 0;
    public int hashCode() {
    if(0==m_hashCode) {
    m_hashCode = ((int) statusID);
    return m_hashCode;
    public boolean equals(Object other) {
    if(other==this) return true;
    if(null==other) return false;
    if(other.hashCode() != hashCode()) return false;
    try {
    StatusPK other2 = (StatusPK) other;
    return (this.statusID==other2.statusID)
    catch(ClassCastException ex) {
    return false;
    The only problem I see with this class is if the default constructor (no args) would be called, then the primary key and hashCode would always be zero. However, I'm assuming here that EJBGen knows what it is doing and that the default constructor is never actually used. In addition, I know that all of the beans in the database have valid primary keys, and they were created the same way that eventually continually fails later on.
    Thanks...
    jereitz

  • How to create dynamic entity beans at runtime (experts welcome)

    Hi,
    i have a question that i have been trying to figure out however i am still in search of an appropriate solution and thus ask you experts for guidance...
    I am developing a system to house data using ejbs.. however a have a problem i am trying to make the system very dynamic and some of the data that i am trying to store is dynamic in its nature..
    let me explain: i am searching for a solution that would allow a entity ejb to have a dynamic set of properties
    e.g.
    DataEntity could have one or many attributes but those attributes may be string, string, int, int
    or could be int, int, int
    or long, long
    or double..... or any configuration
    this DataEntity would linked to a TypeEntity that would act as a reference to know how to store and retrieve data..
    I have just come across JMX and dynamic Mbeans, and at first glance this seemed like it may be able to help but after further research i think this handles a different problem than i am facing.. (however might be wrong?)
    At the moment i am using toplink as the OR mapping but have also jsut started looking into hibernate..
    So far all i have come up with is to have a FieldEntity as a mappedsuperclass and have sub classes such as IntFieldEntity, LongFieldEntity.... which simple contain one field i.e int value, or long value..
    . and have DataEntity have a one to many relationship with the field superclass..
    the problem with this is how this gets mapped
    my ideal solution would be to have a dynamic DataEntity which could be generated at runtime and have all the required attributes for the particular type..
    so DataEntity would be a mappedsuperclass and then at runtime new types of DataEntity's could get spawned, database table created and OR mapping created linking?
    e.g.
    DataEnity1
    String attribute1;
    String attribute2;
    int attribute3;
    DataEnity2
    int attribute1;
    int attribute2;
    long attribute3;
    Has anyone ever created a structure like this or seen anything like this before?
    any advice would be appreciated
    regards,
    fg

    You cant add controls to the visual tree a runtime which persist beyond the lifetime of the application.  You will have to persist an indicator to your program which tells it to add the control.  Adding a control is as simple as initializing
    it and adding it to a parent already on the tree.  Controls can be created programmatically or using the XamlReader.Load static method.  You can find XamReader.Load in Windows.UI.Xaml.Markup in windows 8.1, Windows 8.1/Windows Phone unified
    projects.  For old windows phone ad just Silverlight I believe it is in System.Windows.Markup.
    Hope this helps.

  • Can I deploy the entity bean in different jar files?

    I have an application EAR, which contains several JARs. I have an entity bean A that has relationships with 2 other different entity beans B and C in the same DB. Now, I have to deploy this entity A together with B in AB.jar, and A with C in AC.jar. Both AB.jar and AC.jar are modules of the same application EAR file. They all use the same data sources to the same database, and named by different <ejb-name>.
    I have no problem with deploying the app to WebLogic 8.1. But the JSP page accessing entity A got errors. Sometime, it got error complaining that the container-generated ejbFindAccount mehtod is abstract.
    My questions are,
    Can an entity bean be defined twice in 2 different jars?
    When container load AB.jar and AC.jar, does it generate the finder methods twice?
    I guess there are some name conflicts going on here. What should I do to avoid it?
    Any comments are very much appreciated.

    Thanks for your answer, but how can I use it in connection with relationships?
    <!-- ********************************************************************** -->
    <!-- Relationship: View to FrameworkUser                                             -->
    <!-- ********************************************************************** -->
    <ejb-relation id="View-FrameworkUser">
         <description></description>
         <ejb-relation-name>View-FrameworkUser</ejb-relation-name>
         <ejb-relationship-role>
              <ejb-relationship-role-name>Views-have-FrameworkUser</ejb-relationship-role-name>
              <multiplicity>Many</multiplicity>
              <relationship-role-source>
                   <ejb-name>View</ejb-name>
              </relationship-role-source>
              <cmr-field>
                   <cmr-field-name>frameworkUser</cmr-field-name><!-#- getter/setter -#->
                   <cmr-field-type>java.util.Collection</cmr-field-type>
              </cmr-field>
         </ejb-relationship-role>
         <!-#- *************** -#->
         <ejb-relationship-role>
              <ejb-relationship-role-name>FrameworkUser-has-Views</ejb-relationship-role-name>
              <multiplicity>One</multiplicity>
              <relationship-role-source>
                   <!-#- *******REFERENCE******** -#->
                   <ejb-name>ejb_foo_jar2_ejb.jar#FrameworkUser</ejb-name>
                   <!-#- *******REFERENCE******** -#->
              </relationship-role-source>
         </ejb-relationship-role>
    </ejb-relation>
    ...this obviously doesn't work...
    Do I have to write a new <entity> where I define the referenced entity?

  • Problem in creating CMP Entity Bean - Pls Help

    I am trying to build one simple project having jsps to get connected to CMP Entity Bean.
    But while deploying I am getting the following error...
    Nov 15, 2004 10:59:09... Info: End of log messages of the target system.
    Nov 15, 2004 10:59:09... Info: ***** End of SAP J2EE Engine Deployment (J2EE Application) *****
    Nov 15, 2004 10:59:09... Error: Execution of deployment action for "EntityCMPAppln" aborted:
    Caught exception during application deployment from SAP J2EE Engine's deploy service:
    java.rmi.RemoteException: Error occurred while starting application bcone.com/EntityCMPAppln and wait.
    Reason: Complex error : server ID 6155350:Application bcone.com/EntityCMPAppln cannot be started, because it has hard reference to resource CONFIG_DB with type javax.sql.DataSource, but it is not active on the server.
    (message ID: com.sap.sdm.serverext.servertype.inqmy.extern.EngineApplOnlineDeployerImpl.performAction(DeploymentActionTypes).REMEXC)
    Nov 15, 2004 10:59:09... Error: Deployment NOT successful for EntityCMPAppln
    Nov 15, 2004 10:59:09... Info: SDM configuration: Do not automatically start/stop J2EE Engine. Do not restore state of J2EE Engine now.
    Nov 15, 2004 10:59:09... Error: -
    At least one of the Deployments failed -
    Nov 15, 2004 11:05:16... Info: Request for Logon as admin accepted
    ===========================================
    Nov 15, 2004 11:05:08... Info: =   Starting to execute command 'remotegui'   =
    Nov 15, 2004 11:05:08... Info: ===============================================
    Nov 15, 2004 11:05:10... Info: SDM started successfully.
    Please tell me how to activate the CONFIG_DB reference in database. Or what Extra I have to do to run this example.
    Regards,
    Vivek Ojha

    Dear Benny,
    The code of the required files is pasted below....
    Application.XML
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE application PUBLIC "-//Sun Microsystems, Inc.//DTD J2EE Application 1.3//EN"
                                 "http://java.sun.com/dtd/application_1_3.dtd">
    <application>
        <display-name>EntityCMPAppln</display-name>
        <description>EAR description</description>
        <module>
            <ejb>EntityCMPEjb.jar</ejb>
        </module>
        <module>
            <web>
                <web-uri>EntityCMPWeb.war</web-uri>
                <context-root>/student</context-root>
            </web>
        </module>
    </application>
    Application-j2ee-engine.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE application-j2ee-engine SYSTEM "application-j2ee-engine.dtd">
    <application-j2ee-engine>
         <provider-name>bcone.com</provider-name>
         <fail-over-enable
              mode="disable"/>
    </application-j2ee-engine>
    data-source-aliases.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE data-source-aliases SYSTEM "data-source-aliases.dtd">
    <data-source-aliases>
         <aliases>
              <data-source-name>${com.sap.datasource.default}</data-source-name>
              <alias>STUDENTDB</alias>
         </aliases>
    </data-source-aliases>
    ejb-j2ee-engine.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE ejb-j2ee-engine SYSTEM "ejb-j2ee-engine.dtd">
    <ejb-j2ee-engine>
         <enterprise-beans>
              <enterprise-bean>
                   <ejb-name>StudentBean</ejb-name>
                   <resource-ref>
                        <res-ref-name>jdbc/STUDENTDB</res-ref-name>
                        <res-link>STUDENTDB</res-link>
                   </resource-ref>
                   <entity-props/>
              </enterprise-bean>
         </enterprise-beans>
    </ejb-j2ee-engine>
    ejb-jar.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
    <ejb-jar>
         <description>EJB JAR description</description>
         <display-name>EJB JAR</display-name>
         <enterprise-beans>
              <entity>
                   <ejb-name>StudentBean</ejb-name>
                   <home>com.bcone.ejb.StudentHome</home>
                   <remote>com.bcone.ejb.Student</remote>
                   <ejb-class>com.bcone.ejb.StudentBean</ejb-class>
                   <persistence-type>Container</persistence-type>
                   <prim-key-class>java.lang.String</prim-key-class>
                   <reentrant>False</reentrant>
                   <cmp-version>2.x</cmp-version>
                   <abstract-schema-name>StudentBean</abstract-schema-name>
                   <cmp-field>
                        <field-name>studentId</field-name>
                   </cmp-field>
                   <cmp-field>
                        <field-name>lname</field-name>
                   </cmp-field>
                   <cmp-field>
                        <field-name>standard</field-name>
                   </cmp-field>
                   <cmp-field>
                        <field-name>fyear</field-name>
                   </cmp-field>
                   <cmp-field>
                        <field-name>fname</field-name>
                   </cmp-field>
                   <primkey-field>studentId</primkey-field>
                   <resource-ref>
                        <res-ref-name>jdbc/STUDENTDB</res-ref-name>
                        <res-type>javax.sql.DataSource</res-type>
                        <res-auth>Container</res-auth>
                   </resource-ref>
              </entity>
         </enterprise-beans>
    </ejb-jar>
    persistent.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE persistent-ejb-map SYSTEM "persistent.dtd">
    <persistent-ejb-map>
         <locking
              type="Table"/>
         <db-properties>
              <data-source-name>CONFIG_DB</data-source-name>
              <database-vendor
                   name="SAPDB"/>
         </db-properties>
         <entity-beans>
              <entity-bean>
                   <ejb-name>StudentBean</ejb-name>
                   <table-name>TMP_STUDENTNEW</table-name>
                   <field-map
                        key-type="PrimaryKey">
                        <field-name>studentId</field-name>
                        <column>
                             <column-name>STUDENTID</column-name>
                        </column>
                   </field-map>
                   <field-map
                        key-type="NoKey">
                        <field-name>lname</field-name>
                        <column>
                             <column-name>LNAME</column-name>
                        </column>
                   </field-map>
                   <field-map
                        key-type="NoKey">
                        <field-name>standard</field-name>
                        <column>
                             <column-name>STANDARD</column-name>
                        </column>
                   </field-map>
                   <field-map
                        key-type="NoKey">
                        <field-name>fyear</field-name>
                        <column>
                             <column-name>FYEAR</column-name>
                        </column>
                   </field-map>
                   <field-map
                        key-type="NoKey">
                        <field-name>fname</field-name>
                        <column>
                             <column-name>FNAME</column-name>
                        </column>
                   </field-map>
              </entity-bean>
         </entity-beans>
         <relationships/>
    </persistent-ejb-map>
    StudentBean.java
    package com.bcone.ejb;
    import javax.ejb.EntityBean;
    import javax.ejb.EntityContext;
    import javax.ejb.RemoveException;
    import javax.ejb.CreateException;
    @abstractSchemaName StudentBean
    @cmpVersion 2.x
    @ejbHome <{com.bcone.ejb.StudentHome}>
    @ejbPrimaryKey <{java.lang.String}>
    @ejbRemote <{com.bcone.ejb.Student}>
    @hasSimplePK true
    public abstract class StudentBean implements EntityBean {
         public void ejbLoad() {
         public void ejbStore() {
         public void ejbRemove() throws RemoveException {
         public void ejbActivate() {
         public void ejbPassivate() {
         public void setEntityContext(EntityContext context) {
              myContext = context;
         public void unsetEntityContext() {
              myContext = null;
         private EntityContext myContext;
    @primKeyField
         public abstract String getStudentId();
         public abstract void setStudentId(String studentId);
         public abstract String getLname();
         public abstract void setLname(String lname);
         public abstract String getFname();
         public abstract void setFname(String fname);
         public abstract String getStandard();
         public abstract void setStandard(String standard);
         public abstract String getFyear();
         public abstract void setFyear(String fyear);
    Create Method.
         public String ejbCreate(
              String studentId,
              String fname,
              String lname,
              String standard,
              String fyear)
              throws CreateException {
              setStudentId(studentId);
              setFname(fname);
              setLname(lname);
              setStandard(standard);
              setFyear(fyear);
              return null;
    Post Create Method.
         public void ejbPostCreate(
              String studentId,
              String fname,
              String lname,
              String standard,
              String fyear) {
              // TODO : Implement
    StudentData.java
    Created on Nov 14, 2004
    To change the template for this generated file go to
    Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
    package com.bcone.data;
    @author Administrator
    To change the template for this generated type comment go to
    Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
    public class StudentData {
         private String studentId;
         private String fname;
         private String lname;
         private String standard;
         private String fyear;
    @return
         public String getFname() {
              return fname;
    @return
         public String getFyear() {
              return fyear;
    @return
         public String getLname() {
              return lname;
    @return
         public String getStandard() {
              return standard;
    @return
         public String getStudentId() {
              return studentId;
    @param string
         public void setFname(String string) {
              fname = string;
    @param string
         public void setFyear(String string) {
              fyear = string;
    @param string
         public void setLname(String string) {
              lname = string;
    @param string
         public void setStandard(String string) {
              standard = string;
    @param string
         public void setStudentId(String string) {
              studentId = string;
    student.jsp
    <%@ page language="java" %>
    <html>
         <head>
              <title>
                   Title
              </title>
         </head>
         <body>
              <form method="POST" action="WEBBOT-SELF" name="Student" onSubmit="">
      <!--webbot bot="SaveResults" startspan U-File="_private/form_results.txt"
      S-Format="TEXT/CSV" S-Label-Fields="TRUE" ><input TYPE="hidden" NAME="VTI-GROUP" VALUE="0"><!webbot
      bot="SaveResults" endspan -->
      <br>
      <a href="/student/manageStudent.jsp?action=add" method="post"> Create </a>   
      <a href="/student/manageStudent.jsp?action=modify" method="post"> Modify </a>   
      <a href="/student/manageStudent.jsp?action=delete" method="post"> Delete </a>
      <br><br>
      <table border="1" width="32%">
        <tr>
          <td width="39%">Student ID </td>
          <td width="61%"><input type="text" name="studentId" size="20"></td>
        </tr>
        <tr>
          <td width="39%">First Name</td>
          <td width="61%"><input type="text" name="fname" size="20"></td>
        </tr>
        <tr>
          <td width="39%">Last Name</td>
          <td width="61%"><input type="text" name="lname" size="20"></td>
        </tr>
        <tr>
          <td width="39%">Standard</td>
          <td width="61%"><input type="text" name="standard" size="20"></td>
        </tr>
        <tr>
          <td width="39%">Fiscal Year</td>
          <td width="61%"><input type="text" name="fyear" size="20"></td>
        </tr>
        <tr>
          <td width="39%" align="center"><input type="submit" value="Submit" name="submit"></td>
          <td width="61%" align="center"><input type="reset" value="Reset" name="reset"></td>
        </tr>
      </table>
    </form>
         </body>
    </html>
    mamageStudent.jsp
    <%@ page language="java"
    import="javax.naming.,java.sql.,javax.sql,com.bcone.ejb."
    %>
    <html>
         <head>
              <title>
                   Manage Student
              </title>
         </head>
         <body>
              <h1>
              </h1>
    <jsp:useBean id="stu" class="com.bcone.data.StudentData" ></jsp:useBean>
    <jsp:setProperty name="stu" property="*" />
    <%
    try {
         InitialContext ctx = new InitialContext();
         StudentHome home = (StudentHome) ctx.lookup("java:comp/env/StudentBean");
         String str = request.getParameter("action");
         if("action".equals(str)) {
              Student rem = home.create(remote.setFname(stu.getStudentId(),stu.getFname(),stu.getLname(),stu.getStandard(),stu.getFyear());
              out.println(stu.getStudentId() + "Student Created");
         } else if ("modify".equals(str)) {
              Student remote  = home.findByPrimaryKey(stu.getStudentId());
              remote.setFname(stu.getFname());
              remote.setFname(stu.getLname());
              remote.setFname(stu.getStandard());
              remote.setFname(stu.getFyear());
              out.println(stu.getStudentId() + "Student modified");
         } else if ("delete".equals(str)) {
              Student stu1  = home.findByPrimaryKey(stu.getStudentId());
              stu1.remove();
              out.println(stu.getStudentId() + "Student deleted");
    } catch (Exception e) {
         out.println("Exception e"+e.toString());
    %>
         </body>
    </html>
    Regards,
    Vivek Ojha

  • Can't get BMP Entity Bean Instance!!

    Hello
    I have created a BMP Entity bean, and put on the findPrimaryKey method this code:
    try {
    context = new InitialContext();
    DataSource ds = (DataSource) context.lookup(nombreConexion);
    conn = ds.getConnection();
    stmt = conn.createStatement();
    rs = stmt.executeQuery("select count(upc) from musiccdejb where upc='"+ primaryKey +"'");
    if (rs!=null && rs.next()) {    
    countNumber = rs.getInt(1);
    if (countNumber!=1) {
    throw new Exception();
    catch (SQLException e) {
    System.out.println("Error ejbFindPrimaryKey"+e);
    catch (Exception e1) {
    System.out.println("Otro error ejbFindPrimaryKey"+e1);
    Everything there seem to be ok, because the select return 1, so the primary key exist, but after that the container doesn't get the information for this entity bean, everything is null when I tried to acces the information.
    Context ctx = new InitialContext();
    MusicCDBMPHome musicCDHome = (MusicCDBMPHome)ctx.lookup("java:comp/env/ejb/MusicCDBMP");
    boolean found = false;
    try {
    musicCDObj = musicCDHome.findByPrimaryKey("1");
    found = true;
    } catch (Exception e) {
    found = false;
    if (found) {
    out.println(musicCDObj.getUpc());
    out.println(musicCDObj.getTitle());
    Please help me, I am working with JDeveloper 9i Release 2 and OC4J Standalone version 9.0.2.
    Ana Maria

    Yes, I alredy did that, and this is te content of my ejbLoad:
    String upc = (String)entityContext.getPrimaryKey();
    ResultSet rs = null;
    try {
    context = new InitialContext();
    DataSource ds = (DataSource) context.lookup(nombreConexion);
    conn = ds.getConnection();
    stmt = conn.createStatement();
    rs = stmt.executeQuery("select count(upc) from musiccdejb where upc='"+ upc +"'");
    if (rs!=null && rs.next()) {
    if (rs.getInt(1)!=1) {
    throw new Exception();
    catch (SQLException e) {
    System.out.println("Error ejbLoad"+e);
    catch (Exception e1) {
    System.out.println("Otro error ejbLoad"+e1);
    Another suggestion??
    Thanks
    Ana Maria

Maybe you are looking for

  • Changing titles on pages assigned to templates

    The title field on pages assigned to templates is grayed out in the code.  I have searched help and it says the field is editable on the page after the template is assigned.  Not happening.  Help said these could be changed from Modify>Page Propertie

  • Dinamic change language at RCF Communication Channel

    Hi people! Do you have already found any problem with language in integration scenarios? We have many interfaces used by multi-language legacy applications... when an error is returned from abap programs (standard or not), the error message is always

  • BEx Analyzer 7.0 Problem

    Hi All, I am using BEx Analyzer 7.0 in a new laptop assigned to me by my customer. It has windows xp and office 2003. My SAP GUI is 710 version with patch level 11 and BI Add-on 800. The problem what i face is, after opening Analyzer, when i am click

  • Error while partitioning

    while partitioning, after clicking install i am getting the message..."The installer disc could not be found." when i ve already put in the dvd with windows 7 in it...

  • Canon 1dsM3 sRAW / RAW white balance differences.

    I am glad that Lightroom 2 is one of the few photo manipulation products that supports the Canon 1ds mark III sRaw format. Curiously when an identical photo taken in RAW and again in sRaw, Lightroom displays them strikingly differently. The 1dsm3 has