Abstract Entity classes with Collections

I trying to figure out a way to have a generics collection in a parent collection that can hold various entity types of the same super-class.
One thing I've tried was the following:
@Entity
public class ParentEnt implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;
    @Column
    private String parentName;
    @OneToMany(mappedBy="parentEnt")
    private Collection<ChildAbs> children;
    /* Methods removed */
@Entity
public abstract class ChildAbs implements java.io.Serializable {
    protected static final long serialVersionUID = 1L;
    @Id
    protected Long id;
    @ManyToOne
    protected ParentEnt parentEnt;
    /* Methods removed */
@Entity
public class ChildEnt extends ChildAbs implements Serializable {
    @Column
    protected String childName;
}but this is the error I get:
Exception [TOPLINK-30005] (Oracle TopLink Essentials - 2.0 (Build b58g-fcs (09/07/2007))): oracle.toplink.essentials.exceptions.PersistenceUnitLoadingException
Exception Description: An exception was thrown while searching for persistence archives with ClassLoader: sun.misc.Launcher$AppClassLoader@11b86e7
Internal Exception: javax.persistence.PersistenceException: Exception [TOPLINK-28018] (Oracle TopLink Essentials - 2.0 (Build b58g-fcs (09/07/2007))): oracle.toplink.essentials.exceptions.EntityManagerSetupException
Exception Description: predeploy for PersistenceUnit [testPU] failed.
Internal Exception: Exception [TOPLINK-7250] (Oracle TopLink Essentials - 2.0 (Build b58g-fcs (09/07/2007))): oracle.toplink.essentials.exceptions.ValidationException
Exception Description: [class test.ParentEnt] uses a non-entity [class test.ChildAbs] as target entity in the relationship attribute [private java.util.Collection test.ParentEnt.children].So, it looks like there is no way to have a generics collection for an abstract entity class. Is there another way to accomplish what I want using a generics collection?
Additionally, entity ChildEnt generates an error due to the abstract class' id property not carrying forward (see Abstract Entities: http://java.sun.com/javaee/5/docs/tutorial/doc/bnbqa.html#bnbqo)
Exception Description: Entity class [class testprintservices.ChildEnt] has no primary key specified. It should define either an @Id, @EmbeddedId or an @IdClass.Any input would be appreciated.

As far as my first question, I was trying to make my collection so it can hold various type of entity classes, but now that I think about it, it was a bad idea. For instance, being able to hold ChildEnt and ChildEnt2 in the same collection. If JPA did allow this, it might be possible to save the entities to the DB, but the reverse wouldn't be possible.
Ok, regarding my 2nd question: I don't understand why having it as @Entity wouldn't. The links (mine and yours) clearly shows that @Id is carried forward in the example they provide. Anyway, since I can't use the superclass in the collection, this is pointless. I'll use the suggested annotation.
Thanks.

Similar Messages

  • Base classes with Collection attributes

    I have a question. Suppose I have a base class A, an abstract base class
    to be exact, and subclasses B and C. Assume A has an attribute of
    Collection type, let's call it collectionImpl. Now I would like subclasses
    B and C to be able to have elements of different types along the lines of
    what I've outlined below.
    Strictly speaking, class A wouldn't have to be PC, since I primarily care
    of B and C but I wanted to show the structure.
    <class name="A" persistence-capable-superclass="A">
    <field name="collectionImpl">
    <collection element type="someType"/>
    </field>
    </class>
    <class name="B" persistence-capable-superclass="A">
    <field name="collectionImpl">
    <collection element type="someOtherType"/>
    </field>
    </class>
    So, how would one express this?
    Scott

