EJB 3.0 Entity Bean Inheritance Table Mapping

What I want to do (I think)...
In a distilled example form...
- class A defines field x
- class B defines field y, extends A, inheriting field x
- class C defines field z, extends A, inheriting field x
- I want class B to map to tbl_b which has columns x, y
- I want class C to map to tbl_c which has columns x, z
What I **don't** want to do (I think)...
- make a base table for class A that is joined to tbl_b and tbl_c
- map class B and class C to a single table that has a discriminator column
Questions...
1) Is there a conceptual problem with what I want to do?
2) Is there a way to do what I want to do? I've tried via annotations. Maybe via the XML mapping alternative to annotations?

Thanks for the reply Simon.
Just to re-word what I want to do... I want to use a single table **for each lineage** in the hierarchy. In my original example that would be two tables.
Table per class is what I tried but couldn't get to work - at least using annotations. I want to map some columns in the single table to base fields and some to derived fields.
It seems that only 'single table with discriminator', or the 'join table' methods are sanctioned ways to handle an inheritance hierarchy.
I didn't yet try using the XML method. I might be able to use the single table method by mapping base class properties as if they were derived class properties. This approach would work with a native Hibernate mapping XML.
Back to the conceptual question. Is there a reason why I shouldn't do what I want here?
What I'm trying to avoid...
1) joining tables for performance issues
2) having one table with columns that only make sense for certain records - ugly and potentially database storage waste.

