CMP relationship requires constraint???

I'm currently using WSAD to develop some EntityBeans using CMP, and I've discovered that the mapping tool in WSAD won't let me map entity bean relationships to the database unless there is a foreign key constraint implemented in the database (the tables has columns representing foreign keys, but there is no foreing key constraint between the tables).
Is this according to the EJB2.0 spec. or is it just an extra "feature" from IBM?

Did some testing, and it turns out that it's the WSAD mapping tool that needs the foreign key constraint in the DB to set up the relation mappings between the Entity Beans.
The workaround, when using "meet in the middle" mapping strategy, is to let the mapping tool generate the db schema from the excisting database, and then add foreign key constraints to the reveresed schema during the mapping - and finally deploy the bean without forwarding the schema in WSAD to the database. This seems to work fine...

Similar Messages

  • Deploying CMP Relationships

    Hi I wonder if someone could help me please. Im trying to deploy an EJB CMP Relationship example. In fact the one from Enterprise JavaBeans by R. Monson-Haefel Example 6.3. Now I realise there was some code missing to do with throwing Exceptions, which I've added - so its not the pure example.
    Right so I'm using j2eesdk 1.3.1 along with Cloudscape as the DB and the standard J2ee deployment tool.
    My first problem is that when I try to setup the relationship between the Customer & the Address I only get the Customer Bean in the 'Edit Relationship' Dialogue Box - not the Address as well. Yep I've deployed the Address EJB.
    Then when I validate the EJB I get the following logged to the Resaults file
         Test Name : tests.ejb.entity.TransactionDemarcationHomeInterface
         Test Assertion : Entity bean container transaction demarcation for methods of home interface test
         Test Description : For [ CustomerBean ]
    Error: Transaction attributes must be specified for the methods defined in the home interface [ com.titan.customer.CustomerHomeRemote ]. Method [ create ] has no transaction attribute defined within this bean [ CustomerBean ].
    I've set the transaction attributes to 'Requires New' but it doesn't seem to be saving then to the Deployment file.
    Thanks & Regards
    Nick

    Oops, I've fixed the problem by re-reading the manuals yet again. I missed the line that said that both of the EJB needed to be in the SAME jar file not just the same package.
    Nick

  • Position Holder relationship Time Constraint

    I have received a unique requirement from my client.  They want only one employee to hold one position and on position only to be held by one employee.  This in itself is the easy part. 
    However, for contingent workers (non-employees) that want to be able to tie multiple people to one position.
    Has anyone ever done this?  If so, how?
    Any additional information that anyone can provide would be much appreciated!

    Hi - You stated the following  - see my notes in Bold:
    You can either turn off the '100%' check for all Positions or make it a Warning or Information instead of an Error. This affects all Positions.  - Not an option as this should throw an error for employees.
    Personnel Management > Organizational Management > Basic Settings > Relationship Maintenance > Maintain Relationships
    Click on Holder (008) > click on 'Relationship Characteristics' > W - Warning or I - Information
    You can also Change the time constraint for the Position to Person A008 part of the relationship.  Also, not an option as we want employee positions to error - only for non-employee positions should this be allowed.
    Personnel Management > Organizational Management > Basic Settings > Relationship Maintenance > Maintain Relationships
    Click on Holder (008) > click on 'Time constraints' > Click on 'A008' > Choose '3'
    You can also, set the 'Staffing' Percentage' on the Relationship Infotype - A008 - holder to a blank.

  • Do we require constraints in Datawarehousing?

    I can understand if we can create the surrogate keys for the dimension tables. Do we require foreign key constraints for the Fact tables. If we dont use the foreign keys what would be the effect during the ETL load. Im maintaining an exception table where all the failure records will be inserted. In that case what is the use of foreign constraint to create, even disable and enable also not required.
    Pls post your thoughts !!
    Kishan

    Hi Borkur. Sorry for the confusion...
    This is an association I automatically do.
    You are right, constraints and indexes are different structures, but they are highly connected to each other. Sometimes, having a constraint, necessarily means having an index associated with it.
    Take a look at this example:
    create table cargos_t
    (cd_cgo number primary key,
    nm_cgo varchar2(30) not null)
    create table cidades_t
    (cd_cid number primary key,
    nm_cid varchar2(100) not null,
    UF varchar2(2) not null)
    create table emp_t
    (cd_emp number primary key,
    nm_emp varchar2(30),
    cd_dep references depto_t,
    sal number (10,2) not null,
    com number (2,2),
    dt_adm date not null,
    dt_dms date,
    cod_cgo number references cargos_t,
    cod_cid number references cidades_t)
    Note that I never created manually any indexes.
    And then, query dictionary views, you'll see there's some indexes for those tables.
    SQL> select A.INDEX_NAME, 
      2         A.TABLE_NAME,
      3         A.TABLE_TYPE,
      4         B.CONSTRAINT_NAME,
      5         B.CONSTRAINT_TYPE
      6  from user_indexes A,  USER_CONSTRAINTS B
      7  where A.table_name in ('EMP_T', 'CARGOS_T', 'CIDADES_T')
      8    AND A.TABLE_NAME = B.TABLE_NAME
      9    and b.index_name = b.constraint_name;
    INDEX_NAME                     TABLE_NAME                     TABLE_TYPE  CONSTRAINT_NAME                C
    SYS_C0034289                   CARGOS_T                       TABLE       SYS_C0034289                   P
    SYS_C0034292                   CIDADES_T                      TABLE       SYS_C0034292                   P
    SYS_C0034295                   EMP_T                          TABLE       SYS_C0034295                   PWhen you create a Primary Key constraint, Oracle creates an Index for it automatically.
    Plus:
    create table cargos_t
    (cd_cgo number primary key,
      nm_cgo varchar2(30) not null)
      1  select A.INDEX_NAME,
      2         A.TABLE_NAME,
      3         A.TABLE_TYPE,
      4         B.CONSTRAINT_NAME,
      5         B.CONSTRAINT_TYPE
      6  from user_indexes A,  USER_CONSTRAINTS B
      7  where A.table_name in ('CARGOS_T')
      8    AND A.TABLE_NAME = B.TABLE_NAME
      9*   and b.index_name = b.constraint_name
    SQL> /
    INDEX_NAME                     TABLE_NAME                     TABLE_TYPE  CONSTRAINT_NAME                C
    SYS_C0034289                   CARGOS_T                       TABLE       SYS_C0034289                   P
    SQL> alter table cargos_t
      2  add constraint uk_nm_cgo unique (nm_cgo);
    Table altered.
    SQL> select A.INDEX_NAME,
      2         A.TABLE_NAME,
      3         A.TABLE_TYPE,
      4         B.CONSTRAINT_NAME,
      5         B.CONSTRAINT_TYPE
      6  from user_indexes A,  USER_CONSTRAINTS B
      7  where A.table_name in ('CARGOS_T')
      8    AND A.TABLE_NAME = B.TABLE_NAME
      9    and b.index_name = b.constraint_name
    10  /
    INDEX_NAME                     TABLE_NAME                     TABLE_TYPE  CONSTRAINT_NAME                C
    SYS_C0034289                   CARGOS_T                       TABLE       SYS_C0034289                   P
    UK_NM_CGO                      CARGOS_T                       TABLE       SYS_C0034289                   P
    SYS_C0034289                   CARGOS_T                       TABLE       UK_NM_CGO                      U
    UK_NM_CGO                      CARGOS_T                       TABLE       UK_NM_CGO                      UAs you may notice, Oracle also creates indexes for Unique keys.
    This is the reason why I associated constraints with indexes. But you are right when you say they are different objects in the database.
    Regards,
    Marcos
    Message was edited by:
    Marcos Spínola

  • CMP relationships

    Good day all. I have a question about establishing 1:M relationship in CMP.
    More specifically I am geting the following error
    [EJB:011017]Error while reading 'META-INF/weblogic-cmp-rdbms-jar.xml'. The error was:
    In relationship 'THREAD-POST', role 'Thread-Contains-Posts', a weblogic-relationship-role element contains the wrong number of column mappings. A single column mapping must be given for each primary key column in the bean referenced by the mapping.
    Here is my ejb-jar code
    <ejb-relation>
    <ejb-relation-name>THREAD-POST</ejb-relation-name>
    <ejb-relationship-role>
    <ejb-relationship-role-name>Thread-Contains-Posts</ejb-relationship-role-name>
    <multiplicity>One</multiplicity>
    <relationship-role-source>
    <ejb-name>Thread</ejb-name>
    </relationship-role-source>
    <cmr-field>
    <cmr-field-name>posts</cmr-field-name>
    <cmr-field-type>java.util.Collection</cmr-field-type>
    </cmr-field>
    </ejb-relationship-role>
    <ejb-relationship-role>
    <ejb-relationship-role-name>Post-Resides-in-Thread</ejb-relationship-role-name>
    <multiplicity>Many</multiplicity>
    <cascade-delete/>
    <relationship-role-source>
    <ejb-name>Post</ejb-name>
    </relationship-role-source>
    <cmr-field> <cmr-field-name>localthread</cmr-field-name>
    </cmr-field>
    </ejb-relationship-role>
    </ejb-relation>
    and weblogic code
    <weblogic-rdbms-relation>
    <relation-name>THREAD-POST</relation-name>
    <weblogic-relationship-role>
    <relationship-role-name>Thread-Contains-Posts</relationship-role-name>
    <relationship-role-map>
    <foreign-key-table>POST</foreign-key-table>
    <primary-key-table>THREAD</primary-key-table>
    <column-map>
    <foreign-key-column>thread</foreign-key-column>
    <key-column>id</key-column>
    </column-map>
    </relationship-role-map>
    </weblogic-relationship-role>
    </weblogic-rdbms-relation>
    Bean Thread has PK id which is matched to a foreign key thred in the Post bean.
    Where did it all go so wrong?
    Bean Post has attributes id(PK),text,

    hi,
    can you able to post your code so that i can try
    with it.

  • Cmp and required transaction

    Hi,
    I have a session bean starting a transaction ("requires new" in ejb descriptor),
    that bean is calling another session bean which has "required", this one is then
    setting some attributes in a CMP (setXxx), that also has required and then it
    throws an exception, the first session bean catches it and rolls back. But when
    I check in the db the value set by setXxx has been updated, shouldn't the whole
    transaction be rolled back?
    Thanks,
    A.

    Hi,
    I have a session bean starting a transaction ("requires new" in ejb descriptor),
    that bean is calling another session bean which has "required", this one is then
    setting some attributes in a CMP (setXxx), that also has required and then it
    throws an exception, the first session bean catches it and rolls back. But when
    I check in the db the value set by setXxx has been updated, shouldn't the whole
    transaction be rolled back?
    Thanks,
    A.

  • One to one CMP relationship... Table Structure

    Table : Person
    Person_ID
    First_Name
    Last_Name
    Table:Role
    Person_ID
    Role_Name
    Role_Details

    Hi,
    Circular relationship are never supported by any server, an example would be
    A has a relation with B, B has a relation with C, and C to A
    Self relation means A has a relation with its own kind (A).
    If a bean A has relation with B and B has relation with A, you dont call it circular its bidirectional relation.
    Basically directionality depends how do you want to navigate your relations, viz., which bean needs to keep track of which bean.
    Regards
    Meka Toka
    PS: And yeah, environment means, what server you are using, what OS, what version number etc etc.

  • Table Relationship (REFERENCES/CONSTRAINTS)

    Hello,
    I am a novice user of SQL Plus and have the following question to be able to easier join Oracle tables:
    Which statement should I use to be able to view from table A all possible links to other tables (FK, PK)?
    I have been looking at following tables, but cannot get it together:
    ALL_CONSTRAINTS
    ALL_CONS_COLUMNS
    ALL_DEPENDENCIES
    Anybody can?

    Stefan -
    FKs can be listed with the following sql script:
    accept schema_name prompt 'Enter the schema name : '
    column referencing_table heading 'Referencing Table' format a30
    column referencing_column heading 'Referencing Column' format a30
    column referenced_table heading 'Referenced Table' format a30
    column referenced_column heading 'Referenced Column' format a30
    column constraint_name heading 'Foreign Key Name' format a30
    ttitle 'Foreign Key (&schema_name) Report'
    break on referencing_table duplicates skip 1
    spool fk_&schema_name
    select
    dc.table_name as referencing_table,
    dcc.column_name as referencing_column,
    dic.table_name as referenced_table,
    dic.column_name as referenced_column
    from
    dba_constraints dc,
    dba_cons_columns dcc,
    dba_ind_columns dic
    where
    dc.owner = dcc.owner and
    dc.constraint_name = dcc.constraint_name and
    dc.table_name = dcc.table_name and
    dic.index_owner = dc.owner and
    dic.table_owner = dc.owner and
    dcc.position = dic.column_position and
    dc.r_constraint_name = dic.index_name and
    dc.owner = upper('&schema_name') and
    dc.constraint_type = 'R'
    order
    by 1,2,3,4
    spool off
    You can certianly prompt for a table name for either the referenced or referencing table also.
    I'll leave it to you to play with variations to get the Primary and Unique key constraints.
    Hope this helps-
    Mark

  • Trigger & Mutating Tables (Parent-Child relationship, Referencing Constraint related)

    Dear Sir,
    Wish you a very Happy New Year !!!
    I am facing a problem related to Database Trigger.
    Sir, I have two tables Cust and Sick.
    Cust is having the following fields :
    SDF_CUST_BRCD NOT NULL NUMBER(5)
    CUST_CUSTID NOT NULL VARCHAR2(6)
    UCD_CUST_SEGMENTCODE NOT NULL VARCHAR2(7)
    CUST_FIRSTBORROWER NOT NULL VARCHAR2(30)
    UCD_CUST_CONSTORGCODE NOT NULL VARCHAR2(7)
    VLGC_CUST_VILLAGECODE VARCHAR2(4)
    CUST_PAN VARCHAR2(20)
    UCD_CUST_STAFFCODE VARCHAR2(7)
    CUST_RESIDENTSTATFLAG VARCHAR2(1)
    CUST_BKGSINCEDATE DATE
    UCD_CUST_SICKUNITCODE VARCHAR2(7)
    Cust's Primary Key is the combination of Brcd, CustId
    And Sick Table Structure is as under :
    PRDT_SICK_REPORTDATE NOT NULL DATE
    CUST_SICK_BRCD NOT NULL NUMBER(5)
    CUST_SICK_CUSTID NOT NULL VARCHAR2(6)
    UCD_SICK_REASONCODE NOT NULL VARCHAR2(7)
    SICK_SINCEDATE NOT NULL DATE
    SICK_LOSSMAKINGDATE DATE
    SICK_ACCMLOSSAMT NUMBER(16,2)
    UCD_SICK_VIABILITYCODE NOT NULL VARCHAR2(7)
    UCD_BIFR_STATUS_CODE VARCHAR2(7)
    SICK_BIFRDATE DATE
    SICK_REHABSANCDATE DATE
    CUST_SICK_SICKUNITCODE VARCHAR2(7)
    Sick's Primary Key is the combination of ReportDate, BrCD, Custid
    Sick's (Brcd and Custid) referencing to Cust (BrCd, CustId).
    I want to insert/update into the sick table corrponding to Cust
    Insertion/Updation.
    I have written a trigger on Cust which is working fine provided
    that foreign key constraint
    is diabled. As soon as constraint is enabled the trigger is
    giving error
    ORA-04091: table CIS.CUST is mutating, trigger/function may not
    see it
    Sir, It is also working fine if the record is already exist in
    Sick table.
    Is is not working in 2 cases :
    1. While entering a new record into the Cust with
    SICKUNIT_CODE='SW00001'
    2. If we are changing the SickUnit_Code in Cust and correponding
    record doesn't exist in Sick.
    Please write me the solution.
    Thanking you
    yours sincerely
    Rajesh Kumar Jain
    Trigger Text is
    create or replace trigger tr_cust_sick
    after insert or update on Cust for each row
    declare
    Fn_Return boolean;
    Tr_Exception Exception;
    begin
    Fn_Return := Fn_cust_sick
    (:new.UCD_CUST_SICKUNITCODE,:new.SDF_CUST_BRCD,:new.CUST_CUSTID,I
    NSERTING,UPDATING,DELETING);
    If Not Fn_Return then
    Raise Tr_Exception;
    End if;
    exception
    when Tr_Exception then
    Dbms_output.put_line('Tr_Exception ' ||Sqlerrm);
    When others then
    Dbms_output.put_line(Sqlerrm);
    end;
    Function Text is :
    $$$$$$$$$
    create or replace function fn_cust_sick
    (SickUnitCode_in In Cust.Ucd_Cust_SickunitCode%Type,Brcd_in In
    Sdf.Sdf_Brcd%Type,Custid_in In Cust.Cust_Custid%
    Type,Inserting_in In Boolean ,Updating_in In Boolean,Deleting_in
    In Boolean)
    return boolean is
    ddate date default '01-Jul-1955';
    repdate ppar.ppar_reportdate%type default '31-Mar-2001';
    viabcode sick.ucd_sick_viabilitycode%type default 'VI00000';
    ReasonCD sick.ucd_sick_reasoncode%type default 'SK00000';
    Ret_Flag Boolean := False;
    begin
    if Updating_in then
    begin
    update sick
    set CUST_SICK_SICKUNITCODE = SickUnitCode_in
    where prdt_sick_reportdate = repdate and
    cust_sick_brcd = Brcd_in and
    Cust_Sick_CustId = Custid_in;
         Ret_Flag := True;
    if sql%notfound then
    if To_Number(Substr(SickUnitCode_in,3)) > 0 then
    insert into sick
    (PRDT_SICK_REPORTDATE,
    CUST_SICK_BRCD,
    CUST_SICK_CUSTID,
    UCD_SICK_REASONCODE,
    SICK_SINCEDATE,
    UCD_SICK_VIABILITYCODE,
    CUST_SICK_SICKUNITCODE,
              SUBO_SICK_SICKBORRCODE)
    values
    (repdate,
    Brcd_in,
    Custid_in,
    reasoncd,
    ddate,
    viabcode,
    SickUnitCode_in,
              'SB00001');
    Ret_Flag := True;
         Return(Ret_Flag);
         end if;
    end if;
    exception
    when others then
    dbms_output.put_line('Exception Update '|| Sqlerrm);
    return(Ret_Flag);
    end;
    elsif Inserting_in then
    begin
    if To_Number(Substr(SickUnitCode_in,3)) > 0 then
    insert into sick
    (PRDT_SICK_REPORTDATE,
    CUST_SICK_BRCD,
    CUST_SICK_CUSTID,
    UCD_SICK_REASONCODE,
    SICK_SINCEDATE,
    UCD_SICK_VIABILITYCODE,
    CUST_SICK_SICKUNITCODE,
              SUBO_SICK_SICKBORRCODE)
    values
    (repdate,
    Brcd_in,
    Custid_in,
    reasoncd,
    ddate,
    viabcode,
    SickUnitCode_in,
              'SB00001');
    Ret_Flag := True;
    end if;
         Return(Ret_Flag);
    exception
    when others then
    dbms_output.put_line('Exception Insert '|| Sqlerrm);
    return(Ret_Flag);
    end;
    end if;
    return(Ret_Flag);
    exception
    when Others then
    dbms_output.put_line('Main Exception '|| Sqlerrm);
    return(Ret_Flag);
    end;
    $$$$$$$$$$$

    Hi,
    double click the Application Module to open the AM editor. Select the data Model category. On the right hand side you see what is selected for use in an application, on the left hand side is what you have available as View Object. To create T1-->T2-->T3, you
    - Select T1 and move it to the right
    - Select T2 under T1 on the left and move it to the right under T1
    - Select T3 under T2 on the left and move it under T2 in T1 on the right
    Frank

  • Ejb relationships using cmp field

    I have defined a cmp relationship using cmr field. Als defined getter/setter for that field.
    When I call the getter method container returns all the records for relation.
    getter/setter is implemented by container.
    My question is can we define in which order relationships record should be retrieved. I mean can we specify Order By caluse for that.

    if you want to do this you just have to use Map on collection side of your relationship like this:
    @OneToMany(cascade={CascadeType.ALL})
        @JoinColumn(name="CUSTOMER_ID")
    @MapKey(name="number")
    @OrderBy
    ("number ASC")
        public Map<String, Phone> getPhoneNumbers

  • Is it dependency or constraint

    I have a custom Exception class. I am using it in my other client classes.
    Is this relationship is association / dependancy / constraint. .
    I also want to know what is meant by Constraint ?

    >>
    http://faramir.rug.ac.be/courses/soot1/dungeon/uml.html
    Yes, they make the same error wrt cardinality and
    associations. Specifically, a constraint on the
    cardinality of an association would constrain how many
    links of that association type may occur, whereas a
    constraint on the cardinality of an association
    end will constrain how many object references
    that end may be linked to. It is important that these
    concepts are not confused.
    If you are interested in using UML, you should take
    time to read the UML specifications, available at
    omg.org, the standards body responsible for UML.
    They are quite verbose compared to a single page crib
    sheet, but part of having a standard, universal
    language for modelling OO concepts is using the
    terminology correctly.
    PeteAs per
    http://www.holub.com/goodies/uml/index.html
    Constraint A constrained relationship requires some rule to be applied. (e.g. {ordered}) Often combined with aggregation, composition, etc.
    http://www.ajug.org/info/tech/uml/uml.html also has a good explanation
    This is what the UML spec says at
    http://www.omg.org/docs/formal/03-03-10.pdf
    "A constraint is a semantic relationship among model elements that specifies conditions
    and propositions that must be maintained as true; otherwise, the system described by
    the model is invalid (with consequences that are outside the scope of UML). Certain
    kinds of constraints (such as an association �xor� constraint) are predefined in UML,
    others may be user-defined. A user-defined constraint is described in words in a given
    language, whose syntax and interpretation is a tool responsibility. A constraint
    represents semantic information attached to a model element, not just to a view of it."
    There is also a figure depicting an example.
    It further states
    "For two graphical symbols (such as two classes or two associations), the constraint is
    shown as a dashed arrow from one element to the other element labeled by the
    constraint string (in braces). The direction of the arrow is relevant information within
    the constraint. The client (tail of the arrow) is mapped to the first position and the
    supplier (head of the arrow) is mapped to the second position in the constraint."
    So in response to the OP's question
    Is this relationship is association / dependancy / constraint. .
    It is a dependancy as constraint in itself is not a relationship but on a relationship.

  • Cmp dependant object

    does anybody have a working example of a ejb20 bean that uses dependant
    objects with a CMP relationship. I am trying to do a simple relationship
    where an ejb has a Collection of dependant objects.
    I cant get past the xml parsing errors when ejbc is run.
    The error is
    ERROR: weblogic.xml.process.XMLParsingException: The content of element
    type "ej
    b-jar" must match
    "(description?,display-name?,small-icon?,large-icon?,enterpris
    e-beans,dependents?,relationships?,assembly-descriptor?,ejb-client-jar?)".
    - wit
    h nested exception:
    [org.xml.sax.SAXParseException: The content of element type "ejb-jar"
    must match
    "(description?,display-name?,small-icon?,large-icon?,enterprise-beans,dependent
    s?,relationships?,assembly-descriptor?,ejb-client-jar?)".] Line: 152
    Column: 11
    here is the ejb-jar.xml file:
    <?xml version="1.0"?>
    <!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise
    JavaBeans 2.0//EN" "http://java.sun.com/j2ee/dtds/ejb-jar_2_0.dtd">
    <ejb-jar>
    <enterprise-beans>
    <entity>
    <ejb-name>SurveyEJB</ejb-name>
    <home>erm.com.clickaction.erm.surveys.ejb20.SurveyHome</home>
    <remote>erm.com.clickaction.erm.surveys.ejb20.Survey</remote>
    <ejb-class>erm.com.clickaction.erm.surveys.ejb20.SurveyBean</ejb-class>
    <persistence-type>Container</persistence-type>
    <prim-key-class>java.lang.Long</prim-key-class>
    <reentrant>False</reentrant>
    <cmp-version>2.x</cmp-version>
    <abstract-schema-name>SurveyBean</abstract-schema-name>
    <cmp-field>
    <field-name>surveyKey</field-name>
    </cmp-field>
    <cmp-field>
    <field-name>clientKey</field-name>
    </cmp-field>
    <cmp-field>
    <field-name>name</field-name>
    </cmp-field>
    <cmp-field>
    <field-name>description</field-name>
    </cmp-field>
    <cmp-field>
    <field-name>version</field-name>
    </cmp-field>
    <primkey-field>surveyKey</primkey-field>
    <query>
    <query-method>
    <method-name>findAllSurveys</method-name>
    <method-params/>
    </query-method>
    <ejb-ql><![CDATA[WHERE surveyKey is not null]]></ejb-ql>
    </query>
    </entity>
    <entity>
    <ejb-name>TopicEJB</ejb-name>
    <home>erm.com.clickaction.erm.surveys.ejb20.TopicHome</home>
    <remote>erm.com.clickaction.erm.surveys.ejb20.Topic</remote>
    <ejb-class>erm.com.clickaction.erm.surveys.ejb20.TopicBean</ejb-class>
    <persistence-type>Container</persistence-type>
    <prim-key-class>java.lang.Long</prim-key-class>
    <reentrant>False</reentrant>
    <cmp-version>2.x</cmp-version>
    <abstract-schema-name>TopicBean</abstract-schema-name>
    <cmp-field>
    <field-name>topicKey</field-name>
    </cmp-field>
    <cmp-field>
    <field-name>name</field-name>
    </cmp-field>
    <cmp-field>
    <field-name>description</field-name>
    </cmp-field>
    <primkey-field>topicKey</primkey-field>
    <query>
    <query-method>
    <method-name>findAllTopics</method-name>
    <method-params/>
    </query-method>
    <ejb-ql><![CDATA[WHERE topicKey is not null]]></ejb-ql>
    </query>
    </entity>
    </enterprise-beans>
    <assembly-descriptor>
    <container-transaction>
    <method>
    <ejb-name>SurveyEJB</ejb-name>
    <method-intf>Remote</method-intf>
    <method-name>*</method-name>
    </method>
    <trans-attribute>Required</trans-attribute>
    </container-transaction>
    <container-transaction>
    <method>
    <ejb-name>TopicEJB</ejb-name>
    <method-intf>Remote</method-intf>
    <method-name>*</method-name>
    </method>
    <trans-attribute>Required</trans-attribute>
    </container-transaction>
    </assembly-descriptor>
    <dependents>
    <dependent>
    <description>Topic</description>
    <dependent-class>erm.com.clickaction.erm.surveys.ejb20.Topic</dependent-class>
    <dependent-name>Topic</dependent-name>
    <cmp-field><field-name>topicKey</field-name></cmp-field>
    <cmp-field><field-name>name</field-name></cmp-field>
    <cmp-field><field-name>description</field-name></cmp-field>
    <pk-field>topicKey</pk-field>
    </dependent>
    </dependents>
    <relationships>
    <ejb-relation>
    <ejb-relation-name>Survey-Topic</ejb-relation-name>
    <ejb-relationship-role>
    <ejb-relationship-role-name>survey-has-topics</ejb-relationship-role-name>
    <multiplicity>one</multiplicity>
    <role-source><ejb-name>SurveyEJB</ejb-name></role-source>
    <cmr-field>
    <cmr-field-name>topics</cmr-field-name>
    <cmr-field-type>java.util.Collection</cmr-field-type>
    </cmr-field>
    </ejb-relationship-role>
    <ejb-relationship-role>
    <ejb-relationship-role-name>topics-belongto-survey</ejb-relationship-role-name>
    <multiplicity>many</multiplicity>
    <cascade-delete/>
    <role-source><dependent-name>TopicEJB</dependent-name></role-source>
    <cmr-field>
    <cmr-field-name>survey</cmr-field-name>
    </cmr-field>
    </ejb-relationship-role>
    </ejb-relation>
    </relationships>
    </ejb-jar>
    thanks
    simon evans
    [email protected]

    Hi Simon,
    I'm reposting your message to the ejb group where you can get more help. This group
    is monitored more for issues regarding general product usability feedback, rather
    than "how to" issues.
    However, I do see you've uncovered a usability issue in as much as you couldn't find
    appropriate documentation or examples to help understand the problem. Moreover, you
    weren't able to figure out what to do next using the ejbc compiler error messages.
    I'll take a look at the problem from this point of view.
    In the mean time, ejb team, can you lend a hand?
    dan
    simon wrote:
    does anybody have a working example of a ejb20 bean that uses dependant
    objects with a CMP relationship. I am trying to do a simple relationship
    where an ejb has a Collection of dependant objects.
    I cant get past the xml parsing errors when ejbc is run.
    The error is
    ERROR: weblogic.xml.process.XMLParsingException: The content of element
    type "ej
    b-jar" must match
    "(description?,display-name?,small-icon?,large-icon?,enterpris
    e-beans,dependents?,relationships?,assembly-descriptor?,ejb-client-jar?)".
    - wit
    h nested exception:
    [org.xml.sax.SAXParseException: The content of element type "ejb-jar"
    must match
    "(description?,display-name?,small-icon?,large-icon?,enterprise-beans,dependent
    s?,relationships?,assembly-descriptor?,ejb-client-jar?)".] Line: 152
    Column: 11
    here is the ejb-jar.xml file:
    <?xml version="1.0"?>
    <!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise
    JavaBeans 2.0//EN" "http://java.sun.com/j2ee/dtds/ejb-jar_2_0.dtd">
    <ejb-jar>
    <enterprise-beans>
    <entity>
    <ejb-name>SurveyEJB</ejb-name>
    <home>erm.com.clickaction.erm.surveys.ejb20.SurveyHome</home>
    <remote>erm.com.clickaction.erm.surveys.ejb20.Survey</remote>
    <ejb-class>erm.com.clickaction.erm.surveys.ejb20.SurveyBean</ejb-class>
    <persistence-type>Container</persistence-type>
    <prim-key-class>java.lang.Long</prim-key-class>
    <reentrant>False</reentrant>
    <cmp-version>2.x</cmp-version>
    <abstract-schema-name>SurveyBean</abstract-schema-name>
    <cmp-field>
    <field-name>surveyKey</field-name>
    </cmp-field>
    <cmp-field>
    <field-name>clientKey</field-name>
    </cmp-field>
    <cmp-field>
    <field-name>name</field-name>
    </cmp-field>
    <cmp-field>
    <field-name>description</field-name>
    </cmp-field>
    <cmp-field>
    <field-name>version</field-name>
    </cmp-field>
    <primkey-field>surveyKey</primkey-field>
    <query>
    <query-method>
    <method-name>findAllSurveys</method-name>
    <method-params/>
    </query-method>
    <ejb-ql><![CDATA[WHERE surveyKey is not null]]></ejb-ql>
    </query>
    </entity>
    <entity>
    <ejb-name>TopicEJB</ejb-name>
    <home>erm.com.clickaction.erm.surveys.ejb20.TopicHome</home>
    <remote>erm.com.clickaction.erm.surveys.ejb20.Topic</remote>
    <ejb-class>erm.com.clickaction.erm.surveys.ejb20.TopicBean</ejb-class>
    <persistence-type>Container</persistence-type>
    <prim-key-class>java.lang.Long</prim-key-class>
    <reentrant>False</reentrant>
    <cmp-version>2.x</cmp-version>
    <abstract-schema-name>TopicBean</abstract-schema-name>
    <cmp-field>
    <field-name>topicKey</field-name>
    </cmp-field>
    <cmp-field>
    <field-name>name</field-name>
    </cmp-field>
    <cmp-field>
    <field-name>description</field-name>
    </cmp-field>
    <primkey-field>topicKey</primkey-field>
    <query>
    <query-method>
    <method-name>findAllTopics</method-name>
    <method-params/>
    </query-method>
    <ejb-ql><![CDATA[WHERE topicKey is not null]]></ejb-ql>
    </query>
    </entity>
    </enterprise-beans>
    <assembly-descriptor>
    <container-transaction>
    <method>
    <ejb-name>SurveyEJB</ejb-name>
    <method-intf>Remote</method-intf>
    <method-name>*</method-name>
    </method>
    <trans-attribute>Required</trans-attribute>
    </container-transaction>
    <container-transaction>
    <method>
    <ejb-name>TopicEJB</ejb-name>
    <method-intf>Remote</method-intf>
    <method-name>*</method-name>
    </method>
    <trans-attribute>Required</trans-attribute>
    </container-transaction>
    </assembly-descriptor>
    <dependents>
    <dependent>
    <description>Topic</description>
    <dependent-class>erm.com.clickaction.erm.surveys.ejb20.Topic</dependent-class>
    <dependent-name>Topic</dependent-name>
    <cmp-field><field-name>topicKey</field-name></cmp-field>
    <cmp-field><field-name>name</field-name></cmp-field>
    <cmp-field><field-name>description</field-name></cmp-field>
    <pk-field>topicKey</pk-field>
    </dependent>
    </dependents>
    <relationships>
    <ejb-relation>
    <ejb-relation-name>Survey-Topic</ejb-relation-name>
    <ejb-relationship-role>
    <ejb-relationship-role-name>survey-has-topics</ejb-relationship-role-name>
    <multiplicity>one</multiplicity>
    <role-source><ejb-name>SurveyEJB</ejb-name></role-source>
    <cmr-field>
    <cmr-field-name>topics</cmr-field-name>
    <cmr-field-type>java.util.Collection</cmr-field-type>
    </cmr-field>
    </ejb-relationship-role>
    <ejb-relationship-role>
    <ejb-relationship-role-name>topics-belongto-survey</ejb-relationship-role-name>
    <multiplicity>many</multiplicity>
    <cascade-delete/>
    <role-source><dependent-name>TopicEJB</dependent-name></role-source>
    <cmr-field>
    <cmr-field-name>survey</cmr-field-name>
    </cmr-field>
    </ejb-relationship-role>
    </ejb-relation>
    </relationships>
    </ejb-jar>
    thanks
    simon evans
    [email protected]

  • CMP Entity Bean with database specific features

    Hi there,
    I�m studying Entity Beans and I'm doing some experiences with SQL Server.
    At first, I built a CMP Bean and marked in deploytool to create the tables. Ok, it worked.
    Now, I'm trying to interact to an existent database. But, I got a problem: the primary key is defined by the Server. I can read it and I can remove entries. But, when I try to insert some entry, I can't pass the key in SQL statement. I edited the generated statement to do it, but it doesn't work. I get a RollbackException.
    My question is: is it possible to do what I'm intending to do with CMP? What am I doing wrong?
    Do you think that, to do this, I should use BMP Entity beans?
    Thanks in advance,
    Anicio

    "CMP provides you with database independence and less coding efforts."
    BMP is not database dependent, unless you invoke database specific things in your SQL (something I do not do). CMP on the otherhand is inherently appserver specific (which was it's goal when BEA, IBM, et al. came up with it), and still limits your design possibilities. See this thread for an example:
    http://forum.java.sun.com/thread.jsp?forum=13&thread=318785
    As for less coding effort, that is a relative statment. Yes a simple CMP bean requires less coding to develop the first time. I personally view a few lines of SQL to load and store the data as being fairly trivial. But that needs to be offset with the problems inherent in using appserver specific CMP implementations.
    As an example, try mapping WebSphere CMP to a pre-existing database without using IBM's IDE. It's an incredible pain in the ass since WebSphere does not come with a "meet-in-the-middle" solution. Any J2EE developer that has had the experience of working with different appservers (especially if they have had to port an app, as I have) can attest to the complications that arise with each implementation.
    A BMP bean, written with non-DB-specific SQL, is the most portable, most flexible approach to EntityBeans. Yes, it requires the developer to be able to write some SQL, which should not take a significant amout of time. WRT queries, you have to write them, either SQL, EQL, or some appserver specific format.
    As an aside, the use of code generators to simplify the creation of EJBs lends itself well to BMP. By using a (or writing your own) code generator, you can mitigate the annoying SQL bugs that creep up early in development.

  • Defining cmp-relation to EB contained in different ejb module project

    Hello,
    I have to migrate an existing J2EE Application to SAP NetWeaver and WebAS. My task is to keep the structure as similar as possible to increase the recognition factor although using Developer Studio as IDE.
    In this application there are cmp relations defined that reference EntityBeans from other sub projects (that I tried to create in different ejb module projects).
    References in the same ejb module project seem to work fine but I cannot select referenced EntityBeans of other projects as relation target.
    Another remark:
    In the given application the ejb-jar.xml-file of the referencing component contains entries of the referenced one. The Developer Studio allows to Add EJBs to ejb-jar.xml, even referenced Beans. But when I select to add referenced EJBs only the Beans of the current project can be chosen. (I did not forget to enter an ejb-local-ref from the referencing to the referenced Bean in ejb-jar.xml as well)
    Can anyone give me a hint on how to solve this task? Or where I have forgotten to add a reference?
    Thanks
    Daniel

    Hello Viliana,
    Hello everybody else!
    I'm currently writing the corresponding masterthesis to my project. That's why I have to deal with this "problem" again.
    I tried to look up the part of the spec Viliana's hint ("When you create and use cmp-relationships your beans must be included in one and the same JAR file (that's according to the EJB specification)") bases on.
    But the only thing I found addressing this issue tells something else:
    "[...]Container-managed relationships can exist only among entity beans within the same local relationship
    scope,[...]" (EJBSpec2.1, section 10.3.2)
    In my opinion this does not necessarily mean that they have to be in the same JAR but in the same EAR file...
    This would mean, that the chosen cmp-relationships strategy with ejb-module-projects is too restrictive.
    Can anyone help me with this... Does anyone know further hints on how Entity Beans have to be deployed when belonging to cmp-relationships?
    Thanks a lot for any hint on this
    Best regards,
    Daniel

  • Help required specifying Transation attributes for this scenario

    Hi ,
    I am trying to create/update rows in a database using BMP and CMP beans.
    A business method ( Method1 )in session bean calls a non-business method ( Method2) in the same session bean which inturn calls an EntityBean ( EB1-BMP) . EB1 can throw a certain business exception upon which , the Method1 in the session bean calls another EntityBean in a loop( EB2-CMP).
    The problem is that , when the EB1 throws the business exception, i am getting an exception ( part of the stack trace attached below ).
    Could any please explain what should be the transaction attributes to be specified for this scenario.
    Using RequiresNew for the EntityBeans would not work ( or would it ?? ) because the entity bean is being called in a loop and the commit or rollback should happen for all the methods.
    I feel the problem should be solved by specifying the transaction attribute for Method2 ( non business method in session bean ) as Required, but i guess this is not possible.
    How exactly will the transaction behave in this scenario, is the exception caused because EB1 has thrown an exception and i am trying to continue the transaction.
    Could someone please suggest a solution or workaround for this problem.
    Regards,
    Harsha
    ---- Begin backtrace for nested exception
    java.lang.IllegalStateException
    at com.ibm.ws.Transaction.JTA.TransactionImpl.enlistResource(TransactionImpl.java:1694)
    javax.ejb.EJBException: nested exception is: com.ibm.ws.ejbpersistence.utilpm.PersistenceManagerException: PMGR6022E: Error using adapter to create or execute an Interaction. com.ibm.ws.rsadapter.cci.WSInteractionImpl@28d16547
    .

    tryout business method ( Method1 )in session bean with transaction as RequiresNew.
    catch exception in Method2 originated from EB1-BMP
    make the method in EB2-CMP as Required/Mandatory
    I have made a guess here so just tryout and let me know if works.
    Its recommend that not to use both BMP's and CMPs in your application. Have any one either.

Maybe you are looking for

  • Scanning to edit

    hp8600 all in one printer, i would like to scan a doc to my computer so that i may edit it , my windows 8 laptop shows only pdf scan options, is there a way to upgrade or do ihave an another option

  • E71 music DRM Problems

    I've got my new e71, and have come across some very strange things. If I am using my Nokia-supplied 2GB SD card, I can download DRM music from Nokia, as well as copy DRM-protected music from Windows Media Player to the phone. If I am using a 3rd-part

  • ITunes won't display ipod contents

    I manage my ipod manually. I have upgraded to iTunes version 7.6.0.29. I can add music to my ipod, but I can't figure out how to get iTunes to display the music that is on my ipod so that I can delete some of it. How can I see a list of what is on th

  • Blackberry Screen Reader, features and functions

    Gestures when using the Blackberry Screen Reader indicates that to "Pan or scroll a list" that an audio cue indicates that the scrolling action is complete, and the BlackBerry Screen Reader updates the point of regard so that you can continue reading

  • Black monitor on premiere pro cc

    Hello, black monitor on premiere pro cc. I have tried different format and codecs, but still doesn't work. I can import the video file, the audio works fine, but I have no image on the screen. VLC, windows media player and quick time play the video f