Can a Berkeley DB JE @Entity class contain Swing components?

I want to maintain a database of screen layouts. My @Entity class may contain a JPanel, which may contain JButtons, etc. How do I annotate all the Swing component classes as @Persistent?

This falls into the category of persisting a class for which you don't have control over the source code.  It's discussed here:
PersistentProxy (Oracle - Berkeley DB Java Edition API)
--mark

Similar Messages

  • Problem with showing palette component which contains swing components

    hello, I have found a simple problem with jdeveloper IDE but this simple problem delays my project and it make late a big project so help me please. I want to add somes swing components to a JFrame
    but when I try to show the palette component as usual I didn't find the swing components like habit.
    Best Regards

    duplicate
    Frank

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

  • How can you add autonumber feature in an entity class?

    Hi guys!
    Can you pls help me with this problem, I'm new to java EE. I've got an entity class and I want to implement an auto number feature using the following code:
    { *{color:#ff0000}private static final long serialVersionUID = 1L;*
    *{color}* *{color:#ff0000}@Id*
    * @GeneratedValue(strategy=GenerationType.AUTO)*
    *{color}* @Basic(optional = false)
    @Column(name = "CUST_ID")
    private Long custId;
    But this doesn't work, it gives me the following error: "java.sql.SQLSyntaxErrorException: Table/View 'SEQUENCE' does not exist.". Can you also briefly explain to me how the database will accept this with configuration(if it will accept).

    GenerationType.AUTO:
    Indicates that the persistence provider should pick an appropriate strategy for the particular database. The AUTO generation strategy may expect a database resource to exist, or it may attempt to create one. A vendor may provide documentation on how to create such resources in the event that it does not support schema generation or cannot create the schema resource at runtime.
    http://java.sun.com/javaee/5/docs/api/
    I use Hibernate as a provider and Oracle as ad DB and had to create a seuence called HIBERNATE_SEQUENCE
    m

  • Question: is there any way to get entity class in JPQL query

    Hello, I'm using J*dev 11gR1 adn JPA with EclipceLink*.
    Let's consider such example
    @Entity
    @Table(name="ANIMALS")
    @Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
    public class Animal implements Serializable {
    @Entity
    @Table(name = "CATS")
    public class Cat extends Animal implements Serializable{
    @Entity
    @Table(name = "DOGS")
    public class Dog extends Animal implements Serializable{
    }I need to build a query which will be translated to something like this SQL query:
    SELECT * FROM CATS
    UNION ALL
    SELECT * FROM DOGS
    ORDER BY ...So I need a way to query not all child entities from DB.
    P.S. Yes, I know, that I can execute query on panent entity (select a from Animal a order by ...) and then loop throught the result list and delete not needed objects OR I can execute some queries on needed child entities and then merge them into one list and sort it, BUT both ways it will be much slower than generetion of needed SQL query straight to DB.
    I know, that in Hibernate's HQL there is a way to build such query with something like this:
    select * from Animal a where a.class = Cat or a.class = Dog

    In JPA 2.0 which we are implementing right now you will be able to execute queries like:
    SELECT a FROM Animal a  WHERE TYPE(a) IN (Cat, Dog)The next draft of the specification contains a section which describes the feature in detail and provides more examples of its use:
    4.6.17.4 Entity Type Expressions
    An entity type expression can be used to restrict query polymorphism. The TYPE operator returns the
    exact type of the argument.I have also been working with some customers on similar capabilities using the current versions of EclipseLink. The examples are documented here:
    http://wiki.eclipse.org/EclipseLink/Development/JPA/QueryDownCast
    I hope this helps,
    Doug

  • Paint() method in an entity class

    Hi,
    I am trying to draw 2 shapes in a Canvas, one rectangle and a circle.
    However, I have an entity class for both the rectangle and the circle, something like:
    public class MyRectangle
    private int width, height;
    public MyRectangle() { ... }
    pulbic getWidth() { return width; }
    pulbic getHeight() { return Height; }
    I do not want to draw these 2 shape in the paint() method of the Canvas, I want my Rectangle class and my Circle to have their own paint method to draw themselves into the canvas, is it possible?
    If it is possible, can you tell me roughly how to do it?
    Do I have to extend the Component class?
    Thanks in advance.
    SK

    Hi,
    I tried to do what you mentioned as the following, but I cant get the circle display on the screen, do you know why? Thanks
    public class Ball extends Component
    private static final int diameter = 15;
    private int xPosition = 10, yPosition = 10;
    public Ball()
    public int getX() { return xPosition; }
    public int getY() { return yPosition; }
    public int getDiameter() { return diameter; }
    public void paint(Graphics g)
         super.paint(g);
    Graphics2D graphics2D = (Graphics2D)g;
    graphics2D.fillOval(xPosition, yPosition, diameter, diameter);
    public class MyFrame extends JFrame
    public MyFrame()
    // Set up the main frame
    super("Test");
    setPreferredSize(new Dimension(400, 300));
    Container contentPane = getContentPane();
         Ball aBall = new Ball();
         JPanel myPanel = new JPanel();
         myPanel.setBackground(Color.white);
         myPanel.setBorder(BorderFactory.createLineBorder(Color.black));
         myPanel.setOpaque(true);
    myPanel.add(aBall);
         contentPane.add(myPanel, BorderLayout.CENTER);     
    pack();
    /** The main method */
    public static void main(String[] args)
         MyFrame myFrame = new MyFrame();
    myFrame.setVisible(true);
    }

  • Adf bc jar for base entity classes and extending them existing  project

    Hi,
    I am using jdev 11.1.1.0 and have created a base workspace/project and adf jar for my base entity classes.
    1. I can consume this base adf bc jar in a separate new consuming workspace and create VO based on base bc classes or create new EOs that extend base bc entity classes.
    2. Furthermore, for an existing consuming project that earlier included src/ of base entity (BC components), i can remove the dependency on bc source and bring in this new adf jar and everything including the view controller and the service/datacontrol works fine.
    The issue i am running into is as follows.
    - In the existing project (#2) above i try to create a couple of entities based on entities in my base jar; associations are automatically brought in. Note i am not overriding any attributes. My intent here is to generate .java and implement some code.
    - I then try to make my existing VOs based on the newly extended entity (VO overview->Entity Objects-> Shuttle NewEntity from Available to Selected)
    - I then try to remove the old EO from selected under VO overview->Entity Objects->Shuttle OldEntity from Selected back
    - I get a warning dialog box that says something to the effect that some viewlinks are dependent on these old EOs in this consuming project.
    - I tried to laboriously analyzed dependencies and it this dialog box does not make any sense as I have already extended EOs and the tooling should be able to let me use these
    My questions
    - Why I am not able to remove old entities from VO dependencies
    - Is it ok to leave the old EOs in "Selected" along with the newly extended EO ? What are the implications for this?
    - I also thought about extending base associations, but did not go anywhere.
    In general, I am ok with consuming an ADF BC jar that has entities etc. but not clear about removing dependencies of base EOs on VOs when entities are extended and consumed in a pre-existing project that used base entities.
    I can send a project if any PM is willing to take a look at it.
    Thanks,
    ps:
    I have already gone over the following info
    http://technology.amis.nl/blog/215/organization-of-bc4j-domain-eo-and-business-vo-package
    .. wants to create an enterprise data model in BC4J, reflecting the Enterprise Data Model set up in the RDBMS. All (or at least most) business rules will be implemented in the Middle Tier – to take the load of the database and also allow developers not comfortable with PL/SQL to define and maintain the business rules. It is clear that this means that all applications that need to access – and manipulate – the database, need to go through the BC4J foundation layer. Martijn wants to define the Entity Objects – and their business rules – only once and share that definition between different projects. Each projects can create its own ViewObjects on top of these shared Enterprise Entity Objects.
    http://radio-weblogs.com/0118231/2005/09/29.html
    I am currently working on a project for a partner where we will be using ADF BC as our model layer for a large application. In order to keep the footprint of each application module down to a reasonable size, we are intending to create a number of separate 'root' application modules for each functional area of the application. Within, these 'root' application modules we will then use nested application modules to further partition the application. All of the application modules will be accessing the same datasource and will need access to the same database objects.
    In order to separate our code between the development team and into function areas, our initial thoughts were that we would create an ADF BC model project containing Entity Objects for all of the database tables e.t.c. as these are common amongst all functional areas. We have configured all of the EOs for validation rules, defaulting values and extending doDML() as appropriate. Happy at this stage we then created a simple .jar file to deploy all of the definitions. Upon creating a new ADF BC project for each functional area we added the jar file as a library import into the new project. However when we the tried to create some new View Objects via the JDev Wizard we were unable to see the imported Entity Objects.
    Is the only way to share Entity Object definitions between different ADF BC projects to manually copy the source definition files into the new projects src directory? Since this would mean multiple copies of the same components, it could prove to be a maintenance nightmare.Is there a way of doing it without creating multiple copies of the same object definitions?
    The developer is spot on in their ideas of layering and reuse, and even has created a library for their reusable entities. This last step is not something everyone thinks to do. The missing step is known as "importing" components, so with that one extra bit of knowledge under his belt, he should be able to do exactly what he envisions. My little article called Difference Between Adding and Importing Business Components tries to explain the difference and gives the menu options to choose to perform the importing.
    Difference between adding and importing BC4J
    http://radio-weblogs.com/0118231/stories/2005/08/11/differenceBetweenAddingAndImportingBusinessComponents.html
    Working with Libraries of Reusable Business Components
    http://download.oracle.com/docs/cd/B32110_01/web.1013/b25947/bcadvgen.htm#CHEFECGD

    Hi,
    since you followed the OC4J developer guide I think this question might be better handled there as well
    OC4J
    So in case you don't get an answer here on the forum, try it on the OC4J forum
    Frank

  • 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

  • Entity beans containing relationships to itself, Inherited Relationships

    The system i'm working on contains the following entities:
    Order
    OrderItem
    BillingOrder (extends the Order Entity and adds Billing-specific functionality mapped
    over 2 tables)
    BillingOrderItem (extends the OrderItem Entity and adds Billing-Item-specific functionality,
    mapped over 2 tables)
    If I could ask two questions about this scenario:
    1) The BillingOrder has a one-to-many relationship with BillingOrderItem. Currently
    I have had to define the relationship at this level, what i'd really like to be able
    to do is define this relationship at the Order-OrderItem level and have the Billing
    entities (plus the other Order-subtypes) inherit this relationship.
    2) The BillingOrderItem can form a hierarchy (ie can potentially have parent and
    child BillingOrderItems). Is it possible for an entity to be in a relationship with
    itself? In this case have a one-to-many relationship between the EntityKey PK of
    the BillingOrderItem and the ParentEntityKey CMP field contained within itself.
    (Hope that's explained clearly). Just as I type this, in respect to the first point
    I made, it would be great to again have this relationship defined at the Order-OrderItem
    level and be inherited by various subtypes.
    Any help/sample code/pointers would be greatly appreciated.
    Thanks in advance.

    jtahlborn wrote:
    i'm pretty sure we encountered problems trying to have the entity classes in a different jar from the persistence.xml. i think you need to have that stuff all packaged up together in order to get it to work. one common project is probably the way to go.Good point. Persistence unit A is certainly not going to know about the entities mapped in persistence unit B, so the mappings can't work. And unfortunately JBoss does not have facilities to share resources (only classpath elements if you turn off classpath isolation).
    You'd still be able to do a distributed design, but you'd need one common EJB that manages the model so you have all entities in one persistence unit. I'd say a DAO EJB layer would be justified in such a design scheme. So you'd have your services in your EJBs which will invoke DAO ejbs in your model-ejb to do the low level transactions.

  • EJB 3.0 question - saving an entity bean containing another entity bean

    Hi,
    First, I want to store an entity bean. Secondly, I want to store another entity bean - containing the first entity bean.
    I have the following code in a session bean for this:
    public void saveFeedScheduling(FeedScheduling feedScheduling, FeedSource feedSource) {
    FeedSource feeds = em.merge(feedSource);
    em.flush();
    feedScheduling.setFeedSource(feeds);
    FeedScheduling feedSched = em.merge(feedScheduling);
    em.flush();
    This seems to work fine - still, is this the proper way to do it?

    Hello,
    This kind of parameter can be specified using the relationship annotation.
    I'm not 100% sure, but, lok at the "cascade element".
    Regards,
    Sebastien Degardin

  • How can i convert the object to class~~~????

    recently i develop UML drawing tool for drawing UML diagram, i now design a program structure. now i have already defined many classes that represent each shape in UML. each class stores data of the related shape. then i use a vector to store all shape as follow;
    Vector shape = new Vector();
    shape.addElement(useCase); \\useCase is a Class i defined
    shape.addElement(actor);\\actor is a Class i defined
    now i want to use all shape's methods stored in the vector before how can i do that in general ways?
    i don't want to code like this;
    Object o = shape.elementAt(a);
    if (o instanceof UseCase)
    if (o instanceof Actor)
    because i have many classed!! can u all professional help me? i am just a beginer of java programming student

    Sounds like you need to use an inheritance structure...
    Setup a generic class that contains methods (probably blank) which each class (such as actor, useCase) will inherit from. Then make actor/useCase inherit from this base class and provide specific code in each of the general methods.
    Then when you retrieve your object from the class, you can cast it as your generic class and access the general methods without caring what the actual class is.
    Eg. Basic class "shape". has empty methods "draw" and "setPosition". Class "circle" and "square" both extend "shape" and provide specific implementations of setPosition and draw methods. You can then cast them as class type shape and do draw() and setPosition methods without caring about what type the object actually is.

  • How can I change a var in class C from class B if C and B are created in A?

    Hi!
    I have a little problem. It´s not really a Swing problem as you may believe by reading below, it´s about object creation.
    I have a JFrame class called TransactionDialog. The TransactionDialog contains a JPanel with a CardLayout.
    The CardLayout contains two components:
    1) JPanelStep1 (an own class that extends JPanel)
    2) JPanelStep2 (an own class that extends JPanel)
    I want a variable in JPanelStep2 to depend on what the user does in JPanelStep1.
    The question:
    Both the JPanelStep1 and JPanelStep2 objects are created in the TransactionDialog class. How can I call the JPanelStep2 object (which is created in TransactionDialog ) from JPanelStep1 if JPanelStep1 has to be created before JPanelStep2 in the TransactionDialog class?

    Jacobs has the right idea.
    If this variable is part of the SWING display, you can do it the quick and easy way by passing that display object to JPanelStep1 and allowing that panel to mutate the value.
    For instance:
    JPanelStep1 step1 = new JPanelStep1();
    JPanelStep2 step2 = new JPanelStep2();
    step1.setDependent(step2.getDependent());
    And the methods would be for example:
    void setDependent(JTextField field) {
    this.field = field;
    JTextField getDependent() {
    return field;
    And whenever the user interacts with JPanelStep1 and you want to alter the text as it displays in JPanelStep2 you just make a call in JPanelStep1 to:
    field.setText(updatedText);
    Do not forget though that if you do not have your MDT squared away, the update might not occur immediately, without calling to your JFrame or throwing a thread on the MDT with invokeAndWait()

  • 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

  • Class could not be loaded or is not an entity class

    Hello,
    I am using Berkeley DB JE 3.3.75 in a web application. I have a class which extends a Persistent class.
    @Entity
    public class XMessageInMemoryAdapter extends XMessage implements Serializable {
    private static final long serialVersionUID = 1L;
    @SecondaryKey(relate=Relationship.MANY_TO_ONE)
    private int objectStatus;
    @Persistent
    public class XMessage extends YMessage implements Serializable {
    private static final long serialVersionUID = 1L;
    @SecondaryKey(relate=Relationship.MANY_TO_ONE)
    private String serviceVariant;
    @Persistent
    public abstract class YMessage implements Serializable {
    private static final long serialVersionUID = 42L;
    @PrimaryKey
    private String messageGroupId;
    But when I try to query the PrimaryKey, an IllegalArgumentException is thrown:
    java.lang.IllegalArgumentException: Class could not be loaded or is not an entity class: com.mycompany.common.model.XMessageInMemoryAdapter
    at com.sleepycat.persist.impl.Store.checkEntityClass(Store.java:1175)
    at com.sleepycat.persist.impl.Store.getPrimaryIndex(Store.java:313)
    at com.sleepycat.persist.EntityStore.getPrimaryIndex(EntityStore.java:257)
    at com.mycompany.common.memorydb.impl.StoreRefImpl.queryPrimaryIndex(StoreRefImpl.java:49)
    at com.mycompany.common.memorydb.dao.MessageDao.init(MessageDao.java:67)
    And here is the MessageDao ve StoreRefImpl ( I deleted irrelevant parts )
    public class MessageDao {
         protected void init() {
              primaryKey = this.store.queryPrimaryIndex(String.class, XMessageInMemoryAdapter.class);
    public class StoreRefImpl {
         public PK queryPrimaryIndex(Class<?> indexClass, Class<?> objectClass) {
              try {
                   PrimaryIndex index = this.store.getPrimaryIndex(indexClass, objectClass); // this is where the exception is thrown
                   return new PKImpl(index);
              } catch (DatabaseException e) {
                   throw new DBException(e);
    Everything working nice in my local machine but when we deploy the application on test server we keep getting this exception.
    Thank you for your help.

    Hi Yusuf,
    This sounds like a classpath problem on your test server. This exception will occur if the class cannot be loaded.
    Please make sure that the je-3.3.75.jar file and your app classes or jar are in the same classpath location, and that there are not multiple copies in different locations. For example, if you're deploying a servlet, be sure to place the JE jar and your app jar in the same lib directory.
    --mark                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • I need get the class container name (Urgent)

    My class contain another inside, declared as variable.
    In the class declared as variable, can I get the class name of class that contains it?
    Is it possible?
    Thanks
    Renato de Melo

    I can't think of a good way of doing this, but here is a really kludgy one!
    within FieldClass, use getClass().getName(). This will return the full name of the class, and since this is an inner class, it will be "packagename.Container$FieldClass". All you then need to do is to find the substring between the last full-stop (period if you're American), and the $:
    String className = getClass().getName();
    int start = className.lastIndexOf('.') + 1;
    String containerName = className.substring( start, className.indexOf('$', start);HTH (and HTW - this is off the top of my head!)
    Robin

Maybe you are looking for

  • How do I query a SharePoint List using a url and filtering on date?

    I am reading a SharePoint list using jquery.  Everything is working fine except for the filter.  Each list item has an expiration date.  I want to retrieve JUST the items that have not expired (Expires > Today) but I can't figure out the url syntax a

  • Strange lines on iPhone 4 screen

    Basically, I grabbed my phone this morning and the screen was strange. Colour saturation was off, and it looked very low-resolution. Then a few moments later, a whole bunch of white and multi-coloured bars appeared on the screen. I can still operate

  • RSYNC.NLM causing a grief

    Hi, RSYNC.NLM seems to be the culprit in recent abends (03/12/2011, 11/12/2011 and 12/12/2011). I have listed server's OS details as shown below: ================================================== ==== Novell Open Enterprise Server, NetWare 6.5 Suppo

  • Skype versions: 6.18 but different chat layouts

    I have Skype for Windows version 6.18.0.106, a friend has Skype for Windows version 6.18.64.106. Both of us are told we have the latest version when we check for updates. Why is this? My friend sees a new UI with profile picture thuimbnails and ballo

  • Need help restoring AddressBook contacts (lost on sync with iphone)

    Hi, Just got a new iPhone 3GS, and have .mac. I had duplicate contacts in my iphone. To fix the problem, I deleted one of each, then synced my phone. I got the warning that 5% or more contacts would change, and continued (50% should change, based on