4 Replies Latest reply: Jan 9, 2013 12:52 PM by 983575 RSS

    Working with Object Relational model and Eclipse

    983575
      Hello,
      I have mad some types and typed tables in a schema on oracle 10g.
      My database respects the Object Relational model, in which I work with VARRAY, TYPES, NESTED TABLES, PL/SQL,...

      I have already install Enterprise Pack for Eclipse, and also have the Weblogic server, And I can generate tables. But the problem is that it gives to me this tables with wrong types, until they contains in fact other tables as Objet column, and also the types are not supported.

      Please need a help !

      Thank's in advance :)
        • 1. Re: Working with Object Relational model and Eclipse
          nhauge
          Hi,

          I want to make sure I understand the problem but will try to give you some information as well. So you have an Oracle 10g database in which you are using the object-relational database model with VARRAY's, etc. You say you are also trying to generate tables, but the generation is not working correctly. Are you using the "Generate tables from entities..." functionality? What is the source of the generated tables? I assume you generating from some type of JPA entity? Could you give a small example of the source you are generating from?

          In order to generate proper tables of this type, you would need to be using special TopLink/EclipseLink annotations such as @Array so the persistence provider would know that they are "special" and not just regular entities that would create standard relational tables.

          Neil
          • 2. Re: Working with Object Relational model and Eclipse
            983575
            nhauge wrote:
            Hi,

            I want to make sure I understand the problem but will try to give you some information as well. So you have an Oracle 10g database in which you are using the object-relational database model with VARRAY's, etc. You say you are also trying to generate tables, but the generation is not working correctly. Are you using the "Generate tables from entities..." functionality? What is the source of the generated tables? I assume you generating from some type of JPA entity? Could you give a small example of the source you are generating from?

            In order to generate proper tables of this type, you would need to be using special TopLink/EclipseLink annotations such as @Array so the persistence provider would know that they are "special" and not just regular entities that would create standard relational tables.

            Neil
            Thank you for your replay,
            well I'm generating that with "Generate tables from entities" of eclipse link.
            this is an example of what I have in the database:
            [DB-SCRIPT|http://www.mediafire.com/view/?n3knwz1o4ggk50n]

            and this is what is generated(eclipselink-orm.xml):

            <?xml version="1.0" encoding="UTF-8"?>
            <entity-mappings version="1.2" xmlns="http://www.eclipse.org/eclipselink/xsds/persistence/orm" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eclipse.org/eclipselink/xsds/persistence/orm http://www.eclipse.org/eclipselink/xsds/eclipselink_orm_1_2.xsd">
                 <entity class="model.Chefterritoire" access="VIRTUAL">
                      <attributes>
                           <id name="idChef" attribute-type="long">
                                <column name="ID_CHEF"/>
                           </id>
                           <basic name="lesterritoires" attribute-type="Object">
                           </basic>
                           <basic name="nomChef" attribute-type="String">
                                <column name="NOM_CHEF"/>
                           </basic>
                           <basic name="tel" attribute-type="java.math.BigDecimal">
                           </basic>
                      </attributes>
                 </entity>
                 <entity class="model.Client" access="VIRTUAL">
                      <attributes>
                           <id name="idClient" attribute-type="long">
                                <column name="ID_CLIENT"/>
                           </id>
                           <basic name="adresseClient" attribute-type="String">
                                <column name="ADRESSE_CLIENT"/>
                           </basic>
                           <basic name="dateP" attribute-type="java.util.Date">
                                <column name="DATE_P"/>
                                <temporal>DATE</temporal>
                           </basic>
                           <basic name="lescommandes" attribute-type="Object">
                           </basic>
                           <basic name="nomClient" attribute-type="String">
                                <column name="NOM_CLIENT"/>
                           </basic>
                           <basic name="profession" attribute-type="String">
                           </basic>
                           <basic name="refrepresentant" attribute-type="Object">
                           </basic>
                           <basic name="telClient" attribute-type="java.math.BigDecimal">
                                <column name="TEL_CLIENT"/>
                           </basic>
                      </attributes>
                 </entity>
                 <entity class="model.Commande" access="VIRTUAL">
                      <attributes>
                           <id name="idCommande" attribute-type="long">
                                <column name="ID_COMMANDE"/>
                           </id>
                           <basic name="dateCommande" attribute-type="java.util.Date">
                                <column name="DATE_COMMANDE"/>
                                <temporal>DATE</temporal>
                           </basic>
                           <basic name="dateLivraison" attribute-type="java.util.Date">
                                <column name="DATE_LIVRAISON"/>
                                <temporal>DATE</temporal>
                           </basic>
                           <basic name="refreleve" attribute-type="Object">
                           </basic>
                           <basic name="refrepresentant" attribute-type="Object">
                           </basic>
                           <basic name="refvehicule" attribute-type="Object">
                           </basic>
                           <basic name="reprise" attribute-type="String">
                           </basic>
                      </attributes>
                 </entity>
                 <entity class="model.Constructeur" access="VIRTUAL">
                      <attributes>
                           <id name="idConstructeur" attribute-type="long">
                                <column name="ID_CONSTRUCTEUR"/>
                           </id>
                           <basic name="adresseConstructeur" attribute-type="String">
                                <column name="ADRESSE_CONSTRUCTEUR"/>
                           </basic>
                           <basic name="lesreleves" attribute-type="Object">
                           </basic>
                           <basic name="nomConstructeur" attribute-type="String">
                                <column name="NOM_CONSTRUCTEUR"/>
                           </basic>
                           <basic name="refvehucule" attribute-type="Object">
                           </basic>
                      </attributes>
                 </entity>
                 <entity class="model.LesccommandesN" access="VIRTUAL">
                      <table name="LESCCOMMANDES_N"/>
                      <attributes>
                      </attributes>
                 </entity>
                 <entity class="model.LescommandessN" access="VIRTUAL">
                      <table name="LESCOMMANDESS_N"/>
                      <attributes>
                      </attributes>
                 </entity>
                 <entity class="model.LescommandesN" access="VIRTUAL">
                      <table name="LESCOMMANDES_N"/>
                      <attributes>
                      </attributes>
                 </entity>
                 <entity class="model.LesoptionsN" access="VIRTUAL">
                      <table name="LESOPTIONS_N"/>
                      <attributes>
                      </attributes>
                 </entity>
                 <entity class="model.LesrepresentantsN" access="VIRTUAL">
                      <table name="LESREPRESENTANTS_N"/>
                      <attributes>
                      </attributes>
                 </entity>
                 <entity class="model.LessclientsN" access="VIRTUAL">
                      <table name="LESSCLIENTS_N"/>
                      <attributes>
                      </attributes>
                 </entity>
                 <entity class="model.LesscommandesN" access="VIRTUAL">
                      <table name="LESSCOMMANDES_N"/>
                      <attributes>
                      </attributes>
                 </entity>
                 <entity class="model.LesterritoiresN" access="VIRTUAL">
                      <table name="LESTERRITOIRES_N"/>
                      <attributes>
                      </attributes>
                 </entity>
                 <entity class="model.LesvehiculesN" access="VIRTUAL">
                      <table name="LESVEHICULES_N"/>
                      <attributes>
                      </attributes>
                 </entity>
                 <entity class="model.Modele" access="VIRTUAL">
                      <attributes>
                           <id name="idModele" attribute-type="long">
                                <column name="ID_MODELE"/>
                           </id>
                           <basic name="couleurExterieure" attribute-type="String">
                                <column name="COULEUR_EXTERIEURE"/>
                           </basic>
                           <basic name="couleurInterieure" attribute-type="String">
                                <column name="COULEUR_INTERIEURE"/>
                           </basic>
                           <basic name="lesoptions" attribute-type="Object">
                           </basic>
                           <basic name="lesvehicules" attribute-type="Object">
                           </basic>
                           <basic name="prix" attribute-type="double">
                           </basic>
                      </attributes>
                 </entity>
                 <entity class="model.Option" access="VIRTUAL">
                      <table name="OPTIONS"/>
                      <attributes>
                           <id name="idOption" attribute-type="long">
                                <column name="ID_OPTION"/>
                           </id>
                           <basic name="nomOption" attribute-type="String">
                                <column name="NOM_OPTION"/>
                           </basic>
                           <basic name="refmodele" attribute-type="Object">
                           </basic>
                      </attributes>
                 </entity>
                 <entity class="model.Rapportvisite" access="VIRTUAL">
                      <attributes>
                           <id name="idRapport" attribute-type="long">
                                <column name="ID_RAPPORT"/>
                           </id>
                           <basic name="dateVisite" attribute-type="java.util.Date">
                                <column name="DATE_VISITE"/>
                                <temporal>DATE</temporal>
                           </basic>
                           <basic name="frais" attribute-type="double">
                           </basic>
                           <basic name="refclient" attribute-type="Object">
                           </basic>
                           <basic name="refrepresentant" attribute-type="Object">
                           </basic>
                           <basic name="resultat" attribute-type="String">
                           </basic>
                      </attributes>
                 </entity>
                 <entity class="model.Releve" access="VIRTUAL">
                      <attributes>
                           <id name="idReleve" attribute-type="long">
                                <column name="ID_RELEVE"/>
                           </id>
                           <basic name="dateDebut" attribute-type="java.util.Date">
                                <column name="DATE_DEBUT"/>
                                <temporal>DATE</temporal>
                           </basic>
                           <basic name="dateFin" attribute-type="java.util.Date">
                                <column name="DATE_FIN"/>
                                <temporal>DATE</temporal>
                           </basic>
                           <basic name="lescommandes" attribute-type="Object">
                           </basic>
                           <basic name="refconst" attribute-type="Object">
                           </basic>
                      </attributes>
                 </entity>
                 <entity class="model.RelevesN" access="VIRTUAL">
                      <table name="RELEVES_N"/>
                      <attributes>
                      </attributes>
                 </entity>
                 <entity class="model.Remise" access="VIRTUAL">
                      <attributes>
                           <id name="idRemise" attribute-type="long">
                                <column name="ID_REMISE"/>
                           </id>
                           <basic name="remise" attribute-type="double">
                           </basic>
                      </attributes>
                 </entity>
                 <entity class="model.Representant" access="VIRTUAL">
                      <attributes>
                           <id name="idRepresentant" attribute-type="long">
                                <column name="ID_REPRESENTANT"/>
                           </id>
                           <basic name="lesclients" attribute-type="Object">
                           </basic>
                           <basic name="lescommandes" attribute-type="Object">
                           </basic>
                           <basic name="nomRepresentant" attribute-type="String">
                                <column name="NOM_REPRESENTANT"/>
                           </basic>
                           <basic name="refterritoire" attribute-type="Object">
                           </basic>
                           <basic name="typeRep" attribute-type="String">
                                <column name="TYPE_REP"/>
                           </basic>
                      </attributes>
                 </entity>
                 <entity class="model.Territoire" access="VIRTUAL">
                      <attributes>
                           <id name="idTerritoire" attribute-type="long">
                                <column name="ID_TERRITOIRE"/>
                           </id>
                           <basic name="lesrepresentants" attribute-type="Object">
                           </basic>
                           <basic name="nomTerritoire" attribute-type="String">
                                <column name="NOM_TERRITOIRE"/>
                           </basic>
                           <basic name="refchef" attribute-type="Object">
                           </basic>
                      </attributes>
                 </entity>
                 <entity class="model.Vehicule" access="VIRTUAL">
                      <attributes>
                           <id name="idVehicule" attribute-type="long">
                                <column name="ID_VEHICULE"/>
                           </id>
                           <basic name="lescommandes" attribute-type="Object">
                           </basic>
                           <basic name="nomVehicule" attribute-type="String">
                                <column name="NOM_VEHICULE"/>
                           </basic>
                           <basic name="refavoir" attribute-type="Object">
                           </basic>
                           <basic name="refmodele" attribute-type="Object">
                           </basic>
                      </attributes>
                 </entity>
                 <entity class="model.Visiteav" access="VIRTUAL">
                      <attributes>
                           <id name="idVisiteav" attribute-type="long">
                                <column name="ID_VISITEAV"/>
                           </id>
                           <basic name="dateDebut" attribute-type="java.util.Date">
                                <column name="DATE_DEBUT"/>
                                <temporal>DATE</temporal>
                           </basic>
                           <basic name="dateFin" attribute-type="java.util.Date">
                                <column name="DATE_FIN"/>
                                <temporal>DATE</temporal>
                           </basic>
                           <basic name="refclient" attribute-type="Object">
                           </basic>
                           <basic name="refrepresentant" attribute-type="Object">
                           </basic>
                      </attributes>
                 </entity>
            </entity-mappings>
            • 3. Re: Working with Object Relational model and Eclipse
              nhauge
              From the generated output it would appear that you are generating entities (dynamic entities to be specific) from tables, not generating tables. The Entity generation functionality in OEPE is based on JPA, which is meant to connect a java object model to a relational database. In short, what you are looking for (generating entities from an Object-Relation DB model) is not supported by the current entity generation as it does not support Object-Relational DB constructs. I would suggest refactoring the generated model as necessary to meet your needs. Remember that you will need to use @Array and @Struct annotations to complete your mapping. There are also some limitations as to what EclipseLink support in this area. See the following links for more information:

              http://eclipse.org/eclipselink/documentation/2.4/jpa/extensions/a_array.htm
              http://wiki.eclipse.org/EclipseLink/Examples/JPA/PLSQLStoredFunction

              And for specific questions about what EclipseLink supports for Object-Relational DB models, please ask here - TopLink/JPA

              Neil
              • 4. Re: Working with Object Relational model and Eclipse
                983575
                Thank you very much
                and if you have to propose any other tool that can help me to generate models please don't hesitate.