Similar Messages

  • EJB 3.0 Entity Bean

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

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

  • Deployment descriptor error for an EJB 3.0 entity bean module

    Hi all,
    i'm facing an error deploying an EJB 3.0 entity bean module wrapped in an enterprise application on WebLogic 10.
    The application is composed as follows:
    WASEnterprise.ear
    |-META-INF
    |-application.xml
    |-WAS.jar
    |-META-INF
    |-persistence.xml
    In other words the application server is unable to load persistence.xml deployment descriptor and,during deployment, it throws an error message like this:
    <Error> <J2EE> <BEA-160197> <Unable to load descriptor C:\bea\user_projects\domains\base_domain\autodeploy\WASEnterprise\WAS/META-INF/persistence.xml of module WAS. The error is weblogic.descriptor.DescriptorException: Unmarshaller failed
    I suppose that the persistence.xml is correct since i can deploy the application on jboss without any problem.
    The persistence.xml deployment descriptor is:
    <?xml version="1.0" encoding="UTF-8"?>
    <persistence>
    <persistence-unit name="CNT4">
    <non-jta-data-source>cnt5ds</non-jta-data-source>
    <class>it.eni.italgas.was.db.entity.AsiDisco</class>
    <class>it.eni.italgas.was.db.entity.AsiErrori</class>
    <class>it.eni.italgas.was.db.entity.WasAsiRouting</class>
    <class>it.eni.italgas.was.db.entity.WasAsiRoutingId</class>
    <class>it.eni.italgas.was.db.entity.WasAsiSchemas</class>
    </persistence-unit>
    </persistence>
    and the application.xml deployment descriptor is:
    <?xml version="1.0" encoding="UTF-8"?>
    <application xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="5" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_5.xsd">
    <display-name>WASEnterprise</display-name>
    <module id="myeclipse.1188512259959">
    <ejb>WAS.jar</ejb>
    </module>
    </application>
    I don't use any other weblogic specific deployment descriptor.
    Have you ever experienced such a strange behaviour? Can you suggest something to solve the problem?
    Thanks inadvance.
    Denis Maggiorotto

    Hi all,
    i'm facing an error deploying an EJB 3.0 entity bean module wrapped in an enterprise application on WebLogic 10.
    The application is composed as follows:
    WASEnterprise.ear
    |-META-INF
    |-application.xml
    |-WAS.jar
    |-META-INF
    |-persistence.xml
    In other words the application server is unable to load persistence.xml deployment descriptor and,during deployment, it throws an error message like this:
    <Error> <J2EE> <BEA-160197> <Unable to load descriptor C:\bea\user_projects\domains\base_domain\autodeploy\WASEnterprise\WAS/META-INF/persistence.xml of module WAS. The error is weblogic.descriptor.DescriptorException: Unmarshaller failed
    I suppose that the persistence.xml is correct since i can deploy the application on jboss without any problem.
    The persistence.xml deployment descriptor is:
    <?xml version="1.0" encoding="UTF-8"?>
    <persistence>
    <persistence-unit name="CNT4">
    <non-jta-data-source>cnt5ds</non-jta-data-source>
    <class>it.eni.italgas.was.db.entity.AsiDisco</class>
    <class>it.eni.italgas.was.db.entity.AsiErrori</class>
    <class>it.eni.italgas.was.db.entity.WasAsiRouting</class>
    <class>it.eni.italgas.was.db.entity.WasAsiRoutingId</class>
    <class>it.eni.italgas.was.db.entity.WasAsiSchemas</class>
    </persistence-unit>
    </persistence>
    and the application.xml deployment descriptor is:
    <?xml version="1.0" encoding="UTF-8"?>
    <application xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="5" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_5.xsd">
    <display-name>WASEnterprise</display-name>
    <module id="myeclipse.1188512259959">
    <ejb>WAS.jar</ejb>
    </module>
    </application>
    I don't use any other weblogic specific deployment descriptor.
    Have you ever experienced such a strange behaviour? Can you suggest something to solve the problem?
    Thanks inadvance.
    Denis Maggiorotto

  • Deploying EJB 3.0 entity beans without a Datasource

    [Cross-posted from the TopLink list]
    My question: Is there any way to configure the container or persistence provider to defer trying to connect to the Datasource until I make some call that involves persistence? Or any other way to deploy an app containing entity beans without having a database configured?
    Background: I am working on a component that can be configured to run in either persistent or in-memory mode. For the persistent mode we would like to use EJB 3.0 entity beans; for the in-memory mode we would like the component to be deployable without having to have a database available.
    However in my prototype of the application, when I try to deploy to OC4J 10.1.3, as soon as the entity beans are detected the TopLink persistence provider tries to establish a connection to the db via either the configured or default DataSource. So if the db is unavailable, deployment fails. Since this is occuring at deployment, it happens regardless of whether I am actually using any persistence features or not.

    Hi,
    I'm experiencing same problems, is this a bug or an feature?

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

  • Problem with ejb 3.0 entity beans with manyToMany relationship

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

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

  • @EJB annotation in entity bean does not work

    I just started with ejb3. I have created a couple of beans. One session bean that looks like this:
    @Stateless
    public class MySessionBean implements MySession
         @Resource(name="jdbc/mydb")
         private DataSource myDB;
    public void someMethod() {
    myDB.getConnection()
    This works great. The other bean is an entity bean, and there the resource injection doesn't work. It looks like this:
    @Entity
    public class MyEntityBean
    @Resource(name="jdbc/mydb")
         private DataSource myDB;
    public void someMethod() {
    myDB.getConnection()
    Is resource injection any different in an entity bean then in a session bean? Both beans belong to the same package and are in the same application, (ear). I have exactly the same problem with @EJB injection: it works fine in the session bean but not in the entity bean...
    Any help is appreciated...
    John

    <code>
    @Entity
    @Table(name = "assetfault")
    @NamedQueries( {@NamedQuery(name = ... )})
    public class Assetfault implements Serializable {
    @javax.ejb.EJB private com.novadent.data.assetmg.sessionbeans.AssetFacadeLocal aF;
    @javax.ejb.EJB private com.novadent.data.assetmg.sessionbeans.AssetfaultFacadeLocal afF;
    </code>
    importing javax.ejb.EJB ?

  • CMP entity beans from tables in 9.0.3 jdev preview

    I am trying to generate CMP entity beans from oracle tables using 9.0.3 jdeveloper preview. My oracle db version is 9.2. I notice that if a table has a single column primary key, no xxxPK.java file is created. However, if the primary key is multi-column an xxxPK.java file is created. Is this correct behavior? I expected an xxxPK.java file to be created regardless of the number of columns in the primary key for the table. Has anyone else noticed this? I am new to EJB so forgive my ignorance.

    Comparing to JDev 902, I think this is a much better decision. Having to change beans with a single field PK to not using a custon PK class, to avoid using that class was a pain in JDev 902. There4s little benefit in using a custom class when there4s only a single field in it... some will say that it prevents having to do majot changes to your code if the PK changes in the future and add another field. But a careful database design will void this almost completely. So having JDev 903 use a java native class is a better option in this situation. At least from my personal point of view.

  • EJB 3.0 entity beans and WebDynpro models

    Hi all,
    first off all my setup:
    WebDynpro Development Component: dcA
    EJB Module Development Component: dcB
    i wan't to create Entity Beans in dcB an use it for my model in dcA.
    My questions:
    1. Why does the "New Wizard" only offer EJB 3.0 Session and Message Beans an no Entity Beans? What is the correct way for creating Entity Beans in DevStudio?
    2. Is ist right that i have to define a public Part containing the Entity Bean to make it visible to dcA?
    Regards,
       Christian

    Hi,
    I'm experiencing same problems, is this a bug or an feature?

  • Problem creating EJB 3.0 Entity bean in JDeveloper

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

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

  • Problems accessing ejb 3.0 entity bean from project

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

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

  • Merge ejb Jar containing entity beans

    Hi,
    Is there a way I can merge two or more jar files which contain Entity beans, I
    am
    deploying under WAS 6.1 and am developing under Jbuilder 6??? I am using CMP
    2 entity beans
    Thanks In Advance

    Hi.
    Try posting this to the ejb newsgroup.
    Regards,
    Michael
    jack V wrote:
    Hi,
    Is there a way I can merge two or more jar files which contain Entity beans, I
    am
    deploying under WAS 6.1 and am developing under Jbuilder 6??? I am using CMP
    2 entity beans
    Thanks In Advance--
    Michael Young
    Developer Relations Engineer
    BEA Support

  • Ejb 3.0 Entity Bean Deployment

    I am using Jboss4.0.4 Application Server and i have deployed the Entity bean.
    In this for every request with same primary key, it is getting the values from the data base every time. I am not able to figure out why it's behaving like this.. Is there is any thing through code we can instruct the container to do it.

    I am using Jboss4.0.4 Application Server and i have deployed the Entity bean.
    In this for every request with same primary key, it is getting the values from the data base every time. I am not able to figure out why it's behaving like this.. Is there is any thing through code we can instruct the container to do it.

  • EJB/JPA Session/Entity Bean: Back Reference Id not set

    Hello All,
    I m using JPA as a persist tool. I have an entity Account and in Account there is a collection of entity AccountDetail. In Account entity relation for AccountDetail is One-To-Many and in AccountDetail the relation for Account is Many-To-One. When i save the Account, object of Account and AccountDetail are saved correctly. But the problem is that in AccountDetail the Id of Account is not saved in Database table. I have AccountId in AccountDetail table. plz help me??
    Second thing is that how to generate automatically primary keys when entity saved in database ???

    define the column you want to auto increment as an Integer with Identity attribute set to True (using the sql server management tool for example) and then put
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    in front of the ID declaration in the mapping file, it should generate the IDs automatically.

  • Entity Bean Connecting table in SQL Server

    Hi Guys
    Since many days I have been struggling to make my code work. I am newbie to Workshop. I set up a new connection pool and then set up a datasource on that pool through the console. When I do a "Test" on the connection pool it gives an error saying "testtablename is not correct or some attributes have not been enabled". I am kind of stuck and don't know how to proceed from here. any help appreciated......
    Sudhir

    I might first check to see if the table name is correct.
    Are you able to do 'SELECT *' from the table using a standalone SQL client ? (like SQLPlus if your database is on Oracle)

Maybe you are looking for

  • Financial Statement Versions and languages

    Hi I want to clean up our current lots of financial statement versions. And create new ones, to be used across our companies, so one for IFRS to be used within several company codes in different countries. I see that there is a language field in the

  • Set DataGridColumn editable based on row data

    I searched for this but did not find a direct answer. People wanted something similar but not exactly the same. I have several columns in a standard datagrid that I would like to set editable if the data.company_id > 0. Is this possible? Here's my MX

  • Looking for lightroom lens profile for tamron lens

    I am using lightroom 5 at work and shot some images with a canon 5d2 body with tamron 24-70 2.8 vc and tamron 70-200 2.8 vc lense. According to the note below, both lens are supported since lightroom 4.1.  However I can not find the profile of these

  • Disk Utility won't run with Snow Leopard

    I updated to Snow Leopard 10.6.2 and now when I run Disk Utility.app it says that it is version 11.1 and will not run. I'm not sure why this app didn't update at the same time. Where can I download 11.5 Disk Utility? Thanks!

  • MobileMe account verification fails

    When I set up a MobileMe mail account on my ipad with my existing appleID, the account requires verification... To get the account verified I need to ask to send a verification mail on my iPad and reply to this mail. Unfortunately I do not receive su