486 words

Posting to ObjectDB Website - Important Instructions

  • You must login to access this part of the site.
  • You must login to access this part of the site.

Please read the following instructions carefully - before posting to the ObjectDB website.

1. Where to Post

Almost everything should be posted to the ObjectDB Forum - and not as an help desk support ticket or as an issue.

The exceptions are:

  • Clear ObjectDB bugs, such as unexpected exception thrown by ObjectDB, e.g.  InternalException, NullPointerExceptionClassCastExceptionArrayIndexOfBoundsException, etc, which obviously require a fix (at least an improved error message) should be posted to the Issue Tracking system.
  • Feature requests may be posted to the Issue Tracking system (for better tracking), but only after discussing them first in the ObjectDB Forum.
  • Only non technical discussions that must remain private (e.g. special licensing topics) should be posted as Help desk support tickets - unless priority private support is purchased.

ObjectDB Software reserves the right to modify, delete or move any post at its sole discretion.

2. Content and Readability

To keep your post readable:

  • Create a separate thread with a descriptive title for every topic (avoid multiple unrelated topics in one post).
  • If an exception is thrown post the stack trace rather than just the error message.
  • Use appropriate styles for formatted lines (Java code, stack trace, query, console/shell input and output).
    Your published Java code should be formatted as the sample code at the bottom of this page.
  • Avoid overflow of published source code examples by breaking long lines.
  • Long stack traces (> 50 lines) and complex source examples (> 100 lines) should be posted as attachments.

3. Sample Code

To demonstrate a technical question or an issue - you may have to provide a complete runnable sample program.

If an unexpected exception (e.g. NullPointerException or ClassCastException) is thrown by ObjectDB - posting the full stack trace with no sample program (using the Issue Tracking system) may be sufficient to locate the problem. In most other cases - a sample program may be required.

Whenever possible:

  • Use a single Java file with one main class + static inner classes for entity / embeddable classes.
  • Avoid dependency on external libraries.
  • Use a console application with a main method (preferred over JUnit).
  • Use embedded mode to connect to the ObjectDB database directly (no persistence unit).
  • Keep the test as simple as possible - remove unnecessary code (but keep it complete and runnable).

You may use the following example as an initial template for your test case:

package test;
 
import java.util.*;
import javax.persistence.*;
 
 
public final class MyTestCase {
 
    public static void main(String[] args)  {
        EntityManagerFactory emf =
            Persistence.createEntityManagerFactory(
                "objectdb:$objectdb/db/test.tmp;drop");
        EntityManager em = emf.createEntityManager();
 
        em.getTransaction().begin();
        MyEntity e = new MyEntity("test");
        em.persist(e);
        em.getTransaction().commit();
 
        Query query = em.createQuery("SELECT e FROM MyEntity e");
        List resultList = query.getResultList();
        System.out.println(resultList);
 
        em.close();
        emf.close();
    }
 
    @Entity
    public static class MyEntity {
        private String name;
        MyEntity(String name) {
            this.name = name;
        }
        @Override
        public String toString() {
            return name;
        }
    }
}

Note: If you are using NetBeans please ignore its strict JPA warnings (There is no ID defined for this entity hierarchy, The class should have a no-arg public or protected constructor, An entity class must be a top level class, The project does not contain a persistence unit, An entity or IdClass class should implement the java.io.Serializable interface).