    Understood. Now for bit more clarification. Given my earlier example, what
    if classes A, B and C implement the java.util.Collection interface. Does
    Kodo have in issue with that? I know Kodo has this ProxyCollection stuff
    but I don't really want to do that, nor do I think I really need to given
    what I'm trying to accomplish.
    The issue I'm having now is that the Kodo Enhancer is complaining that no
    element-type is declared when I have an attribute of class type B for
    example (implementing java.util.Collection) even though an element type is
    declared for the that actual Collection object held in the base class of B
    (A).
    <class name="A" requires-extent="false">
    <field name="impl">
    <collection element-type="SomeType"/>
    <extension vendor-name="kodo" key="ordered" value="true"/>
    </field>
    </class>
    <class name="B" persistence-capable-superclass="A"
    requires-extent="false"/>
    Class "A" extends java.util.AbstractSet, impl is an instance of
    java.util.Collection.
    All this was working quite well until I made some updates recently
    although the basic implementation is the same. Logically I don't know what
    I might have done to cause the new error message.
    I'm using v2.5.2 BTW.
    Scott
    Stephen Kim wrote:
    The one thing to note is that if you do not make A persistent capable,
    you cannot persist fields -declared- in A or query starting from A.
    Scott A. Leschke wrote:
    Can I acheive the same effect by making A be non-PC and provide a abstract
    protected method that will be used by a to access the collection
    implemented in the sub-classes as you suggest (ie. Collection
    getCollectionImpl())?
    Steve Kim
    [email protected]
    SolarMetric Inc.
    http://www.solarmetric.com

  • EJB 3.0: How to merge detached entity with collection

