Challenge of the day - CMR existing tables

Hey all!
I have an existing application that contains 1:N table relationships that are already populated with data. How can I convert the EJB's (EJB2.0/CMP2.0) to use CMR?
As a reference, I have tried this with Jboss 3.2.2 and XDoclet and have only had success with @jboss:auto-key-fields which will make a third table that is blank and only populated when data is added through the EJB relationship, not the existing populated data (that, and why use a third table?).
Maybe this is the only way, not sure as new to CMR, can anyone be my hero and enlighten me please?

I guess I'm still a little confused about some parts
of this. I do already have existing tables (with
indicies). I do have one big question:
With CMR, will I be required to create a third table
for the relationship?
If not, then it seems that as long as the correct
mappings (within CMP) have taken place, I should be
immediately up and running without changes. This is
the route I initially took with:
* @jboss.relation
* related-pk-field="mypk"
* fk-column="mypk_fk"
But unfortunately I must have missed something as can
not get it to work correctly. If someone can help
point me to one way (a third table) or the other
(pk/fk mapping within CMP) that will help me on my
way!Well, here it follows what I'm doing for my People-Address (1:1) relationships and which is working:
     //persistent-relationships
     * @ejb.interface-method
     * view-type="local"
     * @ejb.relation
     * name="People-Address"
     * role-name="1-People-1-Address"
     * multiple="no"
     * target-role-name="1-Address-1-People"
     * target-multiple="no"
     * target-ejb="Address"
     * @jboss.relation
     * fk-constraint="true"
     * related-pk-field="addressId"
     * fk-column="addressId"
     public abstract AddressLocal getHomeAddress();
AddressLocal is obviously the LocalInterface of the Address entity bean and here we are within the People bean (which is supposed to be the main table). In a relationship, it's important to understand that both the source (People entity in this case) and the target (Address entity in this case) must be set. If there could be more than one Address for one People, than you would have set:
...snip
     * @ejb.relation
     * name="People-Address"
     * role-name="1-People-N-Address"
     * multiple="yes"
     * target-role-name="1-Address-1-People"
     * target-multiple="no"
     * target-ejb="Address"
Hope it will help,
Marco

