Creating Entity within a view

I have a View with two entities, Person and Address. The first has a foreign key identifying the Address entity and the view works fine. The reason for two Entities is that Addresses may be owned by other Entities too.
I want to write a method on the ViewPersonImpl that creates a new EntityAddress and links the PersonEntity to it. This represents a change of address of the Person.
It seems I have to do the following.
1) Create EntityPersonDefImpl.java
2) Write a public createInstance method that just calls EntityDefImpl.createInstance().
3) In ViewPersonImpl.changeAddress(), call this method and set the Person.AddressId attribute to the appropriate value from the returned Entity.
My first question is why I have to go to such lengths (steps 1 & 2) when I expected to only have to do step 3. Put another way, why is EntityDefImpl.createInstance() protected?
Secondly, after setting the AddressId, the method getEntityAddress() still returns the original EntityAddress. What more must I do to make this method return the new EntityAddress?
Code snippet:
EntityAddressesImpl lNewAddress = getEntityAddresses().cloneIt();
setAddressId(lNewAddress.getId());
if (lNewAddress != getEntityAddresses())
{   System.err.println("Entity not seen " + lNewAddress + ", " + getEntityAddresses());
Output:
Entity not seen Entity [oracle.jbo.Key[2187 ]], Entity [oracle.jbo.Key[2152 ]]
I've discovered that I can execute this code:
setEntity(1, lNewAddress);
Then everything seems to be plumbed correctly, but I must know that EntityAddresses is Entity #1. There is no setEntityAddresses(EntityAddressesImpl) method analagous to getEntityAddresses().
Is this the correct solution?
How do I discover an Entity's index?
Tony.

Hi,
A view is just a query stored in Oracle, you cannot have a index on a view, you can create on the table on which the view is based.
thanks

Similar Messages

  • Create Entity class from view

    Hello,
    Is it possible to use views in java persistence in the same way as tables (but just for fetching data)?
    Thanks in advance.

    hi,
    before doing this first consider the runtime usage of your appln. Will there be 2 separate appln modules that has its own entity objects..?
    creating 2 connections doesnt means that your eos will be used together?
    best is to make a single connection to a schema that has access to all tables of both the schema, with proper rights. next you create synonyms with proper access name i.e sch-name.tbl-name
    or else you can directly create entity object by this pattern. Right click the model project or any package in it and select create new eo from busniess components menu.
    Regards,

  • If statement within a view is not working correctly ?

    Hi all,
    maybe i am wrong but i think the if statement within a view is not working correctly. See code down below.
    I would like to use the Hallo World depending on the page attribute isFrame with or without all the neccessary html tags. Therefore i have embedded the htmlb tags in an if statement. But for any reason if isframe is initial it isn't working. It would be great if anybody could help me.
    <%@page language="abap"%>
    <%@extension name="htmlb" prefix="htmlb"%>
    <% if not isframe is initial. %>
      <htmlb:content design="design2003">
         <htmlb:page title = "Top Level Navigation view">
    <% endif. %>
    hallo world
    <% if not isframe is initial. %>
         </htmlb:page>
      </htmlb:content>
    <% endif. %>
    thanks in advance and best regards
    Matthias Hlubek

    Matthias,
    The short answer: your example is <b>NOT</b> going to work. The long answer will probably 5 pages to describe. So first let me rewrite the example so that it could work, and then give a short version of the long answer. Do not be disappointed if it is not totally clear. It is rather complicated. (See the nice form of IF statements that are possible since 620.)
    <%@page language="abap"%>
    <%@extension name="htmlb" prefix="htmlb"%>
    <% if isframe is <b>NOT</b> initial. %>
    <htmlb:content design="design2003">
      <htmlb:page title = "Top Level Navigation view">
        hallo world
      </htmlb:page>
    </htmlb:content>
    <% else. %>
      hallo world
    <% endif. %>
    So why does your example not work? Let us start with a simple tag:
      <htmlb:page title = "Top Level Navigation view">
      </htmlb:page>
    Now, for each tag, we have effectively the opening part (<htmlb:page>), an optional body, and then the closing part (</htmlb:page>). We are now at the level of the BSP runtime processing one tag. What the runtime does not know, is whether the tag wants to process its body or not. Each tag can decide dynamically at runtime whether the body should be processed. So the BSP compiler generates the following code:
      DATA: tag TYPE REF TO cl_htmlb_page.
      CREATE OBJECT tag.
      tag->title = 'Top Level Navigation view'.
      IF tag->DO_AT_BEGINNING( ) = CONTINUE.
      ENDIF.
      tag->DO_AT_END( ).
    You should actually just debug your BSP code at ABAP level, and then you will immediately see all of this. Now, let us mix in your example with our code generation. First you simplified example:
    <% if isframe is NOT initial. %>
      <htmlb:page title = "Top Level Navigation view">
    <% endif. %>
    <% if isframe is NOT initial. %>
      </htmlb:page>
    <% endif. %>
    And then with our generated code. Look specifically at how the IF/ENDIF blocks suddenly match!
    if isframe is NOT initial.
      DATA: tag TYPE REF TO cl_htmlb_page.
      CREATE OBJECT tag.
      tag->title = 'Top Level Navigation view'.
      IF tag->DO_AT_BEGINNING( ) = CONTINUE.
    endif.
    if isframe is NOT initial.
      ENDIF.
      tag->DO_AT_END( ).
    endif.
    You can see that your ENDIF statements are closing IF blocks generated by the BSP compiler. Such a nesting will not work. This is a very short form of the problem, there are a number of variations, and different types of the same problem.
    The only way to solve this problem, is probably to put the body into a page fragment and include it like I did above with the duplicate HelloWorld strings. But this duplicates source code. Better is to put body onto a view, that can be processed as required.
    brian

  • Unable to Create Entity Model from existing oracle database

    Hi,
    I am using Visual Studio 2013, .net framework 4.5, entity framework 5.0 and oracle 11g database.
    Issue Description: I need to develop WCF service to exposing the account information which needs to get the data from 20 oracle tables. Trying to create entity model from existing oracle database. first i tried creating just two tables it
    was created but it took more than 30 minutes. then i selected remaining few tables it took more than a days but nothing created just showing spinning the wheel. then i tried with fresh project and selected all the tables but same issue nothing created and
    also there is no error. during this process i checked database query monitoring there is a big sql statement collection tables metadata. i don't know what was wrong the query taking too much time to complete the  process.
    we tried multiple machine and different oracle database all are same issue.
    Sql server database -looks good no issues.
    Any help/tips/ideas welcome to overcome this issue.

    Hi Sakthimp,
    Welcome to MSDN forum.
    Your issue is out of support range of VS General Question forum which mainly discusses the usage of Visual Studio IDE such as
    WPF & SL designer, Visual Studio Guidance Automation Toolkit, Developer Documentation and Help System
    and Visual Studio Editor.
    Because your issue only occurred with oracle database, moreover Oracle developed the Entity Framework for Oracle itself, I suggest that you can consult your issue on Oracle forum/community:
    you will get better solution and support there.
    Best regards,
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How to add a scroll bar within a view window ?I want to display x and y axis outside the scoll window and keep those axis static and move the graph within scroll area

    how to add a scroll bar within a view window ?I want to display x and y axis outside the scoll window and keep those axis static and move the graph within scroll area
    ananya

    Hey Ananya,
    I believe what you want to do is possible, but it will not be
    easy.  If you want to add a scroll bar that will scroll the graph
    back and forth but keep the axis set, you would want to add a
    horizontal or vertical scrollbar.  Then you would create an event
    handler for the scroll event.  You would have to manually plot
    different data within this scroll event.  Unfortunately, there is
    not really a built in way to do this with the Measurement Studio plot
    control.
    Thanks,
    Pat P.
    Software Engineer
    National Instruments

  • How to outer join within a view link from (VO-VL-VO)

    I've got a table that stores the values of pre-defined attributes.
    I'd like to create an advancedTable region that shows all of the attributes with or without values, in my view object i have....
    select attribute, value
    from attributes, values
    where attributes.attribute_id = values.attribute_id (+)
    This is working, but a have another view object that is the master and this is the details.
    How can I do an outer join on the view link from master to detail? A simple (+) in the where condition does not do the trick.
    If I try anything fancy within the view link, I get a JBO-27122.
    Thank you,
    Jerry.

    Understand the concept of VL. Vl is nothing but a link between two VOs, with one VO row column serve as binding column for another VO.If u understand this u go to VL wizard and make VL declaratively. If not, refer to dev guide to know about VL.
    --Mukul                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Compare two records within a view

    Hi,
    I wonder if it is possible to compare two or more records within a view, and how to do it.
    Thanks in advance.

    M. Comi wrote:
    I wanted to compare two records of the view and see if they are the same or not...
    My data are as follows:
    Soglia Ingresso_CL_PF     10     10
    Downgrade MDP 3     2102     2101
    I want to check if the "downgrade" records have the same values for the second and the third column, and in this case replace the values on the second record.
    But I did it with a select on the same fields of the original tables, plus two fields obtained with lag function...
    I don't know if it is clear or not, the important is that I got what I wanted.Sorry, it's not clear.
    Are you still having a problem? If so:
    (1) Please describe the problem.
    (2) What results do you want to see from the sample data you posted?
    (3) Is the second column of
    Downgrade MDP 3 2102 2101'Downgrade', 'MDP', 3, 2102, 2101, some combination, or NULL? When posting data, the most helpful thing is to post INSERT (or CREATE TABLE AS ...) statements. The second-best thing is to post formatted data. Type &#123;code&#125; before and after sections where spacing is important, and post column headers.

  • Unable to create Entity objects for tables in TimesTen database using ADF

    Hi,
    I am not able to create Entity and View objects for tables in TimesTen database using ADF. I have installed TimesTen client on my machine.
    I have created a database connection by using connection type as "Generic JDBC" and giving driver class and JDBC URL. I am attaching screen shot of the same.
    I am right clicking on Model project and selecting New option after that I am selecting ADF Business components and in it I am selecting Business components from tables and there I am querying for tables.I am getting list of tables and when I am trying to create a Entity object from the table after clicking finish Jdev is closing by itself giving an error.
    Can anyone please help me how to create Entity objects for tables using TimesTen as database.I might be missing some jars or the way I am creating connection might be wrong or any plugins required to connect to TimesTen.

    What is the actual error being given by Jdev? Are you sure that the JDBC connection is using the TimesTen JDBC driver JAR and not some other JDBC driver or the Generic JDBC/ODBC bridge?
    Is ADF even supported with TimesTen?
    Chris

  • Trouble on Create Entity Object from AS400/DB2 version 5 rev 4

    Hi, hope any1 can help..
    I using jt400.jar (com.ibm.as400.access.AS400JDBCDriver) with
    jdbc url : jdbc:as400://host
    to create connection.
    However, when I try to create entity or business component based on the connection, it gave me "Attribute list error":
    java.lang.NullPointerException
         at oracle.jbo.dt.jdevx.db.DBApiUtil.fillAttributeListInternal2(DBApiUtil.java:1249)
         at oracle.jbo.dt.objects.JboDBUtil.fillAttributeListInternal2(JboDBUtil.java:87)
         at oracle.jbo.dt.objects.JboUtil.fillAttributeListInternal2(JboUtil.java:2749)
         at oracle.jbo.dt.objects.JboUtil.fillAttributeListWithException(JboUtil.java:2711)
         at oracle.jbo.dt.objects.JboUtil.fillAttributeListInternal(JboUtil.java:2687)
         at oracle.jbo.dt.objects.JboUtil.fillAttributeList(JboUtil.java:2626)
         at oracle.jbo.dt.objects.JboUtil.fillAttributeList(JboUtil.java:1059)
         at oracle.jbo.dt.ui.main.DtuUtil.createEntityFromThread(DtuUtil.java:562)
         at oracle.jbo.dt.ui.pkg.PKEntityThread.createEntity(PKEntityThread.java:898)
         at oracle.jbo.dt.ui.pkg.PKEntityThread.createEntity(PKEntityThread.java:719)
         at oracle.jbo.dt.ui.pkg.PKEntityThread.doEntityViewCreation(PKEntityThread.java:537)
         at oracle.jbo.dt.ui.pkg.PKEntityThread.createObjects(PKEntityThread.java:470)
         at oracle.jbo.dt.jdevx.ui.pkg.XPKComponentWizardEntityThread.createObjects(XPKComponentWizard.java:491)
         at oracle.jbo.dt.ui.pkg.PKEntityThread.run(PKEntityThread.java:447)
         at oracle.ide.dialogs.ProgressBar.run(ProgressBar.java:655)
         at java.lang.Thread.run(Thread.java:662)
    I had refer other posts, but i might miss out some important piece. Beside, I able to create ViewObject based on sql query. Any1 able to show me some direction..perhaps..thanks

    Thanks ...I tried both SQL92 and db2...and tried both Java & Java Extended for Oracle.. too..I able to connect to the dbase, browse thought the db2 schema n tables, even able to create view object with sql query..just stuck in entity object creation..feel weird n cant find much of documentation on the web to describe this behaviour too..

  • One Entity with multiple views

    Hi,
    My Jdev : 11.1.2.3.0
    I created entity like EmployeeEO and views like EmployeeView1, EmployeeView2, EmployeeView3 and EmployeeView4.(Single entity but multiple views).
    my requirement is how to use these views as panelTabed in 4 different tabs..
    issue :
    =====
    If i create single row in the  first tabs EmployeeView1, but other tabs views also automatically created the row. How to avoid that.
    Thanks,

    Take a look at:
    Maintaining New Row Consistency in View Objects Based on the Same Entity
    and
    How to Change the Default View Link Consistency Setting
    Advanced View Object Techniques - 11g Release 1 (11.1.1.6.0)

  • Import POJO create Entity Object?

    Is it possible to import a POJO and create an Entity Object + table from it?

    Hi,
    you cannot create Entity Object from POJO but you can use POJO based model to generate Data Control and work with it "like with Entity Object" in view layer.
    example: http://www.oracle.com/technology/products/jdev/tips/fnimphius/pojopagination/index.html
    regards,
    Branislav

  • MDB gets cannot find recently created Entity Bean

    I have a session bean that creates several entities beans, and puts a message onto
    JMS queue. A MDB is configured to read the queue, and in onMessage(), it calls
    findByPrimaryKey() for one of the newly created EntityBeans. However, the entity
    bean cannot be found.
    All of the beans in question are using container managed transactions, and all
    have transaction required. The entity bean that I'm looking for is using optimistic
    concurrency. I cannot change it to exclusive without redesigning a major part
    of the system, which have solved a similar problem that I encounted earlier that
    did not involve any message driven beans.
    The only way that I got it to work is put in Thread.sleep(5000) right before calling
    the finder. Does anyone know of any alternatives besides having the MDB sleep?

    No, this will work fine with the existing server. If the publish is
    part of the JTA transaction, then no one can consume the message until
    the original JTA transaction has committed.
    -- Rob
    Rajesh Mirchandani wrote:
    XA defines that a transaction's individual operations will either fail or
    succeed atomically. XA can not, and does not define that a transaction's
    individual operations occur exactly simultaneously.
    The WL transaction monitor does not currently provide a way to serialize a
    transactions commit operations on its component resource managers.
    There is an enhancement filed for this, I guess. Follow up with BEA support.
    Rob Woollen wrote:
    Vina Wang wrote:
    The JMS send is part of the transaction, sort of. The call is within
    the session
    bean transaction, but I'm not using transacted session for
    JMSPulisher. Would
    that fix the problem?Sadly this is a confusing aspect of JMS. You want a non-transacted
    session because you want it to participate in the global transaction
    that the EJB started. Also, make sure that you've enabled user
    transactions on your connection factory.
    There's more info here:
    http://edocs.bea.com/wls/docs70/faq/jms.html#252635
    Let us know if you're still having problems.
    -- Rob
    I know that the transaction hasn't been commited, but I was monitoring
    database
    via SQL call when I tried this. There was about 2 second delay on my
    development
    machine.
    Rob Woollen wrote:
    My guess is the MDB is receiving the message before your "create entity
    bean" transaction has committed. Is the JMS send part of the "create
    entity bean" transaction? It probably should be.
    You can easily prove this by writing a few lines of JDBC to hit the
    database and check for your primary key.
    I would not recommend changing to exclusive or using the Thread.sleep.
    -- Rob
    Vina Wang wrote:
    I have a session bean that creates several entities beans, and putsa
    message onto
    JMS queue. A MDB is configured to read the queue, and in onMessage(),
    it calls
    findByPrimaryKey() for one of the newly created EntityBeans. However,
    the entity
    bean cannot be found.
    All of the beans in question are using container managed transactions,
    and all
    have transaction required. The entity bean that I'm looking for is
    using optimistic
    concurrency. I cannot change it to exclusive without redesigning a
    major part
    of the system, which have solved a similar problem that I encounted
    earlier that
    did not involve any message driven beans.
    The only way that I got it to work is put in Thread.sleep(5000) right
    before calling
    the finder. Does anyone know of any alternatives besides having the
    MDB sleep?
    Rajesh Mirchandani
    Developer Relations Engineer
    BEA Support

  • At max how many columns is advisable to create in a table/view

    Hi All,
    I have two transaction table from which i want to create a simple view or materialized view. But the number of columns is about 200. So i want to know at max how many columns is advisable from the performance point of view.
    Even though i will create 200 columns in a view , for a perticular client installation i may not use all the columns.
    one more thing i will never use 200 columns in the select statement . At a time i will use only 4/5 columns.
    It may happen from this four column one column will be the 1st and 2nd column will be the 200th one.
    I want to know how it affects the performance and in which scenario . Please help if any body knows or already faced this kind of scenario.
    I am using oracle 10g .

    Annapurna Nayak wrote:
    thanks for ur reply .
    We are going to use this view in a report , so if i will create it as simple view it will affect report performance. because the view script is too long ...so every time quring to a view will decrease the performance.
    Are you asking me if it will? I think it probably won't but of course you have the means to test it to be sure, right?
    As u said MV should be done with minimum possible column . what can be the maximum column in MV ..??It would be defined by the limits on:
    * The maximum number of columns that a table can contain
    * The size of the query needed to define the select statement
    * Limitations on queries needed to maintain the data
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14237/limits003.htm#i288032

  • Create entity and human task

    Hello,
    I have a really simple process which includes a create entity activity. It works perfectly fine as data is inserted into the table and i can see everything is completed in the flow trace. Now, when i insert a human task after the create entity activity, things start going wrong. While i don't see any errors in the flow trace and all tasks are completed as planned, the BPEL component's state is showing as running and at the end of the flow i got the message "The transaction was rolled back. The work performed for bpel instance "123456" was rolled back to the previous dehydration point, but the audit trail has been saved...." It seems like it's waiting for something from the human task (even though it was completed successfully). As long as I leave this running, the process would try everyday from 12:00 AM to 4:00 AM every five minutes. That's another issue that i can't figure out. Can someone shed some light on this? Thank you.

    Hi,
    its best to post this question to the SOA forum. The answer on this forum would be to use a  page template, a parametrized bounded task flow and then add the bounded task flow to each page that has the template. However, the task flow in the HT case is generated, which means that you re-build it all the time (meaning you don't work with the same task flow but multiple). If you know how to just use the HT API to access the information to display, you could write a generic bounded task flow for this. Check on the SOA forum if they can come up with a template approach for your use case.
    Frank

  • How can I create a full-screen view of Keynote slide in Snow Leopard?

    How can I create a full-screen view of my Keynote slides in Snow Leopard?
    I'm going to be importing into ScreenFlow to create a video.
    Thank you!!

    Welcome to Apple Support Communities.
    Do you want static screen captures or motion video of slides as titles, bullet points, and the like are presented?
    Run the Keynote slide presentation in full-screen mode, then...
    Static full-screen captures - use Command+Shift+3.
    Static partial-screen captures - use Command+Shift+4 and use cursor to select the area of the screen to capture.
    If you want motion video as builds occur, why not use Keynote's built-in Share, Export function?
    (I'm on iLife '09.)
    Also understand that the default slide format for Keynote is 1024x768, not full-screen MacBook 1280x800 screen size, so you'll have wide black borders unless you change the default size or crop the finished screen captures.
    Message was edited by: kostby

Maybe you are looking for