    Hello,
    suppose you have 2 database tables: PARENT and CHILD with one-to-many association. In a session bean you load the parent entity together with collection of children and send it all to client. Client might change parent or child data, add/remove children.
    Now back in a session bean you want to update database, so you call:
    entityManager.merge(detached_parent_entity);Problem is, that removed child objects from entity bean collection are not deleted from database. Bacause I am currently using Hibernate, I could follow the FAQ (http://www.hibernate.org/116.html#A17) and add delete-orphan cascade, but I don't want to be tight to Hibernate nor other frameworks.
    Is there any sexy solution?
    Thanks for replies!

    I'm afarid not - a generic feature that will allow to
    delete orphan children didn't make it into the final
    spec.
    regards,
    -marinaDo you happen to have any links to public discussions about this feature with regard to the development of the spec? This is a very nice feature in Hibernate and it's absence in EJB 3.0 is rather disappointing.
    Thanks.

  • Updating the structure of an Entity class

    Hi,
    I'm a newbie to JPA, trying to learn it by writing my own application. I have defined an entity class with 3 fields, and I've used it to create and populate my database.
    Now I wish to add a 4th (optional) field to the original class, but I do not want to lose the data I've already saved in the database. Is there a way of doing this, or a setting somewhere, that will get toplink to do this for me, instead of me having to manually "alter" the database table?
    thanks

    There is currently no support within TopLink to track versions of your entity classes or compare the existing with the expected schema to be able to alter the database. You will need to do this manually or use a database tool that supports this. I believe Oracle's JDeveloper and SQL Developer both support incremental schema changes.
    Doug

  • Jsf entity class support

    Support for Entity Classes with JSF
    http://netbeans.org/kb/docs/web/jsf-jpa-weblogic.html#02e
    can this be done in OEPE?

    Please check this 6 part tutorial:
    http://weblogic.sys-con.com/node/1297479
    http://java.sys-con.com/node/1308612
    http://weblogic.sys-con.com/node/1348972
    http://weblogic.sys-con.com/node/1469182
    http://java.sys-con.com/node/1469182
    http://java.sys-con.com/node/1557486
    OEPE can be configured to connect to database, generate
    JPA entities and ORM classes. Generating JSF pages is planned
    for coming releases.

  • Entity bean with another class as primary key generator class

    Hi All,
    I have a CMP entity bean in which I generate the primary key using my own class know as unique id generator.
    I use it in ejbCreate method in the following manner
    public Long ejbCreate(HospitalData hospitalData) throws CreateException{
              Long myid = new Long(UniqueIdGenerator.getId());
              System.out.println("My id generated ====== "+myid);
              this.hospitalid = myid;
              System.out.println("My id generated ====== "+this.hospitalid);
              System.out.println("Came in ejbCreate method of HospitalEJB");
              this.hospitalname = hospitalData.getHospitalname();          
              return null;
    Can you tell me how I map this primary key in my ejb-jar.xml and jbosscmp-jdbc.xml.
    Anyhelp would be appreciated.
    Thanks
    Sameer

    "Bhamu" <[email protected]> wrote in message
    news:9keuo4$[email protected]..
    I am trying to develop an entity bean attached to a key which have a
    composite key using Primary Key Class. When I use the findByPrimaryKey
    method of the bean it throws an exception as follows,I notice that you are using the reference CMP plugin.
    at com.netscape.server.ejb.SQLPersistenceManager.find(Unknown Source)I'm also willing to bet that you may have created your own primary key class
    with a single field, rather than using the fields type as a primitive
    primary key class. If you do this, then SQLPersistenceManager will break.
    It is badly written, and has some stupid assumptions. The one I remember
    the most is that if you only have one primary key field, then
    SQLPersistenceManager assumes you have used a primitive type such as
    java.lang.String or java.lang.Integer, to represent it, rather than creating
    your own <Enity>Pk.java file.
    SQLPersistenceManager works for toy examples, but in general I would say it
    is broken and unusable. Either use BMP, or splash out the money for Coco
    Base from Thought Inc. Currently the only CMP plugin for iPlanet App server,
    other than the reference implementation, that I know of.

  • Entity Bean with Primary Key Class

    Hi
    I am trying to develop an entity bean attached to a key which have a
    composite key using Primary Key Class. When I use the findByPrimaryKey
    method of the bean it throws an exception as follows,
    java.sql.SQLException: Parameter typecheck failed: invalid parameter type:
    ORA-00000: normal, successful completion
    at com.netscape.server.jdbc.PreparedStatement.verifyError(Unknown Source)
    at com.netscape.server.jdbc.PreparedStatement.afterVerify(Unknown Source)
    at com.netscape.server.jdbc.PreparedStatement.executeQuery(Unknown Source)
    at com.netscape.server.ejb.SQLPersistenceManager.find(Unknown Source)
    at
    com.netscape.server.ejb.EntityDelegateManagerImpl.doPersistentFind(Unknown
    Source)
    at com.netscape.server.ejb.EntityDelegateManagerImpl.find(Unknown Source)
    at com.kivasoft.eb.EBHomeBase.findSingleByParms(Unknown Source)
    at
    TestBean2.ejb_home_TestBean2_EntityBean2Bean.findByPrimaryKey(ejb_home_TestB
    ean2_EntityBean2Bean.java:120)
    at
    TestBean2.ejb_kcp_skel_EntityBean2Home.findByPrimaryKey__TestBean2_EntityBea
    n2__TestBean2_TestBKey(ejb_kcp_skel_EntityBean2Home.java:258)
    at com.kivasoft.ebfp.FPRequest.invokenative(Native Method)
    at com.kivasoft.ebfp.FPRequest.invoke(Unknown Source)
    at
    TestBean2.ejb_kcp_stub_EntityBean2Home.findByPrimaryKey(ejb_kcp_stub_EntityB
    ean2Home.java:341)
    at
    TestBean2.ejb_stub_EntityBean2Home.findByPrimaryKey(ejb_stub_EntityBean2Home
    ..java:88)
    at TestBean2.Simple1.defaultAction(Simple1.java:115)
    at TestBean2.Simple1.doGet(Simple1.java:26)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:865)
    at com.netscape.server.servlet.servletrunner.ServletInfo.service(Unknown
    Source)
    at com.netscape.server.servlet.servletrunner.ServletRunner.execute(Unknown
    Source)
    at com.kivasoft.applogic.AppLogic.execute(Unknown Source)
    at com.kivasoft.applogic.AppLogic.execute(Unknown Source)
    at com.kivasoft.thread.ThreadBasic.run(Native Method)
    at java.lang.Thread.run(Thread.java:479)
    javax.ejb.FinderException
    at com.netscape.server.ejb.SQLPersistenceManager.find(Unknown Source)
    at
    com.netscape.server.ejb.EntityDelegateManagerImpl.doPersistentFind(Unknown
    Source)
    at com.netscape.server.ejb.EntityDelegateManagerImpl.find(Unknown Source)
    at com.kivasoft.eb.EBHomeBase.findSingleByParms(Unknown Source)
    at
    TestBean2.ejb_home_TestBean2_EntityBean2Bean.findByPrimaryKey(ejb_home_TestB
    ean2_EntityBean2Bean.java:120)
    at
    TestBean2.ejb_kcp_skel_EntityBean2Home.findByPrimaryKey__TestBean2_EntityBea
    n2__TestBean2_TestBKey(ejb_kcp_skel_EntityBean2Home.java:258)
    at com.kivasoft.ebfp.FPRequest.invokenative(Native Method)
    at com.kivasoft.ebfp.FPRequest.invoke(Unknown Source)
    at
    TestBean2.ejb_kcp_stub_EntityBean2Home.findByPrimaryKey(ejb_kcp_stub_EntityB
    ean2Home.java:341)
    at
    TestBean2.ejb_stub_EntityBean2Home.findByPrimaryKey(ejb_stub_EntityBean2Home
    ..java:88)
    at TestBean2.Simple1.defaultAction(Simple1.java:115)
    at TestBean2.Simple1.doGet(Simple1.java:26)
    [03/Aug/2001 15:26:41:7] error: Exception: SERVLET-execution_failed: Error
    in executing servlet Simat
    javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
    at javax.servlet.http.HttpServletple1: java.lang.ClassCastException:
    com.netscape.server.deployment.EntityBeanDescriptor
    Exception .service(HttpServlet.java:865)
    at com.netscape.server.servlet.servletrunner.ServletInfo.service(Unknown
    Source)
    at com.netscape.server.servlet.servletrunner.ServletRunner.execute(Unknown
    Source)Stack Trace:
    java.lang.ClassCastException:
    com.netscape.server.deployment.EntityBeanDescriptor
    a
    at com.kivasoft.applogic.AppLogic.execute(Unknown Source)
    at com.kivasoft.applogic.AppLogic.ext
    com.netscape.server.servlet.servletrunner.AppInfo.popWebAppDescriptor(Unknow
    n Source)
    at com.netscape.server.servlet.servletrunner.ServletInfo.service(Unknown
    Source)
    at com.netscape.server.seecute(Unknown Source)
    at com.kivasoft.thread.ThreadBasic.run(Native Method)
    at java.lang.Threadrvlet.servletrunner.ServletRunner.execute(Unknown
    Source)
    at com.kivasoft.applogic.AppLogic.execu.run(Thread.java:479)
    te(Unknown Source)
    at com.kivasoft.applogic.AppLogic.execute(Unknown Source)
    at com.kivasoft.thread.ThreadBasic.run(Native Method)
    at java.lang.Thread.run(Thread.java:479)
    Any kind of help is appreciated. I am using iPlanet App Builder 6.0 with iAS
    6.0 SP1.
    Thanks
    Bhaskara Murthy
    Eclipse Networks Inc

    "Bhamu" <[email protected]> wrote in message
    news:9keuo4$[email protected]..
    I am trying to develop an entity bean attached to a key which have a
    composite key using Primary Key Class. When I use the findByPrimaryKey
    method of the bean it throws an exception as follows,I notice that you are using the reference CMP plugin.
    at com.netscape.server.ejb.SQLPersistenceManager.find(Unknown Source)I'm also willing to bet that you may have created your own primary key class
    with a single field, rather than using the fields type as a primitive
    primary key class. If you do this, then SQLPersistenceManager will break.
    It is badly written, and has some stupid assumptions. The one I remember
    the most is that if you only have one primary key field, then
    SQLPersistenceManager assumes you have used a primitive type such as
    java.lang.String or java.lang.Integer, to represent it, rather than creating
    your own <Enity>Pk.java file.
    SQLPersistenceManager works for toy examples, but in general I would say it
    is broken and unusable. Either use BMP, or splash out the money for Coco
    Base from Thought Inc. Currently the only CMP plugin for iPlanet App server,
    other than the reference implementation, that I know of.

  • Abstract Method in a Class with implemented method

    I have a class which already has methods Implemented.I mean thse metgods are not abstract.I want only one method to be abstarct which will be overrideen by its subclass or derived Class
    I have never tried this
    Does anyone knows how to do this
    If yes could you give me syntax of the method
    Thanks in advance
    CSJakharia

    javax.swing.JComponent is an example of an abstract
    class with no abstract methods. That is why the
    following works:
    JComponent component = new JComponent(){};
    Not to forget you cannot instantiate abstarct classes
    public abstract class Test
    public String getName()
    return "Mike";
    public static void main(String[] args)
    Test tt = new Test();
    System.out.println(tt.getName());
    }and you would get the error
    The type Test cannot be instantiated.
    You remove the abstract keyword and it would compile
    good.No I am not misinterpreting I know what he is saying but I am closing the door of misinterpretation which I felt was possible. ;)
    cheers

  • In which case we need a class with all methods defined as abstract ?

    In which case we need : A class with all methods defined as abstract (or should we go for Interface always in this case)

    The concept of interface and abstract class overlaps sometime, but we can have the following thumb rule to use them for our specific need:
    1) Interface: This should be use for code structuring. They standardize your application by providing a specific contract within and outside. If you think abstract class also provide structure, then reconsider as it limits the structure re-usability when there are many super-classes to inherit from. Java allow multiple inheritance by interface and not by Abstract class.
    2) Abstract Class: This should be use for code-reusability. Interface doesn't have any code so can't be used for code-reusability.
    Actually we can use both to provide the best.Taking a refernce to J2EE framework, the "Servlet" is an interface. It laids down the contract/structure for any code to be a servlet.
    But the "GenericServlet" class is an abstract class which provides implementation of some of the methods defined in the "Servlet" interface and leave some method abstract.
    Thus we see that the "Servlet" interface standardise the structure and the "GenericServlet" abstract class gives code re-usability.
    Original Question:
    In which case we need a class with all methods defined as abstract ?To this question, as all methods are abstarct we don't have option for code-reusability. so why not add standard structure concept to your application. So if there is not any restriction on making the field variable(if any) as final, we should go with the interface concept.

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

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

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

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

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

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

  • ToString() and Comparable T on a JAXB generated entity class

    Hello,
    I'm trying to create a distributed system and therefore I have all my entity classes present in my Java EE app and hosted as a web service. The Swing frontend app autogenerate the entity classes for use in the presentation.
    I'm having some trouble using the Collections.sort() since a generated entity cannot implement an interface, does anyone have a hint to how i can solve this issue?
    Also, I need to override the toString() so that I can put an entity directly in a eg. JCombobox and it is presented with the return of my custom toString() but if I override the toString() in my original entity in my backend app, then this method is not generated in my frontend app.
    Thanks in advance!
    Nicklas

    Hello,
    I'm trying to create a distributed system and therefore I have all my entity classes present in my Java EE app and hosted as a web service. The Swing frontend app autogenerate the entity classes for use in the presentation.
    I'm having some trouble using the Collections.sort() since a generated entity cannot implement an interface, does anyone have a hint to how i can solve this issue?
    Also, I need to override the toString() so that I can put an entity directly in a eg. JCombobox and it is presented with the return of my custom toString() but if I override the toString() in my original entity in my backend app, then this method is not generated in my frontend app.
    Thanks in advance!
    Nicklas

  • Is there some caching of entity classes?

    We are analyzing a bug in our application which seems to be caused by some kind of jpa entity class cache in weblogic (or some other feature causing indirectly the same thing).
    The bug can't be reproduced every time, but it is happening very often after following steps:
    - Deploy application from Eclipse with OEPE in mode "Virtual application"
    - Use Redeploy or Clean feature of OEPE several times
    We are doing some jpa queries during initialization of our application and after several redeploys assigning of resulting entities of those queries triggers class cast exception. I have captured some diagnostics that confirmed that class of jpa query result entity has different classloader than current web app classloader. How is it possible and how can we clear that kind of cache that's causing this during redeploy? I'm not writing to OEPE forum because I think it uses standard facilities of Weblogic where this should never ever be possible regardles of what tool is using it. My diagnostic logs are:
    Expected class classloader: weblogic.utils.classloaders.ChangeAwareClassLoader@6ef4e946 finder: weblogic.utils.classloaders.CodeGenClassFinder@2e1a3d11 annotation: xxx
    Expected class source location (notice that this path is same in both cases): file:/C:/Users/.../FeblApplicationSettingsTuple.class
    Expected class protection domain: ProtectionDomain (file:/C:/Users/.../FeblApplicationSettingsTuple.class <no signer certificates>)
    weblogic.utils.classloaders.ChangeAwareClassLoader@6ef4e946 finder: weblogic.utils.classloaders.CodeGenClassFinder@2e1a3d11 annotation: xxx
    <no principals>
    java.security.Permissions@4ce3316a (
    ("java.net.SocketPermission" "localhost:1024-" "listen,resolve")
    ("java.lang.RuntimePermission" "stopThread")
    ("java.util.PropertyPermission" "line.separator" "read")
    ("java.util.PropertyPermission" "java.vm.version" "read")
    ("java.util.PropertyPermission" "java.vm.specification.version" "read")
    ("java.util.PropertyPermission" "java.vm.specification.vendor" "read")
    ("java.util.PropertyPermission" "java.vendor.url" "read")
    ("java.util.PropertyPermission" "java.vm.name" "read")
    ("java.util.PropertyPermission" "os.name" "read")
    ("java.util.PropertyPermission" "java.vm.vendor" "read")
    ("java.util.PropertyPermission" "path.separator" "read")
    ("java.util.PropertyPermission" "java.specification.name" "read")
    ("java.util.PropertyPermission" "os.version" "read")
    ("java.util.PropertyPermission" "os.arch" "read")
    ("java.util.PropertyPermission" "java.class.version" "read")
    ("java.util.PropertyPermission" "java.version" "read")
    ("java.util.PropertyPermission" "file.separator" "read")
    ("java.util.PropertyPermission" "java.vendor" "read")
    ("java.util.PropertyPermission" "java.vm.specification.name" "read")
    ("java.util.PropertyPermission" "java.specification.version" "read")
    ("java.util.PropertyPermission" "java.specification.vendor" "read")
    Actual class classloader: weblogic.utils.classloaders.ChangeAwareClassLoader@1b5f0c6 finder: weblogic.utils.classloaders.CodeGenClassFinder@20094d55 annotation: xxx
    Actual class source location: file:/C:/Users/.../FeblApplicationSettingsTuple.class
    Actual class protection domain: ProtectionDomain (file:/C:/Users/...n/FeblApplicationSettingsTuple.class <no signer certificates>)
    weblogic.utils.classloaders.ChangeAwareClassLoader@1b5f0c6 finder: weblogic.utils.classloaders.CodeGenClassFinder@20094d55 annotation: xxx
    <no principals>
    java.security.Permissions@57c14d95 (
    ("java.net.SocketPermission" "localhost:1024-" "listen,resolve")
    ("java.lang.RuntimePermission" "stopThread")
    ("java.util.PropertyPermission" "line.separator" "read")
    ("java.util.PropertyPermission" "java.vm.version" "read")
    ("java.util.PropertyPermission" "java.vm.specification.version" "read")
    ("java.util.PropertyPermission" "java.vm.specification.vendor" "read")
    ("java.util.PropertyPermission" "java.vendor.url" "read")
    ("java.util.PropertyPermission" "java.vm.name" "read")
    ("java.util.PropertyPermission" "os.name" "read")
    ("java.util.PropertyPermission" "java.vm.vendor" "read")
    ("java.util.PropertyPermission" "path.separator" "read")
    ("java.util.PropertyPermission" "java.specification.name" "read")
    ("java.util.PropertyPermission" "os.version" "read")
    ("java.util.PropertyPermission" "os.arch" "read")
    ("java.util.PropertyPermission" "java.class.version" "read")
    ("java.util.PropertyPermission" "java.version" "read")
    ("java.util.PropertyPermission" "file.separator" "read")
    ("java.util.PropertyPermission" "java.vendor" "read")
    ("java.util.PropertyPermission" "java.vm.specification.name" "read")
    ("java.util.PropertyPermission" "java.specification.version" "read")
    ("java.util.PropertyPermission" "java.specification.vendor" "read")
    )

    Hello,
    Can you post the code that runs into the exception, the exception itself, as well as how you are obtaining your EntityManager and EntityManagerFactory (if applicable)? If you are managing EntityManagerFactories in the application instead of allowing the container to manage them for you via injection, then you must also ensure that the application will close them when undeployed or some point before redeployment occurs. Otherwise, a similar error might occur dependent if garbage collection does not complete before the application next attempts to retrieve a factory.
    Best Regards,
    Chris

  • EJBQLException, Entity Class, NetBeansv6, TopLink

    Hello I'm new to java and having difficulty with Persistence EntityManager, within persistence.xml I've unselected the 'Include all entity classes' and added the entity class "ImageSpec" to the list provided, and the Entity Class is on the same class path but I still have the following exception. I've researched orm.xml but that looks like it's for deployment scinario's? and not required for development? Any help would be greatly appreciated thank you.
    Exception
    Caused by: Exception [TOPLINK-8034] (Oracle TopLink Essentials - 2.0 (Build b58g-fcs (09/07/2007))): oracle.toplink.essentials.exceptions.EJBQLException
    Exception Description: Error compiling the query [select object(o) from Images o]. Unknown abstract schema type [Images].
            at oracle.toplink.essentials.exceptions.EJBQLException.unknownAbstractSchemaType(EJBQLException.java:494)
    Entity Class
    package org.comp.app.ds.ajax;
    import java.io.Serializable;
    import javax.persistence.Entity;
    import javax.persistence.Id;
    import javax.persistence.Table;
    import org.json.JSONArray;
    @Entity
    @Table(name="Images")
    public class ImageSpec implements Serializable {
      private Long imgId;
      private String imgDescription;
      private Long imgFileSize;    
      private String imgFilePath;
      private String imgFileType;
      public ImageSpec() { }
      public JSONArray toJSON() {
         JSONArray thisJSON = new JSONArray();
         thisJSON.put(this.getImgId());
         thisJSON.put(this.getImgDescription());
         thisJSON.put(this.getImgFileSize());
         thisJSON.put(this.getImgFilePath());
         thisJSON.put(this.getImgFileType());
         return thisJSON;
      @Id
      public Long getImgId() {
        return imgId;
      public String getImgDescription() {
        return imgDescription;
      public Long getImgFileSize() {
        return imgFileSize;
      public String getImgFilePath() {
        return imgFilePath;
      public String getImgFileType() {
        return imgFileType;
      public void setImgId(Long imgId) {
        this.imgId = imgId;
      public void setImgDescription(String imgDescription) {
        this.imgDescription = imgDescription;
      public void setImgFileSize(Long imgFileSize) {
        this.imgFileSize = imgFileSize;
      public void setImgFilePath(String imgFilePath) {
        this.imgFilePath = imgFilePath;
      public void setImgFileType(String imgFileType) {
        this.imgFileType = imgFileType;
    persistence.xml
    <persistence-unit name="AppPU" transaction-type="JTA">
        <provider>oracle.toplink.essentials.PersistenceProvider</provider>
        <jta-data-source>jdbc/appDB</jta-data-source>
        <class>org.comp.app.ds.ajax.ImageSpec</class>
        <exclude-unlisted-classes>true</exclude-unlisted-classes>
        <properties>
        </properties>
      </persistence-unit>

    By finding a resource on EJB QL, my Query syntax was wrong. Here's an explanation for anybody with the same problem.
    SQL Query Example
    SELECT * FROM TableName
    EJB QL Example
    SELECT OBJECT(i) FROM ImageSpec i
    OBJECT = * (+Select All+)
    i = A made up identifying character (Rule of thumb: use the first character of Entity Class Name)
    ImageSpec = The Entity Class Name (+Not the Database Column Name+)
    See the link URL below for more information:
    http://edocs.bea.com/workshop/docs81/doc/en/core/index.html
    Edited by: Jodda on Feb 22, 2008 7:41 AM - Marked as answered.

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

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

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

Maybe you are looking for

  • "Goods receipt for purch. order" is not allowed (WBS D-GNP-051001-02-1-1)

    PO is already released. I used posting period that was in the config 10/2006 9/2006. Then when I tried to Post in MB01 I get this error. How to change the status of object 'WBS D-GNP-051001-02-1-1' to allow the transaction 'Goods receipt for purch. o

  • Selecting a portion of the movie to darken using a continuous clip

    I have a section of the video that I need to darken. But if I select that section and click inspector to darken it, it makes the whole video darken. Then when I split the clip and darken that section it works-but as soon as I join the clip it reverts

  • My 4th gen ipod has ghosts

    my daughters 4th gen ipod has a mind of it's own. it types, pulls up apps, changes pages, without us even touching the screen. Also most of the time screen seems locked up and when we press a tab, either a differant one is chosen by itself. I have re

  • Displaying Screen After the Add Button is pressed and the document is saved

    Hi All, I am trying to the Display the Landed Cost screen after the Goods Receipt PO has been added and Saved. My code below: <b>If pVal.ItemUID = "1" And pVal.FormTypeEx = "143" And pVal.FormMode = SAPbouiCOM.BoFormMode.fm_ADD_MODE And pVal.BeforeAc

  • GOS: create store business document

    Hi experts, when using GOS to attach a document (create store business document), the system enables me to attach the corresponding documents. The thing is that once created the attachment, if you display list, the documents attached can not be disti