EclipseLink, JPA, generic entity + SINGLE_TABLE legacy

I was wondering if it is possible in JPA to define a generic entity as in my case PropertyBase < T > and derive concrete entity like ShortProperty and string classes and use with legacy SINGLE_TABLE mode? If I try to instances of ElementModel commit newly created (see ElementModelTest) on the EntityManager I always get a NumberFormatException this 'value' cannot be successfully converted to a short. Curiously, if I define all the classes below as my test case class 'ElementModelTest' static inner classes, it seems to work. Any ideas that I need to change to make it work?

I use EclipseLink eclipselink - 2.6.0.v20131019 - ef98e5d.

public abstract class PersistableObject
    implements Serializable {

    private static final long serialVersionUID = 1L;

    private String id = UUID.randomUUID().toString();

    private Long version;

    public PersistableObject() {
           this(serialVersionUID);
    }

    public PersistableObject(final Long paramVersion) {
          version = paramVersion;
    }

    public String getId() {
 return id;
    }

    public void setId(final String paramId) {
  id = paramId;
    }

    public Long getVersion() {
 return version;
    }
    public void setVersion(final Long paramVersion) {
  version = paramVersion;
    }

    public String toString() {
  return this.getClass().getName() + "[id=" + id + "]";
    }

}

public abstract class PropertyBase<T> extends PersistableObject {

    private static final long serialVersionUID = 1L;

    private String name;
    private T value;

    public PropertyBase() {
 this(serialVersionUID);
    }

    public PropertyBase(final Long paramVersion) {
  this(paramVersion, null);
    }

    public PropertyBase(final Long paramVersion, final String paramName) {
  this(paramVersion, paramName, null);
    }

    public PropertyBase(final Long paramVersion, final String paramName, final T paramValue) {
  super(paramVersion);
  name = paramName;
  value = paramValue;
    }

    public String getName() {
 return name;
    }

    public void setName(final String paramName) {
  name = paramName;
    }

    public T getValue() {
 return value;
    }

    public void setValue(final T paramValue) {
  value = paramValue;
    }

}

public class ShortProperty extends PropertyBase<Short> {

    private static final long serialVersionUID = 1L;

    public ShortProperty() {
 this(null, null);
    }

    public ShortProperty(final String paramName) {
  this(paramName, null);
    }

    public ShortProperty(final String paramName, final Short paramValue) {
  super(serialVersionUID, paramName, paramValue);
    }

}

public class StringProperty extends PropertyBase<String> {

    private static final long serialVersionUID = 1L;

    protected StringProperty() {
 this(null, null);
    }

    public StringProperty(final String paramName) {
  this(paramName, null);
    }

    public StringProperty(final String paramName, final String paramValue) {
  super(serialVersionUID, paramName, paramValue);
    }

}

public class ElementModel extends PersistableObject {

    private static final long serialVersionUID = 1L;

    private StringProperty name = new StringProperty("name");
    private ShortProperty number = new ShortProperty("number");

    public ElementModel() {
 this(serialVersionUID);
    }

    public ElementModel(final Long paramVersion) {
  super(paramVersion);
    }

    public String getName() {
  return name.getValue();
    }

    public void setName(final String paramName) {
  name.setValue(paramName);
    }

    public Short getNumber() {
  return number.getValue();
    }

    public void setNumber(final Short paramNumber) {
  number.setValue(paramNumber);
    }


}

<?xml version="1.0" encoding="UTF-8" ?>
<entity-mappings version="2.1"
 xmlns="http://xmlns.jcp.org/xml/ns/persistence/orm" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence/orm http://xmlns.jcp.org/xml/ns/persistence/orm_2_1.xsd">

 <mapped-superclass
  class="PersistableObject">
  <attributes>
  <id name="id">
  <column name="id" />
  </id>
  <version name="version" access="PROPERTY">
  <column name="version" />
  </version>
  </attributes>
 </mapped-superclass>

 <entity class="PropertyBase">
  <table name="PropertyBase" />
  <inheritance />
  <discriminator-column name="type"/>
  <attributes>
  <basic name="name">
  <column name="name" />
  </basic>
  <basic name="value">
  <column name="value" />
  </basic>
  </attributes>
 </entity>

 <entity class="StringProperty">
  <discriminator-value>StringProperty</discriminator-value>
 </entity>

 <entity class="ShortProperty">
  <discriminator-value>ShortProperty</discriminator-value>
 </entity>

 <entity class="ElementModel">
  <table name="ElementModel" />
  <inheritance />
  <discriminator-column name="type"/>
  <attributes>
  <one-to-one name="name">
  <join-column name="name" referenced-column-name="id" />
  <cascade>
  <cascade-all />
  </cascade>
  </one-to-one>
  <one-to-one name="number">
  <join-column name="number" referenced-column-name="id" />
  <cascade>
  <cascade-all />
  </cascade>
  </one-to-one>
  </attributes>
 </entity>
</entity-mappings>


public class ElementModelTest extends ModelTest<ElementModel> {

    public ElementModelTest() {
  super(ElementModel.class);
    }

    @Test
    @SuppressWarnings("unchecked")
    public void testSQLPersistence() {

  final String PERSISTENCE_UNIT_NAME = getClass().getPackage().getName();
  new File("res/db/test/" + PERSISTENCE_UNIT_NAME + ".sqlite").delete();

  EntityManagerFactory factory = Persistence.createEntityManagerFactory(PERSISTENCE_UNIT_NAME);
  EntityManager em = factory.createEntityManager();

  Query q = em.createQuery("select m from ElementModel m");
  List<ElementModel> modelList = q.getResultList();
  int originalSize = modelList.size();

  for (ElementModel model : modelList) {
      System.out.println("name: " + model.getName());
  }

  System.out.println("size before insert: " + modelList.size());

  em.getTransaction().begin();

  for (int i = 0; i < 10; ++i) {
      ElementModel device = new ElementModel();
      device.setName("ElementModel: " + i);
    device.setNumber((short) i);
      em.persist(device);
  }

  em.getTransaction().commit();

  modelList = q.getResultList();
  System.out.println("size after insert: " + modelList.size());

  assertTrue(modelList.size() == (originalSize + 10));

  em.close();

    }

}


