Discussions

EJB design: AST6: Mapping EJB / RDB With Views in Oracle9

  1. AST6: Mapping EJB / RDB With Views in Oracle9 (1 messages)

    Hi to everyone, using AST6.1.1.8 (Websphere Application Server Toolkit), I'm trying to map some Entity Beans to objects in a Data Source based on Oracle 9i. Each Bean contains a string key field. The Data Source is composed by Tables and Views as well. Each Table has a Primary Key field, and each View has it too. In particular, the PKs of the Views are built using commands like: ALTER VIEW EJB_MYVIEW ADD CONSTRAINT PK_EJB_MYVIEW PRIMARY KEY (ID) DISABLE NOVALIDATE; (someone told me that this is the ONLY way to associate a PK to a View in Oracle9i) Importing the Data Source in AST6 I can see that: * Table PKs are imported correctly: I can see PK Constraints in the DDL file and nodes in the XML contained in the DBM file * View PKs are NOT imported: I can't see neither Constraints in DDL nor proper nodes in DBM So, while I can correctly associate some Entity Beans of mine to Tables, when mapping some other Entity Beans to Views, I can associate all fields except the key ones, for AST6 doesn't allow to associate a key field (in the Bean) with a non-key field (in the View, as key fields are seen as normal ones due to mis-importing) I could remove key fields from Beans, associate non-key bean fields with non-key view fields and then re-add the keys to the bean, but AST6 is so smart and raises errors. I also tried to build MATERIALIZED VIEWS instead of VIEWS by AST6 can't ever see them... :( Does everyone knows 1. how can I correctly import Views PKs into the AST6 Data Model or how can I add them manually (editing the DBM XML) OR 2. how can I associate key bean fields to non-key view fields (even manually) OR 3. anything else that can help me to move on from this mess in which I'm very stuck Many many many thanks in advance Marco
  2. A solution could be building the CMP Entity Beans to be mapped with the views WITHOUT any key field. Is it possible? If so, how could I do it? Thanks Marco