Similar Messages

  • How to find the list of existing tables in a schema using DB link?

    Hi
    I know how to find the list of existing tables in a schema using the following query
    SQL> select * from tab;
    but, how to list the tables using a DB link?
    For Example
    SQL> select * from tab@dblink_name;
    why this doesn't work?
    Pl advice me
    Thanks
    Reddy.

    ORA-02019: connection description for remote database not foundHave you used this database link successfully for some other queries?
    The error posted seems to indicate that the DB Link is not functional at all. Has it worked for any other type of DML operation or is this the first time you ever tried to use the link?

  • Challenge of the day - "beginner" errors in SAP-delivered transactions

    1.  Read this post here:
    Question on SWUI_SINGLE and SWUI_START
    2.  Name another SAP-delivered transaction that exhibits the same incorrect behavior as SWUI_SINGLE and SWUI_START.
    Note: Assume that the behavior of these transactions at this customer site is not due to an error in system config, but rather to insufficient internal SAP QA/QC.
    If the behavior of SWUI_SINGLE and SWUI_START is not due to a config error at this customer site, these are really remarkable transactions.  I've never seen SAP transactions delivered with such gross "beginner" errors.
    Have you?
    djh

    Hi Stephen -
    How could I teach them "/nex" when I had deliberately forgotten it myself ... I'm the guy you love to hate  when you're standing behind him watching him try to get something done "fast" ... I still go up to the menu bar for copy/paste/cut in Office sometimes ...
    It's my way of being old-fashioned - like the engineers who wouldn't give up their rules for calculators ...
    As far as EEWB goes, well I can see why nobody cares about it ... remember the old saying:
    "Real programmers don't program in wussy languages like LISP ... they program right down to the bare metal" ...
    ... same goes for any tool that has "easy" and "workbench" in it ...
    Just kidding, of course ...
    djh

  • Get "Creation Script" of the existing table ( in SQL database) using C# and without using SMO dlls

    Hi All,
    I need to get the "Creation Script" of the existing table using c# and without using SMO dlls (is it possible? I don't know).
    I.e. In SQL Management Studio -> right click on any table -> Script table as -> Create To  - > open in the new query editor window. This will give you the schema of the table with the constraints of the table.
    For E.g. In Northwind database, for the table "Categories", I would like to get it as show below
    USE [Northwind]
    GO
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    CREATE TABLE [dbo].[Categories](
        [CategoryID] [int] IDENTITY(1,1) NOT NULL,
        [CategoryName] [nvarchar](15) NOT NULL,
        [Description] [ntext] NULL,
        [Picture] [image] NULL,
     CONSTRAINT [PK_Categories] PRIMARY KEY CLUSTERED
        [CategoryID] ASC
    )WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
    ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
    GO
    I would like to get the same schema using c#. Please help.
    Thanks & Regards,
    Kalai.

    SMO is the easiest way to get this. This is what Management Studio uses. If you can't use SMO, get a Profiler trace of the queries that SMO executes when generating the script and execute the same using ADO.NET.
    Regards,
    Farooq Mahmud
    Support Escalation Engineer 
    •  Microsoft Health Solutions Group

  • Error while adding the Objects in Existing DSO -Table /BIC/B* is too long ( 004030)

    Hi Team,
    We added some objects in the existing Write Optimized DSO.  while activitating the DSO We got the below error .
    Table /BIC/BXXXXXXXXX is too long (>004030)
    Please go through the issue and provide the solution.
    Thanks,
    Purushotham.

    Hi Purushotham,
    Is the table in error log is active table of DSO? it doesnt look like...it will be /BIC/A<DSO>name
    in your case it is /BIC/B----!!
    Now  instead of adding 15 fields, could you try concatenating 2 fields in 1 and in that way you will have to add 7-8 fields.
    later at Standard DSO layer or Cube layer you can read relevant field value by "field+(<No.>)"
    And you mentioned that you willtry for concatenate 4 IO of length 60 into 1 InfoObject (IO).
    This cant be done...max lenght is 60! then how will you create a IO with lenght 240! please think of other logic.
    Regards,
    Gaurav

  • No data Exists error while retrieving the data from a table

    Hi Everyone!
    I am getting "No Data Exists" error while retrieving the data from a table....where i need to check...if possible please give me example link.....please help me regarding this

    Hi !
    thanks for ur response...
    I have written vo.executeQuery for the table...My page is running but i m not getting the data....I have to select two LOV's and when I click on Go button the data has to display in the table...After the selection of LOV's when I click on Go in the table "No data exists" message is appearing...the table has the data and the query is also executing...please give info where i did the mistake....

  • How to change the lenth of existing field in sap standard table

    Hi all,
    can anybody help,my requirement is, how to change the length of existing field in sap standard table....
    thanks in advance..

    Which field are you thinking of in particular?  Are you wanting to increase or decrease the length?
    Some fields are used so extensively that a change to their length will mean adjusting many tables, some of them potentially very large, and hence taking a long time to adjust.
    Some standard SAP programs expect certain fields to be of specific lengths and won't work if the length is changed.
    Some screens could cease to work.
    If you decrease length, then you could lose data.
    matt

  • [help]how to know whether the given column exists in the table or not????

    Hi all, can anyone tell me how to write a C# code help me to know whether the given field exists.
    If it doesnt exists then i want to alter the table to include this column also
    I am able to write the code for alter table but i m not sure how do i check for its existence/nonexistence
    My Altering code
    {color:#800000}cmd.CommandText = "alter table " + row.ToString() + " add(" + sQuality + " varchar2(50), " +
    sTimeStamp + " varchar2(50), " +
    sValue + " varchar2(50))";
    cmd.CommandType = CommandType.Text;
    cmd.ExecuteReader();
    {color}

    Just iterate the datatable after completion and check for your column.
            public static DataTable MaterializeTableStructure(string _connectionString, string _tableName)
                DataSet ds = null;
                using (OracleConnection _oraconn = new OracleConnection(_connectionString))
                    try
                        _oraconn.Open();
                        string sql = "SELECT COLUMN_NAME, DATA_TYPE, NULLABLE, DATA_LENGTH, DATA_PRECISION, DATA_SCALE FROM user_tab_columns where table_name='" + _tableName + "'";
                        using (OracleCommand cmd = new OracleCommand(sql, _oraconn))
                            cmd.CommandType = CommandType.Text;
                            using (OracleDataAdapter da = new OracleDataAdapter(cmd))
                                ds = new DataSet("MaterializeTableStructure");
                                da.Fill(ds);
                    catch (OracleException _oraEx)
                        throw (_oraEx); // Actually rethrow
                    catch (System.Exception _sysEx)
                        throw (_sysEx); // Actually rethrow
                    finally
                        if (_oraconn.State == ConnectionState.Broken || _oraconn.State == ConnectionState.Open)
                            _oraconn.Close();
                if (ds != null)
                    return ds.Tables[0];
                else
                    return null;
            }r,
    dennis

  • Dragging the columns to existing logical table source.....

    Hi,
    I am just learning OBIEE 11g and I am using a turorial from oracle it is
    "Creating a Repository Using the Oracle BI 11g Administration Tool" for practice purpose.
    In this tutorial it is saying that drag that columns from phscial layer to Logica Table Source
    in BMM Layer to avoid creating a second logical table source.. But when I am trying to drag the columns to
    existing logical source it is disabling I mean which it is not allowing .. is there any other technique to
    do it... or Am i wrongly approaching.. .The below is brief description in the
    tutorial.
    "Drag all six columns from D50 Sales Rep in the Physical layer to D5 Sales Rep in the BMM layer. This action
    creates logical columns and adds a D50 Sales Rep logical table source to D5 Sales Rep.
    Rename the D50 Sales Rep logical table source to LTS1 Sales Rep.
    In the Physical layer, expand D52 Sales Rep Position.
    Drag POSTN_DESC and POSTN_LEVEL from D52 Sales Rep Position to LTS1 Sales Rep. Note that you are
    dragging the columns to the logical table source, not the logical table. Dragging to the logical table would create a
    second logical table source.
    Drag DISTANCE from D51 Sales Rep Parent Child to LTS1 Sales Rep. Again, you drag the column to the logical
    table source, not the logical table."
    help would be appreciated.
    Thanks and Regards,
    Sri_Oracle.

    Hi Sri,
    When you are dragging a physical column onto an existing Logical table source and if it does not let you do so, then it means that there is no physical join between the existing physical table(which the logical source is pointing to already) and new physical table (from which you are dragging the column now). So, please make sure, you have the join in place.
    Hope this helps.
    Thank you,
    Dhar

  • Need to add 2 new columns to the existing table control of C223 transaction

    Hi ABAP Gurus,
    I have to do a screen enhancement for transaction C223.
    Below is the requirement:
    need to add 2 new columns to the existing table control of C223 transaction.
    there is no customer exits, screen exit or user exit present for this transaction C223, i have found one enhancement spot for this transaction.
    i dont have any idea how to do this in standard transaction C223, the table control in C223 saves the data to MKAL table and the table control uses the structure MKAL_EXPAND in the screen program.
    i have created an append structure for  the 2 fields to the standard table MKAL.
    Can anyone please suggest me how this can be done in standard screen C223, will the enhancement spot can be used to do this....
    please sugest...
    Thanks & Regards

    Hi Santosh,
    Thanks for the reply. I have looked into this Enhancement Spot CPFX_SCREEN_SET , inside this there is only one method INPUT_DISABLED having below parameters
    IM_MKAL     Importing     Type     MKAL                                                                                Production Version
    EX_MSGID     Exporting     Type     SY-MSGID                                                                                Messages, Message
    EX_MSGTY     Exporting     Type     SY-MSGTY                                                                                Messages, Message
    EX_MSGNO     Exporting     Type     SY-MSGNO                                                                                Messages, Message
    EX_MSGV1     Exporting     Type     SY-MSGV1                                                                                Messages, Message
    EX_MSGV2     Exporting     Type     SY-MSGV2                                                                                Messages, Message
    EX_MSGV3     Exporting     Type     SY-MSGV3                                                                                Messages, Message
    EX_MSGV4     Exporting     Type     SY-MSGV4                                                                                Messages, Message
    EX_INPUT_DISABLE     Exporting     Type     CHAR1                                                                                Display Only if X Was Set
    the BADI definition present here is a SAP internal so we cant implement the BADI , but we can created a enhancement spot implementation for this. as per my understanding on this the enhancement spot is only for making the table control fields display / change .  i dont think this can be used to add two new coloumns to C223 table control.
    I am not sure thats why seeking your help/valuable sugestion on this.
    Please provide your sugestion on this , so that i can come to conclusion on this issue.
    Thanks & Regards
    Siddhartha Mishra

  • Can we addnew partition and sub partition in the existing table in one shor

    can we addnew partition and sub partition in the existing table in one short

    nav wrote:
    can we addnew partition and sub partition in the existing table in one shortYes,
    You can and below is the example for Range-List partition
    ALTER TABLE <table_name>
       ADD PARTITION <partition_name> VALUES LESS THAN (<value>
          STORAGE (INITIAL 20K NEXT 20K) TABLESPACE <TS name> NOLOGGING
              SUBPARTITION Clause
              SUBPARTITION Clause
              SUBPARTITION Clause
              SUBPARTITION Clause
               );

  • What's the best practice to partition an existing table?

    We are using Oracle 11g EE 11.2.0.3.0. We want to partition an existing table. I found some information from this link [http://www.oracle-base.com/articles/misc/partitioning-an-existing-table.php], but I am not sure whether that's the best way. Could anyone share the best practice of partitioning an existing table?
    Thanks.
    Jun

    >
    We want to partition a few related tables. A couple of tables have about 30 million rows, and a couple of other tables have about 10 million rows. The data for those tables is for ~2000 accounts, each of them is identified by a column named "account_id". We want to partition the tables by using the "account_id" as the partition key to gain better performance for queries, so we would probably use hash partition. Please advise.
    >
    1. What evidence do you have that your performance will be any better if you partition those tables?
    2. What evidence do you have that there is anything wrong with the performance of your current queries?
    3. Have you reviewed the actual execution plans for your most important queries to see if there is even any room for improvement?
    If your query uses account_id as a predicate but only pulls a few records from a 'master' table for that key value your performance may actually be worse if you partition that table. That is because using an index range scan Oracle can easily find the ROWIDs of the rows that need to be selected and then easily retrieve them regardless of their physical location.
    If you have queries that do NOT use account_id but currently use indexes the performance of those queries may also be worse if you partition that table. Those indexes will be GLOBAL.
    There are two major implications when you use hash partitioning:
    1. Any query that does NOT include the partitioning key (account_id for your case) will, of necessity, have to use a full table scan if an appropriate index is not available.
    2. You will get NO management benefits such as being able to add/remove partitions that include old data.
    Before you decide to partition a table you should conduct tests and examine the execution plans for your important queries.

  • Drop the Rules of one table from existing bi directional replication setup

    Hi All,
    I have one small question on bi directional replication setup, Its regarding table add in existing replication setup.
    What happened ,When we add a new table to existing replication setup if any reason table is not replicating between two database even we are not getting
    any error in dba_apply_error ,then we have to remove the rules for that particular table and setup again. Some time what happened we got error "queue has
    errors" i dont know the ORA number. But in that case what happened Apply process ABORETED and when we try to start the process it gives same error
    ("Queue has errors" ) and ABORTED again.
    then on metalink for doc id 203225.1 .we have remove the whole replication Manually and setup again. It's horriable....
    Could you please help that before drop the rules for particular table from exisitng bi directional replication setup then wht should we do ?
    Do we need to unscheduled the propagation process and then drop the rules becuase i read on metalink that reason behind the error ,queue has errors
    "negative rules drops while propagation process using the same rule set" .
    Please Suggest!!!!!!!!!!
    Many Thanks

    How huge those tables?. If those are small tables use Oracle MINUS function to get the defference records.

  • I need a query that selects the amount of records for each day in a table.

    I need a query that selects the amount of records for each
    day in a table.
    Eg the result would be:
    date 1 14
    date 2 3
    etc
    Any ideas?

    sorted:
    SELECT count([commentID]),convert(varchar, dateAdded, 112)
    FROM COMMENTSgroup by convert(varchar, dateAdded,
    112)

  • How can I convert an existing table to IOT

    Hi,
    My Oracle version is 10.2.0.4
    Below is my structure of my test_table .
    It has 1141580 rows.
    I want to convert this into index Organized table. It has no secondary indexes.
    How can I convert an existing table to IOT.
    CREATE TABLE test_table (
       Column1             NUMBER        NOT NULL,
       Column2             DATE          NOT NULL,
       Column3             VARCHAR2(100) NOT NULL,
       Column4             VARCHAR2(8)   NULL,
       Column5             VARCHAR2(40)  NOT NULL,
       Column6             VARCHAR2(3)   NULL,
       Column7             NUMBER        NOT NULL,
       Column8             NUMBER        NULL,
       Column9             VARCHAR2(32)  NULL,
    ALTER TABLE test_table
      ADD CONSTRAINT test_table_pk2 PRIMARY KEY (
        Column1,
        Column2
      USING INDEX
        STORAGE (
          INITIAL   30720 K
    ALTER TABLE test_table
      ADD CONSTRAINT test_table_cons1 FOREIGN KEY (
        Column1
      ) REFERENCES test_table2 (
        Column1
    /

    alter table doesn't allow to change the organization of a table.
    So the logical answer to your question is
    You can not
    and your question
    redundant.
    As most other questions here.
    So the answer should have been
    - create a new table
    - insert all rows
    - drop the old table
    - rename the new table
    Oracle is not about rocket science.
    Oracle is about reading documentation and using brains.
    If you do that, maybe, one day, you will be a bigboy.
    If you keep asking redundant questions you will remain a littleboy.
    Sybrand Bakker
    Senior Oracle DBA

Maybe you are looking for