He replied by a cross post here java - EclipseLink, JPA, generic entity + SINGLE_TABLE legacy - Stack Overflow

Short answer: no, it should not run because the underlying database field type would be constant.  If the chain or the short would have conversion problems in the type of database, they both put in correspondence in the same field in table.

Tags: Fusion Middleware

Similar Questions

  • How to use Oracle Virtual Private Database (VPD) with EclipseLink JPA

    My project is obliged to use VPD in database to isolate access to data according to different user type. How can I use EclipseLink JPA with CAE? For example, how could I configure the server context of database for each database session? Thanks for any help.

    There is some information about the authentication proxy Oracle here,

    http://wiki.Eclipse.org/EclipseLink/examples/JPA/Oracle/proxy

    Use EVP would be very similar.

    ---
    James: http://www.eclipselink.org: http://en.wikibooks.org/wiki/Java_Persistence

  • Using Eclipselink/JPA in my StreamSink

    Hello

    I'm trying to persist my events in the database using Eclipselink. I got my persistence.xml in the META-INF folder and my class of the event is fully annotated with JPA annotations, and I have the code below in my StreamSink:

    Public Sub onInsertEvent (event Object) get {EventRejectedException}
    If (event instanceof Nsnincat) {}
    If (em == null) {}
    em = Persistence.createEntityManagerFactory("JPA").createEntityManager ();
    }
    em.getTransaction () .begin ();
    EM. Persist ((Nsnincat) Event);
    em.getTransaction () .commit ();
    } else {}
    System.Err.println ("@ no object not instanceof Nsnincat!");
    }
    }

    However, I get the below exception when I deployed my EPN in the server of the CEP:

    < December 1, 2010 13:24:47 SGT > < WARNING > < Ede > < BEA-000000 > < Exception for "com.nsn.cvo.jpa.Nsnincat@5f50d1f" raised by the listener = com.nsn.cvo.eventsink.DbSink@86301e3
    javax.persistence.PersistenceException: no persistence EntityManager for provider named JPA
    at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:84)
    at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:54)
    at com.nsn.cvo.eventsink.DbSink.onInsertEvent(DbSink.java:19)

    I also already put the JPA and Eclipselink jars inside the server (in my case C:\Oracle\Middleware\oracle_cep_11.1.1.4\user_projects\domains\ocep_domain1\defaultserver\modules\ext) and set it in the 'Oracle CEP Application Library Path' in my Eclipse.

    Can someone help me why I get this exception. It seems to me that the CEP server cannot detect the persistence.xml. Any help will be greatly appreciated.

    Thank you
    Aurelio Jr. Pascual

    Aurelio,

    I tested this out with server PART. http://blogs.Oracle.com/CEP/2011/01/using_eclipselink_from_ocep.html has instructions on how to do it.

    Manju.

  • Check that this class has been marked with the annotation @Entity

    Hello


    We have a level of the shared lib App that makes all the APP associated with request for an application. And each application can use the lib goes to get the related JPA query to do.
    To define the scope of the Joint Parliamentary Assembly between App. We have created the EMF for each application.

    When an application to run and any associated APP action that it works fine, but when trying to run a second application we are seeing the following error message when you try to do a specific action JPA.


    the @Entity annotation.
    [2012 05-23 T 04: 08:16.839 - 07:00] [WC_Spaces] [ERROR] [] [oracle.webcenter.spaces] [tid: [ASSETS].] [ExecuteThread: '3' for the queue: "(self-adjusting) weblogic.kernel.Default"] [ecid: 5825b814-2931-4ad5-8dc3-3e18f66992b7-00000004,0] [APP: webcenterCustom] []
    java.lang.IllegalArgumentException: unknown entity bean class: oracle.webcenter.spaces.internal.repository.WcSpaceHeader class, please check that this class has been marked with the @Entity annotation.
    at org.eclipse.persistence.internal.jpa.EntityManagerImpl.find(EntityManagerImpl.java:648)
    at org.eclipse.persistence.internal.jpa.EntityManagerImpl.find(EntityManagerImpl.java:532)
    at oracle.webcenter.spaces.internal.repository.SpaceRepositoryUtils.refreshSpaceRows(SpaceRepositoryUtils.java:1791)


    Where WcSpaceHeader is an entity.

    To create emf by App, this is the code


    private static EntityManagerFactory getEntityManagerFactory()
    {
    String appName = Utility.getApplicationName ();
    EntityManagerFactory emf = sEntityMgrFactory.get (appName);

    if(EMF==null)
    {
    EMF = Persistence.createEntityManagerFactory ("SpacesReposPUnit");
    sEntityMgrFactory.put (appName, emf);
    SpacesConstants.LOGGER.info ("Caching" +)
    ("EMF for" + appName);
    }

    return of the emf;
    }



    My persistence.xml

    <? XML version = "1.0" encoding = "US-ASCII"? >
    < persistence xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance".
    xsi: schemaLocation = "http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd".
    version = "1.0" xmlns = "http://java.sun.com/xml/ns/persistence" >
    < name of persistence - unit = "SpacesReposPUnit" transaction-type = "RESOURCE_LOCAL" >
    <>provider
    org.eclipse.persistence.jpa.PersistenceProvider
    < / provider >
    oracle.webcenter.spaces.internal.repository.WcSpaceHeader < class > < / class >
    oracle.webcenter.spaces.internal.repository.WcSpaceUsrDetail < class > < / class >
    oracle.webcenter.framework.service.jpa.WcCommonXlationEntity < class > < / class >
    oracle.webcenter.spaces.internal.repository.WCNavigationActivity < class > < / class >
    Properties of <>
    < name = "eclipselink.session.customizer property"
    value="Oracle.WebCenter.spaces.internal.repository.SpacesEclipselinkSessionCustomizer"/ >
    < / properties >
    < / persistence - unit >
    < / persistence >



    Another problem I see in this is that. When I create an EMF EM, (which is different for different app) and do a query, I get a class cast Exception.


    [(self-adjusting)'] [ecid: 5825b814-2931-4ad5-8dc3-3e18f66992b7-00000004,0] [APP: webcenterCustom] []
    java.lang.IllegalArgumentException: unknown entity bean class: oracle.webcenter.spaces.internal.repository.WcSpaceHeader class, please check that this class has been marked with the @Entity annotation.
    at org.eclipse.persistence.internal.jpa.EntityManagerImpl.find(EntityManagerImpl.java:648)
    at org.eclipse.persistence.internal.jpa.EntityManagerImpl.find(EntityManagerImpl.java:532)

    It is a problem of class loader, somehow you have deployed the same classes in two places, have two versions of the classes.

    How, exactly made things, where are your domain classes?

    The questions is more likely that,
    Persistence.createEntityManagerFactory ("SpacesReposPUnit");
    always returns the same plant once it has been deployed.

    If you pass a map properties for createEntityManagerFactory and set the property "name eclipselink.session" a single value, then you should get a new plant.

  • JPA 2.0 EntityManager.find method

    According to the documentation, 2.0 as OpenJPA and EclipseLink JPA implementations cannot accept a second parameter of type java.lang.Object primaryKey so use the EntityManager.find method.

    Could someone pass a string as the second parameter? I'm interested to know if this is possible.

    The type must match what you have marked as the @Id in your entity; The id field is of type String, you should be able to pass a string to the find() method.

    I'm interested to know if this is possible.

    You know the best way to know is to try. If you want to test things with JPA could benefit to look at a Java database pure HypersonicSQL. This way you can quickly set up a database environment without the need of additional software, and more with for example feature automatic generation of development into hibernation, you can leave the database itself come from your JPA entities. Database unit tests are so very quick and easy.

  • last paintings when try to use app

    I try to use jpa, why the data in my delete to get table, when I delete a class entity he drop of auto event table, why? I have create a match of one entity class column in mytable (before I have 8 columns) after I restore my project then my mytable get auto change and turn to a single column?

    Hello

    It happens because you set the property of eclipselink.ddl - generation of drop-and-create-tables, saying to drop and then re-create the tables each time you start/redeploy the application. It is a feature to contribute to development when modify you entities and therefore need to delete the previous tables so that they can be recreated with new fields. Your table could have only a field because the entity corresponding to the table only has a mapped field.
    That is to say, check your persistence.xml for

    See http://wiki.eclipse.org/Using_EclipseLink_JPA_Extensions _ (ELUG) #Using_EclipseLink_JPA_Extensions_for_Schema_Generation for more information on the different options of EclipseLink JPA.

    Best regards
    Chris

  • Support for JDBC in EPCO control

    EPCO has control JDBC support? When I used the workshop for Weblogic, it was pretty easy generate automatically in the code to create a JDBC control, such as "with the right button on the Java package name, then click New JDBC control". Also once you had created the control JDBC you can then simply right click in the Java source code in the editor and then click on "Insert control JDBC" to automatically insert a reference to the JDBC control.

    If someone could point me to a tutorial that explains how it works now in EPCO would be great. Thank you!

    Neal

    The concept of 'control' is a feature of Apache Beehive. Support for Apache Beehive has been deprecated by Oracle. It is only available in the legacy workshop product, but not in EPCO.

    To use a more modern technology, see specifying such JPA implemented by TopLink/EclipseLink. More resources:

    http://www.Eclipse.org/EclipseLink/JPA.php

    -Konstantin

  • With the persistence provider, why there is still need of so much manual effort?

    With persistence provider (EclipseLink), why there are still need so much manual effort in the following example shows how?
    Done following manual effort necessary to the app using EclipseLink?
    If the answer is Yes, the EclipseLink do for us?
    The following content is from this link: http://wiki.eclipse.org/EclipseLink/Examples/JPA/JSF_Tutorial

    _ Using JPA to implement Service

    The main resource to manage the UI tutorial is org.eclipse.persistence.jpa.example.inventory.ui.InventoryManagerBean. It contains a reference to the following classes that use APP to implement the services provided by this application:

    * org.eclipse.persistence.jpa.example.inventory.services.impl.ManagedOrderBean (implements org.eclipse.persistence.jpa.example.inventory.services.OrderService)
    * org.eclipse.persistence.jpa.example.inventory.services.impl.ManagedInventoryBean (implements org.eclipse.persistence.jpa.example.inventory.services.InventoryService)

    These two classes show how to use APP:

    Acquisition of an entity manager factory
    Create the entity
    * Read an entity
    * Update an entity
    Delete the entity


    Acquire a factory manager of the entity

    The ManagedOrderBean and the ManagedInventoryBean use an instance of org.eclipse.persistence.jpa.example.inventory.services.impl.JPAResourceBean class assistance to get an instance of the entity manager factory for the default named persistence unit that we have defined in the file persistence.xml (see Configuration of the persistence unit). This example shows how the entity manager factory is acquired.

    Acquisition of the managing body of the
    public EntityManagerFactory getEMF (){
        if (emf == null){
            emf = Persistence.createEntityManagerFactory("default");
        }
        return emf;
    }
    Once acquired, the ManagedOrderBean and ManagedInventoryBean classes use the entity manager factory to obtain an entity manager to perform all basic persistence operations (create, read, update and delete).


    Create an entity

    This example shows how the ManagedOrderBean using the EntityManager to create a new entity of the order.

    Creating a command in ManagedOrderBean
    public void  createNewOrder(Order order){
        EntityManager em = jpaResourceBean.getEMF().createEntityManager();
        try{
            em.getTransaction().begin();
            em.persist(order);
            em.getTransaction().commit();
        }finally{
            em.close();
        }
    }
    ...

    Hello
    If you are using an IDE like Eclipse 3.5, JDeveloper 11.1.1.1 or NetBeans 6.8M1 - EAR project assistants it will generate more all for you when you select the EclipseLink JPA default persistence provider.
    Also, try the other tutorial JPA JSF - no based which shows the minimum get a compatible standard injected JEE EM using a JTA data source in a stateless session bean used by a customer of controller simple servlet. There are versions of this example for all major application servers using Oracle or Derby as a database.
    http://wiki.Eclipse.org/EclipseLink/examples/JPA/WebLogic_Web_Tutorial
    All tutorials EE and SE
    http://wiki.Eclipse.org/EclipseLink/examples/JPA

    All Tomcat base JPA tutorial will be a little more complex because Tomcat is not an EE real container - it only implements a web container with support for JTA datasource and lack of support for a managed container of JPA persistence context (so no injection of @PersistenceUnit EMF - it uses the class persistence bootstrap instead). That is why transactions and lifecycle States EM/EMF must be managed by the application and not transparently via default values annotation as a full EA server would be for you in GlassFish, JBoss, WebSphere, WebLogic and OC4J for example - tutorials for these EA servers are simpler.

    Thank you
    /Michael
    http://www.EclipseLink.org

  • stuck FPGA compilation, no errors

    Hello

    I wrote a LabVIEW FPGA 8.6.1 program (I have written several, this is my most recent). When I run it on the development computer it seems to work fine without any errors. When I try to compile, however, it still stalls on this part:

    'Analysis of generic entity library ( Architecture).

    This isn't feeze (the compiler is always updated time and you can see it working). It just doesn't progress no further than this point. By chance, does anyone know what could cause this? I know that maybe it's a little vague, sorry. Thank you!

    Nevermind, I figured it. I had a knot of analog input within a For loop. This wire entry (i.e. given out the analog input node) was connected to a tunnel auto-index on the loop For I have just disabled automatic indexing on this tunnel and everything seems to compile fine now.

  • VRA unable to create groups of companies with the same name in different tenants with vRO

    vRA 6.2.2 Build - 2754020

    vRO 6.0.1

    Through the vRA GUI I can create groups of companies with the same names in different tenants as follows:

    Tenant1: BusGroup1, BusGroup2, BusGroup3

    Tenant2: BusGroup1, BusGroup2, BusGroup3


    However, to create business groups with the same names in different tenants via the vRO, specifically the workflow plugin Library / vCloud Automation Center / Administration / Business groups / create a group of companies, fails in the second tenant with the below error:


    [42106] the specified condition is not respected for 'name '. (Name of the dynamic Script Module: createBusinessGroup #12)

    If I change the naming convention to be different by tenant, then I have no problem. I thought it might be a restriction in the product, but as said I was able to create with the names of same origin through the user interface.

    Anyone experience the same thing?

    This is a known problem within IaaS API the plugin vRO uses to manage groups of companies through business groups workflows. You don't have the same problem of the vRA UI because the user interface (according to the 6.x) does not use the same API IaaS to manage groups of companies.

    The only alternative to 6.x for now is to directly use the helper generic entity Manager plug-in itself. You can take a look at the first example in example CRUD Infrastructure tasks management Scripts.

    I hope it helps.

    Sergio

  • [Error running javafx jnlp to the browser app: CacheEntry[file:/C:/Desenv/Projetos/workspace_beta02/Tedros-Box/dist/lib/Tedros-Core-EjbClient.jar]: updateAvailable = false, lastModified = Thu Dec 12 20:23:13 BRST 2013, length = 5185

    Can someone help me with this problem?

    I use netbeans 7.4 to build and launch my javafx application, the application works fine running on desktop, but when I try in chrome/firefox or ie browser I the erros below.

    PS: all the jar are signed and all permissions are granted.

    Thank you very much!

    Davis

    ****

    10.45.2.18 make Java plug-in

    Using a versão 1.7.0_45 - b18 JRE Java hotspot Client VM

    Diretorio House usuario = C:\Users\Davis Gordon

    ----------------------------------------------------

    c: limpar Alana console

    f: concluir objetos da fila continues

    g: lixo coleta

    h: exibir mensagem ajuda esta

    l: descartar lista carregadores classes

    m: print memoria uso

    o: trigger Journal

    q: ocultar console

    r: recarregar configuracao da politica

    s: descartar propriedades e sistema of settlements

    t: descartar lista threads

    v: descartar do son

    x: Limpar cache classes carregador

    0-5: define nivel fertilizacion como < n >

    ----------------------------------------------------

    CacheEntry[file:/C:/Desenv/Projetos/workspace_beta02/Tedros-Box/dist/lib/Tedros-Core-EjbClient.jar]: updateAvailable = false, lastModified = Thu Dec 12 20:23:13 BRST 2013, length = 5185

    CacheEntry[file:/C:/Desenv/Projetos/workspace_beta02/Tedros-Box/dist/lib/Tedros-App-API.jar]: updateAvailable = false, lastModified = Thu Dec 12 20:23:13 BRST 2013, length = 116706

    CacheEntry[file:/C:/Desenv/Projetos/workspace_beta02/Tedros-Box/dist/lib/App-Painel-Controle.jar]: updateAvailable = false, lastModified = Thu Dec 12 20:23:13 BRST 2013, length = 141981

    CacheEntry[file:/C:/Desenv/Projetos/workspace_beta02/Tedros-Box/dist/Tedros-Box.jar]: updateAvailable = false, lastModified = Thu Dec 12 20:23:13 BRST 2013, length = 200921

    CacheEntry[file:/C:/Desenv/Projetos/workspace_beta02/Tedros-Box/dist/lib/Tedros-Core-Model.jar]: updateAvailable = false, lastModified = Thu Dec 12 20:23:13 BRST 2013, length = 47516

    CacheEntry[file:/C:/Desenv/Projetos/workspace_beta02/Tedros-Box/dist/lib/Tedros-Core.jar]: updateAvailable = false, lastModified = Thu Dec 12 20:23:13 BRST 2013, length = 108000

    CacheEntry[file:/C:/Desenv/Projetos/workspace_beta02/Tedros-Box/dist/lib/Tedros-DataAccess-Model-API.jar]: updateAvailable = false, lastModified = Thu Dec 12 20:23:13 BRST 2013, length = 13588

    CacheEntry[file:/C:/Desenv/Projetos/workspace_beta02/Tedros-Box/dist/lib/Tedros-DataAccess-Server-API.jar]: updateAvailable = false, lastModified = Thu Dec 12 20:23:13 BRST 2013, length = 32124

    CacheEntry[file:/C:/Desenv/Projetos/workspace_beta02/Tedros-Box/dist/lib/Tedros-Exception.jar]: updateAvailable = false, lastModified = Thu Dec 12 20:23:13 BRST 2013, length = 2624

    CacheEntry[file:/C:/Desenv/Projetos/workspace_beta02/Tedros-Box/dist/lib/Tedros-Util.jar]: updateAvailable = false, lastModified = Thu Dec 12 20:23:14 BRST 2013, length = 15348

    CacheEntry[file:/C:/Desenv/Projetos/workspace_beta02/Tedros-Box/dist/lib/Tedros-FXComponents.jar]: updateAvailable = false, lastModified = Thu Dec 12 20:23:14 BRST 2013, length = 282972

    CacheEntry[file:/C:/Desenv/Projetos/workspace_beta02/Tedros-Box/dist/lib/commons-collections-3.2.1.jar]: updateAvailable = false, lastModified = Thu Dec 12 20:23:14 BRST 2013, length = 583672

    CacheEntry[file:/C:/Desenv/Projetos/workspace_beta02/Tedros-Box/dist/lib/eclipselink-jpa-modelgen_2.4.1.v20121003-ad44345.jar]: updateAvailable = false, lastModified = Thu Dec 12 20:23:14 BRST 2013, length = 12387

    CacheEntry[file:/C:/Desenv/Projetos/workspace_beta02/Tedros-Box/dist/lib/commons-lang3-3.1.jar]: updateAvailable = false, lastModified = Thu Dec 12 20:23:14 BRST 2013, length = 319222

    CacheEntry[file:/C:/Desenv/Projetos/workspace_beta02/Tedros-Box/dist/lib/javax.persistence_2.0.4.v201112161009.jar]: updateAvailable = false, lastModified = Thu Dec 12 20:23:20 BRST 2013, length = 128747

    CacheEntry[file:/C:/Desenv/Projetos/workspace_beta02/Tedros-Box/dist/lib/jfxrt.jar]: updateAvailable = false, lastModified = Thu Dec 12 20:23:23 BRST 2013, length = 15117378

    CacheEntry[file:/C:/Desenv/Projetos/workspace_beta02/Tedros-Box/dist/lib/openejb-client-4.5.2.jar]: updateAvailable = false, lastModified = Thu Dec 12 20:23:23 BRST 2013, length = 318492

    CacheEntry[file:/C:/Desenv/Projetos/workspace_beta02/Tedros-Box/dist/lib/javaee-api-6.0-5.jar]: updateAvailable = false, lastModified = Thu Dec 12 20:23:20 BRST 2013, length = 989597

    CacheEntry[file:/C:/Desenv/Projetos/workspace_beta02/Tedros-Box/dist/lib/org.eclipse.persistence.jpars.source_2.4.1.v20121003-ad44345.jar]: updateAvailable = false, lastModified = Thu Dec 12 20:23:23 BRST 2013, length = 65144

    CacheEntry[file:/C:/Desenv/Projetos/workspace_beta02/Tedros-Box/dist/lib/spring-beans-3.0.7.RELEASE.jar]: updateAvailable = false, lastModified = Thu Dec 12 20:23:23 BRST 2013, length = 563508

    CacheEntry[file:/C:/Desenv/Projetos/workspace_beta02/Tedros-Box/dist/lib/org.eclipse.persistence.jpars_2.4.1.v20121003-ad44345.jar]: updateAvailable = false, lastModified = Thu Dec 12 20:23:23 BRST 2013, length = 93694

    CacheEntry[file:/C:/Desenv/Projetos/workspace_beta02/Tedros-Box/dist/lib/eclipselink.jar]: updateAvailable = false, lastModified = Thu Dec 12 20:23:19 BRST 2013, length = 8449501

    ***************

    JNLP

    ***************

    <? XML version = "1.0" encoding = "utf-8"? >

    " < jnlp spec ="1.0"xmlns:jfx =" http://JavaFX.com "href =" Tedros - Box.jnlp "> "

    < information >

    < title > Tedros-Box < /title >

    < vendor name > Gordon Davis < / seller >

    value null < description > < / description >

    < offline permitted / >

    < / information >

    < resources >

    " < jfx:javafx - runtime version ="2.2 +"href =" http://javadl.Sun.com/webapps/download/GetFile/JavaFX-latest/Windows-i586/javafx2.JNLP "/ > "

    < / resource >

    < resources >

    " < j2se version = '1.6 +' href = ' http://Java.Sun.com/products/AutoDL/J2SE "/>

    < jar href = "Tedros - Box.jar" size = '200921' download 'impatient' = / >

    < jar href = "lib/App-message - Controle.jar" size = "141981" download = "eager" / >

    < jar href = ' lib/Tedros-App - API.jar' size = '116706' download 'impatient' = / >

    < jar href = "lib/Tedros-Core - EjbClient.jar" size = '5185' download 'impatient' = / >

    < jar href = ' lib/Tedros-Core - Model .jar' size = '47516' download 'impatient' = / >

    < jar href = ' lib/Tedros-Core' size = '108000' download 'impatient' = / >

    < jar href = ' lib/Tedros-DataAccess-model - API.jar' size = '13588' download 'impatient' = / >

    < jar href = ' lib/Tedros-DataAccess-Server - API.jar' size = '32124' download 'impatient' = / >

    < jar href = "lib/Tedros - Exception.jar" size = "2624" download = "forward" / >

    < jar href = "lib/Tedros - FXComponents.jar" size = "282972" download = "eager" / >

    < jar href = ' lib/Tedros - Util.jar' size = '15348' download 'impatient' = / >

    "< jar href="lib/commons-collections-3.2.1.jar ' size = download "583672" = "forward" / >

    "< jar href="lib/commons-lang3-3.1.jar ' size = tΘlΘchargement "319222" = "forward" / >

    "< jar href="lib/eclipselink-jpa-modelgen_2.4.1.v20121003-ad44345.jar ' size = tΘlΘchargement "12387" = "forward" / >

    < jar href = "lib/eclipselink.jar' size = download"8449501"="forward"/ >"

    "< jar href="lib/javaee-api-6.0-5.jar ' size = download "989597" = "forward" / >

    "< jar href="lib/javax.persistence_2.0.4.v201112161009.jar ' size = download "128747" = "forward" / >

    < jar href = "lib/jfxrt.jar' size = download"15117378"="forward"/ >"

    "< jar href="lib/openejb-client-4.5.2.jar ' size = download "318492" = "forward" / >

    "< jar href="lib/org.eclipse.persistence.jpars.source_2.4.1.v20121003-ad44345.jar ' size = tΘlΘchargement "65144" = "forward" / >

    "< jar href="lib/org.eclipse.persistence.jpars_2.4.1.v20121003-ad44345.jar ' size = tΘlΘchargement "93694" = "forward" / >

    "< jar href="lib/spring-beans-3.0.7.RELEASE.jar ' size = download "563508" = "forward" / >

    < / resource >

    < security >

    < all-permissions / >

    < / security >

    < width applet-desc = "1280" height = "760" hand-class = "com.javafx.main.NoJavaFXFallback" name = "Tedros-Box" >

    < param name = "requiredFXVersion" value = "2.2 +" / >

    < / applet-desc >

    < jfx:javafx - width desc = "1280" height = "760" hand-class = "com.tedros.Tedros" name = "Tedros-Box" / >

    < audit update 'always' = policy = "always" / >

    < / jnlp >

    I could be wrong, but I don't think that these are not errors. They just say you whence your jar files. In your case, they just cached entries. You probably want to clear your cache. I do this by running javaws - uninstall and then javaws - clearcache

  • Best practices for JTables.

    Hello



    I'm programming in Java since 5 months ago. Now I am developing an application that uses charts to present information to a database. This is my first time manipulation of tables in Java. I read the tutorial Swing of the Sun on JTable and more information on other sites, but they are limited to the syntax of the table and not in best practices.



    So I decided what I think is a good way to manage data in a table, but I don't know which is the best way. Let me tell you the General steps that I'm going through:



    (1) I query the data from the employee of Java DB (with EclipseLink JPA) and load it into an ArrayList.

    (2) I use this list to create the JTable, prior transformation to an Object [] [] and it fuels a custom TableModel.

    (3) thereafter, if I need to get something on the table, I search on the list and then with the index resulting from it, I get it from the table. This is possible because I keep the same order of the rows on the table and on the list.

    (4) if I need to put something on the table, I do also on my list, and so on if I need to remove or edit an item.



    Is the technique that I use a best practice? I'm not sure that duty always synchronized table with the list is the best way to handle this, but I don't know how I would deal with comes with the table, for example to effectively find an item or to sort the array, without first on a list.



    Are there best practices in dealing with tables?



    Thank you!

    Francisco.

    You should never list directly update, wait for when you first create the list and add it to the TableModel. All future updates must be performed on the TableModel directly.

    See the [http://www.camick.com/java/blog.html?name=row-table-model url] Table of line by a model example of this approach. Also, follow the link BeanTableModel for a more complete example.

  • OpenJPA plugin for Eclipse?

    Hi all

    Is there a plugin for Eclipse OpenJPA? I so, what is its role, and it is available for Eclipse 3.2.2 version?

    Thank you.

    Hello
    Here are some links to information.
    To get more simple examples not related to a specific EE application server - you can see the examples of the JPA and Eclipse JPA SE project that performs a simple query and insert after completing the automatic DDL generation.
    http://dev.Eclipse.org/svnroot/RT/org.Eclipse.persistence/trunk/examples/org.Eclipse.persistence.example.JPA.Server.common.ddlgen/

    EclipseLink is the reference implementation of JPA 2.0 (RI) for JSR-317 (part of the EJB 3.1), announced the 20080317 and the SUN GlassFish Application Server V3.
    http://www.Eclipse.org/org/press-release/20080317_Eclipselink.php
    http://blogs.Sun.com/theaquarium/entry/eclipselink_in_glassfish_v3_as
    EclipseLink is the reference for the Dali JPA Tools of Eclipse.org project persistence provider
    http://wiki.Eclipse.org/Dali
    Oracle Enterprise Pack for Eclipse 11g supports Oracle TopLink with EclipseLink JPA provider.
    http://blogs.Oracle.com/devtools/2009/03/oracle_enterprise_pack_for_ecl_1.html
    EclipseLink (TopLink donate) open source for 2 years and had 2 major versions 1.0 and 1.1, and is almost version 2.0 - the provider in TopLink JPA is EclipseLink.
    http://www.Oracle.com/corporate/press/2007_mar/opensource-TopLink.html
    EclipseLink provides extensions to the JPA 1.0 and 2.0 API standard such as performance optimization.
    http://wiki.Eclipse.org/EclipseLink/performance
    EclipseLink contains RI ODS 2.1.1 JSR - 235 (provide seamless integration SCA)
    http://JCP.org/en/JSR/detail?ID=235
    EclipseLink was supported by the Spring framework since 2.5.2 in March 2008 (1.0M4)
    http://www.SpringSource.org/node/601

    OpenJPA/Kodo links:
    http://eDOCS.BEA.com/WLS/docs103/Kodo.html
    http://eDOCS.BEA.com/WLS/docs103/Kodo/OpenJPA-Javadoc/index.html
    http://eDOCS.BEA.com/WLS/docs103/Kodo/full/HTML/samples_guide_part.html
    http://eDOCS.BEA.com/WLS/docs103/Kodo/full/HTML/tutorials.html

    Thank you
    /Michael

    Published by: michael_obrien on April 7, 2009 09:57

  • With the help of Toplink with Eclipse - (Newbie question)

    If you have (for example):

    * a white Dynacmic Web project in Eclipse
    * and you have a Toplink Workbench project - say a project XML or database.

    You will need to save your project Toplink, spurting on different directories for example classes, descriptors, schemas, fooname.mwp etc.

    Where do you want to save it in your Java project - what is in /src? Or somewhere else?

    I ask this question because I have problems when you debug my application - some xml files cannot be found etc. In any case, I guess I just need to know if I get the right bases for now - so any help will be highly appreciated.

    PS - Why can I not find a simple tutorial/example showing Eclipse and Toplink - it's all the builds JDeveloper and Ant and ahhhhhghghhhgh!

    golcarlad,
    Hi, try the following examples EclipseLink JPA and tutorials for environments SE and EE - oriented around the Eclipse 3.4 IDE (Ant capable but WTP ready)
    With these, you will be able to fully debug your JPA application on and off any server application.

    If you deploy your WAR for Tomcat, then the tutorial following the performance of EclipseLink JPA on Tomcat 6 always will help you. Put your file additional alongside persistence.xml orm.xml if you use features beyond the standard JPA.

    http://wiki.Eclipse.org/EclipseLink/examples/JPA/Tomcat_Web_Tutorial

    Of
    Help on creating a ServerSession in Eclipse with XML file

    "In the note in particular that there are two META-INF directories - we use only off the coast of the CBC."
    «Make sure that your persistence.xml (and optionally orm.xml) file is placed outside of the src/META-INF directory and not the dir of WebContent/META-INF by default so that it gets picked up by the servlet from the Directory class loader classes.»

    Other tutorials:
    http://wiki.Eclipse.org/EclipseLink/examples
    http://wiki.Eclipse.org/EclipseLink/examples/JPA
    http://wiki.Eclipse.org/EclipseLink/examples/JPA/EmployeeXML
    http://wiki.Eclipse.org/EclipseLink/examples/JPA/dynamic
    http://wiki.Eclipse.org/EclipseLink/examples/JPA#JPA_Web_Application_Tutorials
    http://wiki.Eclipse.org/EclipseLink/examples/JPA/WebLogic_Web_Tutorial
    http://wiki.Eclipse.org/EclipseLink/examples/JPA/OC4J_Web_Tutorial
    http://wiki.Eclipse.org/EclipseLink/examples/JPA/JBoss_Web_Tutorial

    Thank you
    /Michael

    Published by: michael_obrien on March 19, 2009 09:19

  • JNDI can acquire and not datasource.   -WLS JDBC, 10.3

    Now I have problems connecting to the database for my EJB entities.

    I use Jdev 11 r1, ADF Faces, EJB3.0, Oracle database 10g. I have my WLS connection to the database server, and the application connects to it, when it is run with the server integrated into Jdeveloper. When I deploy my application for the server (I created a JDBC connection to the database with the name jndi jdbc/DatabaseDevDS), I get way below.

    I have my persistence.xml

    < name of persistence - unit = "Company" >
    <>provider
    org.eclipse.persistence.jpa.PersistenceProvider
    < / provider >
    < jta-data-source >
    Java: / app/jdbc/jdbc/DatabaseDevDS
    < / jta-data-source >

    ERROR:

    Caused by: Exception EclipseLink-7060 (Eclipse - 1.0.1 persistence Services (Build 20080905)): org.eclipse.persistence
    .exceptions. ValidationException
    Description of the exception: could not acquire data source Java: / app/jdbc/jdbc/DatabaseDevDS.
    Inner exception: javax.naming.NameNotFoundException: while trying to search/app/jdbc/jdbc/DatabaseDevDS/app/ejb/E
    JB.jar #SessionEJB. ; rest the name "/ app/jdbc/jdbc/DatabaseDevDS.
    at org.eclipse.persistence.exceptions.ValidationException.cannotAcquireDataSource(ValidationException.java:429)
    at org.eclipse.persistence.sessions.JNDIConnector.connect(JNDIConnector.java:123)
    at org.eclipse.persistence.sessions.JNDIConnector.connect(JNDIConnector.java:94)
    at org.eclipse.persistence.sessions.DatasourceLogin.connectToDatasource(DatasourceLogin.java:164)
    at org.eclipse.persistence.internal.databaseaccess.DatasourceAccessor.connectInternal (DatasourceAccessor.java:32
    4)
    at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.connectInternal(DatabaseAccessor.java:264)
    at org.eclipse.persistence.internal.databaseaccess.DatasourceAccessor.connect(DatasourceAccessor.java:407)
    at org.eclipse.persistence.sessions.server.ConnectionPool.buildConnection(ConnectionPool.java:130)
    at org.eclipse.persistence.sessions.server.ExternalConnectionPool.startUp(ExternalConnectionPool.java:110)
    at org.eclipse.persistence.sessions.server.ServerSession.connect(ServerSession.java:500)
    at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.login(DatabaseSessionImpl.java:606)
    at org.eclipse.persistence.internal.jpa.EntityManagerFactoryProvider.login (EntityManagerFactoryProvider.java:211
    )
    at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:246)
    ... more than 97
    Caused by: javax.naming.NameNotFoundException: while trying to get/app/jdbc/jdbc/DatabaseDevDS in /app/ejb/EJB.jar#Se
    ssionEJB. ; rest the name "/ app/jdbc/jdbc/DatabaseDevDS.
    at weblogic.jndi.internal.BasicNamingNode.newNameNotFoundException(BasicNamingNode.java:1139)
    at weblogic.jndi.internal.ApplicationNamingNode.lookup(ApplicationNamingNode.java:144)
    at weblogic.jndi.internal.WLEventContextImpl.lookup(WLEventContextImpl.java:254)
    at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:380)
    at weblogic.jndi.factories.java.ReadOnlyContextWrapper.lookup(ReadOnlyContextWrapper.java:45)
    at weblogic.jndi.internal.AbstractURLContext.lookup(AbstractURLContext.java:135)
    at javax.naming.InitialContext.lookup(InitialContext.java:396)
    at org.eclipse.persistence.sessions.JNDIConnector.connect(JNDIConnector.java:117)
    ... more than 108

    Dan,
    Hi, thank your for use EclipseLink as EJB 3.0 JPA provider.
    The appearance of your JNDI name (* java: / app/jdbc/jdbc/DatabaseDevDS *)-(Note: il y a un double «* jdbc *») as opposed to a global brand (* DatabaseDevDS *) in your persistence.xml JPA - it seems that you are using a broad application data source and not a source of data globally extensive set directly on your WebLogic Server.

    If this is the case, for a broad application datasource on Oracle WebLogic server please see the tutorial following the 3 steps to prepare your application to use app level datasources.
    The application following business base tutorial using EclipseLink as the APP provider described workaround to use a source of data application when it is deployed on WebLogic 10.3 using the normal + the < jta-data-source > + element and the overriding javax.persistence.jtaDataSource property, until the bug of WLS Server base followed by EclipseLink bug # 246126 in. [http://bugs.eclipse.org/246126] is fixed soon.
    Reference
    [http://wiki.eclipse.org/EclipseLink/Examples/JPA/WLS_AppScoped_DataSource]
    related to
    [http://wiki.eclipse.org/EclipseLink/Examples/JPA/WebLogic_Web_Tutorial#Application_Scoped_Datasource_Setup]

    Persistence.XML suggested additional changes:
    (1) adds a reference to the WebLogic Platform
    + < property name = value "eclipselink.target - server" = "WebLogic_10" / >.

    (2) make sure you really set your datasource scope application (tutorial 3 steps above) with a double ' * jdbc. "
    * "" java: / app/jdbc/jdbc/DatabaseDevDS "*"
    and didn't really say "+ java: / app/jdbc/DatabaseDevDS +" which is usually standard

    See
    [http://wiki.eclipse.org/EclipseLink/Examples/JPA/WebLogic_Web_Tutorial#Persistence.xml]
    and an EclipseLink open source example that uses a globally set the datasource in an application tutorial WebLogic Web using EclipseLink JPA provider
    [http://dev.eclipse.org/svnroot/rt/org.eclipse.persistence/trunk/examples/org.eclipse.persistence.example.jpa.server.weblogic.enterpriseEJB/ejbModule/META-INF/persistence.xml]

    In addition, an additional workaround would be globally set the source of data on your integrated WebLogic Server and reference as described in...
    [http://wiki.eclipse.org/EclipseLink/Examples/JPA/WebLogic_Web_Tutorial#Global_Scoped_Datasource_Setup]

    I hope this helps.
    For any other TopLink, EclipseLink questions you can also post on the next TopLink forum or EclipseLink related forums

    TopLink/Eclipselink
    [f [48]
    EclipseLink
    [https://dev.eclipse.org/mailman/listinfo/eclipselink-users]
    [http://www.eclipse.org/newsportal/thread.php?group=eclipse.rt.eclipselink]
    [http://www.nabble.com/EclipseLink-f26430.html]

    Shay, thanks for pointing the tutorial to EclipseLink.

    Thank you
    /Michael att eclipselink.org

Maybe you are looking for