find: problems with managed partners entities (associations 1-1)

Hello

Let's say we have this association:

FCalendar <>- contest

This association is bidirectional and one by one.

In addition, imagine that the database already contains a contest with the id 'Comp111 '.

I created:

Model contest = new Competition ("Comp111");
....
CAL FCalendar = new FCalendar("Cal111"); "Cal111" is the identifier of this calendar object.
cal.setCompetition (comp);
comp.setFCalendar (cal);

EntityManager em = getEntityManager(); This album Gets an EntityManager correctly.

em.getTransaction () .begin ();

EM. Persist (FCalendar.class, cal);

Here I cal as a managed entity. He points to the model of the unmanaged object.
When validation occurs, the FCalendar DB table will add a line for this calendar
with the value "Cal111" as a primary key and the 'Comp111' for the competition column
(i.e., the foreign key of the competition associated with cal will refer to the "Comp111" competition
Since the DB contains a contest with the same id as cal.getCompetition ())

FCalendar caldb = em.find (FCalendar.class, cal.getFCalendarId ());

Now I get a managed entity caldb pointing MANAGED an OTHER ENTITY (let's call it "compdb") which
a as the identifier "Comp111". This is the case, since the default recovery model is EAGER to associations 1-1.

Contest compdb = caldb.getCompetition ();

As I have explained, compdb is a managed entity.

compdb.setFCalendar (caldb);

In this way, I get the bidirectionnalite of the association. The competition management compdb now points to the caldb calendar.

em.getTransaction () .commit ();

The DB is synchronized. The contest of the comics with the id "Comp111" should point to the "Cal111" calendar and vice versa.

However, this is not the case. I get a competition since the database with the id "Comp111", its associated calendar is null (as if I have not defined any calendar).

What do miss me here? I would be very grateful if anyone can provide clues.

(BTW, I did this test with JPA and toplink persistence provider)

Joe

Published by: user632543 on June 2, 2013 04:50

Published by: user632543 on June 2, 2013 04:51

Not quite what I wanted. When you call persist, you place the entity instance in the collection of the MA of managed entities. She's going to get synchronized with the database when the transaction is committed or empty.

In your code:

EM. Persist (CAL);
FCalendar caldb = em.find (FCalendar.class, cal.getFCalendarId ());

will result in cal == caldb. They are the same instance. Nothing to get in the database until the transaction either emptied or committed, so the referenced competition can be the instance empty just created instead of a reading from the database. It's a bad idea to create empty instances of objects that exist in the database when you use a find or getReference instead. And you must set the backpointer competing.

Best regards
Chris

Tags: Fusion Middleware

Similar Questions

  • When I run the disk check to HP Support Assistant I find problems with smart control

    Hello

    My first question is this:

    When checking the disk i run assistant hp support I find smart check question so I said that to help defragment the disk in the defrtagmentation details I find everything to analyze if it's 10% or more then defragment now.

    but when I analyzed what I found 5%.

    What should I do to get rid of the smart check number?

    and my 2nd question is as follws:

    I have hp Pavilion dv6 2138ca laptop and windows 7 64-bit. I have problem with recovery manager that is built in hp and editor is cyberlink, he said that this program will not reinstall software not or the windows operating system.

    When I try to reinstall synaptics touchpad by reinstallation of hardware driver, getting the list of factory installed drivers. and it ends correctly and restart, once again, I see the same situation as it was before reinstalling.

    kindly help me by giving the valid link through which I can download the Recovery Manager validates windows 7 64 bit or offering a solution for this problem.

    Thank you

    Original title: maintenance

    Given that most of your problems is related to HP, it is best to contact the HP support:

    http://support.HP.com/

    To defragnment, you should have little empty space. Try running disk clean in the disc you have questions first, then defragnment.

  • Problem with managed server by pointing to a different JDK

    Hello

    My Adminserver is pointed to JDK 1.7 which is shown in the start, but my managed servers point to a different 1.6_43. We are running Java version mismatch problem while deploying our application created with jdk 1.7 on these managed servers. How can I change the version of my managed server?

    Thank you

    Sam

    Hi Sam,

    You usually only have to change it in two places.

    DOMAIN_HOME/bin/setDomainEnv.sh and MW_HOME/wlserver_12.1/common/bin/commEnv.sh

    See the examples below.

    If you are on Linux, you can address it quickly. For example:

    cd /u01/app/oracle/product/fmw
    find . -type f -exec sed -i "s/\/u01\/app\/oracle\/product\/jdk1.6.0_39/\/u01\/app\/oracle\/product\/java_current/g" {} \;
    

    It's a good idea to do a softlink to your installation of Java, so you will not have this problem in the future. If you are on Windows, you can use a symlink.

    Linux example:

    ln -s /u01/app/oracle/product/jdk1.7.0_25 /u01/app/oracle/product/java_current
    

    Example of Windows:

    mklink /d D:\oracle\product\java_current D:\oracle\product\jrockit-jdk1.6.0_26-R28.1.4-4.0.1
    

    setDomainEnv.sh

    /u01/app/oracle/domains/eksudv/bin/setDomainEnv.sh
    
    if [ "${JAVA_VENDOR}" = "Oracle" ] ; then
            JAVA_HOME="${BEA_JAVA_HOME}"
            export JAVA_HOME
    else
            if [ "${JAVA_VENDOR}" = "Sun" ] ; then
                    JAVA_HOME="${SUN_JAVA_HOME}"
                    export JAVA_HOME
            else
                    JAVA_VENDOR="Sun"
                    export JAVA_VENDOR
                    JAVA_HOME="/u01/app/oracle/product/java_current"
                    export JAVA_HOME
            fi
    fi
    

    commEnv.sh

    /u01/app/oracle/product/fmw/wlserver_12.1/common/bin/commEnv.sh
    
    # Reset JAVA_HOME, JAVA_VENDOR and PRODUCTION_MODE unless JAVA_HOME
    # and JAVA_VENDOR are pre-defined.
    if [ -z "${JAVA_HOME}" -o -z "${JAVA_VENDOR}" ]; then
      # Set up JAVA HOME
      JAVA_HOME="/u01/app/oracle/product/java_current"
      # Set up JAVA VENDOR, possible values are
      #Oracle, HP, IBM, Sun ...
      JAVA_VENDOR=Sun
      # PRODUCTION_MODE, default to the development mode
      PRODUCTION_MODE=""
    fi
    

    What about Peter

    http://theheat.dk

  • Problem with Manager.createPlayer)

    Hello

    I want to play a little mp3 noise when I turn on my BB with a background application. So first, I tried this code in a foreground application:

        public void play()      {        //first we need to find the supported content types        String types[] = Manager.getSupportedContentTypes(null);        for (int cnt = types.length - 1; cnt >= 0; --cnt) {            if (types[cnt].equals("audio/mpeg")) {            //this sample demonstrates playing an MP3 file that has been             //added as a resource to the project            try {                //retrieve the MP3 file                Class clazz = getClass();                InputStream is = clazz.getResourceAsStream("/test.mp3");                //create an instance of the player from the InputStream                Player player = Manager.createPlayer(is, "audio/mpeg");                player.realize();                player.prefetch();                //start the player                player.start();                } catch (Exception ex) { System.out.println("ERROR -> "+ex); }             }         }    }
    

    But it does not work! It returns the exception "java.lang.IllegalArgumentException: flow: null". I think that it does not find test.mp3. I put the mp3 file in the same directory the files .java and .jdp.

    So, could you tell me what I have to add or delete of this code, listen to this sound (first in a foreground application) test please!

    And is it possible to play an mp3 sound with an application at the beginning of the unit?

    Thank you in advance!

    It is perhaps the issue:

    «I put the mp3 file in the same directory files .java and .jdp.»

    The MP3 resource must also be added to the project.

  • Problems with Manager.createPlayer)

    Hello

    I'm new in the world of development of BB... I'm doing a simple application that retrieves a file from a URL .wav and it plays, but the process is stuck on Manager.createPlayer (URL).

    I ran the application using the debugger and when it comes to this line he says 'source not found', here's a snippet of what I'm trying to do:

    public class MyPlayer implements PlayerListener, passable
    {

    Player;

    (I call this my main application thread and start it)

    {} public void start()
    Thread t = new Thread (this);
    t.Start ();
    }

    void run() {}
    try {}
                       
    String url = "http://java.sun.com/products/java-media/mma/media/test-wav.wav";

    Create an instance of player
                 Player = Manager.createPlayer (url); (it gets stuck in this line and the IDE shows a source not found)
    player.addPlayerListener (this);

    make the player
    Player.Realize ();
    Player.prefetch ();
    Player.Start ();
    }
    {} catch (Throwable t)
    reset (); This is a method of myself
    }
    }

    }

    The funny thing is that I tried the same code with a MIDlet and it works well in Nokia and Sony Ericsson simulators, but Blackberry is locked. I'm missing something here?

    I use Eclipse IDE, BlackBerry JDE component Pack Version: 4.5.0.16 and the Simulator Curve BlackBerry 8300 that come with the JDE.

    I also tried the application in a BlackBerry Pearl Simulator, with the same results

    Any advice will be highly appreciated = (...)

    I found the solution, the problem was that my emulator had no access to the internet, when he tried to connect to the URL and get the .wav file it so never found the source.

    I downloaded Blackberry email and MDS services Simulator package, which allows the internet connection for the simulators, and it worked!

    I could connect to the URL and play the .wav

  • Problem with management of SerialElement

    Hello

    I have a SerialElement and it contains two ad_video and then normal_video premiera MediaElement. So I'm first display ad and video using it. Now my problem is I want to disable controls such as play, pause etc. When ad say first MediaElement to plays, and then also detect if it is finished to start to display all orders for the second normal video. Are events that I can use for this or any other approach.

    Thank you and best regards,

    Amit

    We have here an example:

    http://opensource.Adobe.com/svn/opensource/OSMF/trunk/apps/samples/framework/ExamplePlayer /org/osmf/examples/seeking/UnseekableProxyElement.as

    You would wrap the first VideoElement in this UnseekableProxyElement before adding it to the SerialElement.

  • Find problems with get week Date String

    Hi gurus,

    I need to get the number of week of a particular Date String. When I use the query below.

    SQL > select to_char (to_date('01-APRIL-2010','DD_MONTH-YYYY'), 'IW') 'date' double.

    Date
    ---------------------------------------------------------------------------
    13


    But it is false. It should be 14. When I try the same thing in SQLSERVER I get 14

    SELECT DATEPART (wk, April 1, 2010 "")


    Is someone can you please tell me where I'm wrong.

    Thank you and best regards,
    Vikas Krishna

    WW No. week of year (1-53), where week 1 starts on the first day of the year and continues until the seventh day of the year.

    January 1, 2010 was a Friday so for WW each week in 2010 starts Friday and ends on Thursday. 1 April 2010 Thursday was therefore still in the 13th week. but the week number changes on April 2, 2010, which is Friday.

    SQL> select to_char(to_date('02-APRIL-2010','DD-MONTH-YYYY'),'WW') "date" from dual;
    
    da
    --
    14
    

    I guess in SQL server for "wk" started the week from Sunday to Saturday any day was on 01 Jan.
    January 3, 2010 was that a Sunday to see what week number oracle gives us for this date:

    SQL> select to_char(to_date('03-JANUARY-2010','DD-MONTH-YYYY'),'WW') "date" from dual;
    
    da
    --
    01
    

    See what sqlserver gives you for it. I do not know that sql server will give weeknumber 2 for that date because SQL server starts next week on Sunday.

  • Problem with interlocking entities

    Hi all

    I have problems with my locking entities. I locked them up to what Q2 but the problem is when I try to lock Q3. Some entities are as locked for the period of July. So, when I try to unlock July, I get the error next "node value for all parents of the selected entity who have selected as default currency members be unlocked"

    I tried looking at some old messages in this forum and I tried their solution (https://community.oracle.com/message/10640755#10640755). It still does not for me.

    I have attached a screenshot to show the dimension of value < entity currency > vs [no]

    Capture.JPG

    All entries are greatly appreciated.

    Thank you

    Steffi.

    Hey Steffi,

    Do you have alternative hierarchies that you share these entities? I think you need to unlock all the parents of all hierarchies.

    See you soon,.

    Thanos

  • Problems with the management of the CSC/Cisco (associated with SSO) site

    Dear friends,

    I came across a problem with single sign - on (SSO) used in the Cisco's Web site and CSC which begins to be more and more awkward:

    1. I visit the CSC and connect you to reply to a thread. Then I start to reply to a message.
    2. In response, I need to consult the technical documentation, guides, configuration or other documents on Cisco's Web site. In another tab in my browser, I visit the Cisco's Web site and do my search/navigation.
    3. At some point, Cisco's Web site acknowledges that I am already connected to the CSC and begins to produce URLs with the /partner/ inside component (for example in the search results). By clicking on this URL causes me be redirected to the page of connection again. This is the first question - why do I have to log in again because I am already connected and SSO is supposed to take care of this?
    4. Well, I re-enter my credentials, get connected, access the necessary document, then I go back to my post on the CSC, finish it and submit it. KABOOM - CCS quickly informs me that I am without permission to perform this action, lose my answer in the process! Logging on to the Web site (as described in step 3) Cisco obviously invalid my current session on CSC! I need to connect again to the SCC (until I do that, she considers me as a guest once again, but when I click on the login link, I suddenly make me connected without enter my credentials) and, well, write again my answer. Sometimes, a part is recoverable, but usually, it is only a small fragment.

    Would it not be possible to correct this behavior? I lost a lot of time my lost rewrite responses.

    Best regards

    Peter

    Hi Peter,.

    I wanted to give you a quick update on the two issues.

    First question:

    We are currently working on a long term and short fix for this problem. Unfortunately the long-term solution will be a drawn out effort as we begin our new data of all content in our heritage Center. The team is currently testing the short-term solution, will keep you posted on the progress that I get more details.

    Second question:

    We currently do analysis of the root causes of this problem and give you updated each week on this issue that deploy us the patch.

    Thanks a lot again for you continued support and patience.

    Sainaba.

  • Problems with the 'Association' in Windows 7 files

    Original title: constantly stuck in insane mode, 'Open with' file associations opens instead of the selected despite the default application

    Some types of files, mainly media, refuse to open with an application and still shows the "Open with" dialog. The option "Always use the selected program to open this kind of file" is available and verified, but makes no difference. The next time I try to open it, I get the same dialogue again. This is my original problem.

    The programs I am trying these to are foobar2000 (for audio) and Media Player Classic (for video files), respectively.

    I tried many suggestions, most involving the registry, who only managed to make things worse. At present, the file associations are generally uninterrupted again (I went through a phase, where not even Explorer would start over), but there are a few things left that are quite strange.
    For example, for file extensions that work (open their associated program by double clicking), the context default "Open" menu item is normally "BOLD". For me, it is no more.
    Also, I normally do not use Windows Media Player. Therefore, I usually don't bother with going through the initial report set up the wizard who wants to activate the automatic recovery of the DRM keys and stuff like that. To try to solve this problem, I only skip the wizard and now all the files THAT WMP wants to associate are permanently associated with it, and double clicking for example a WAV files directly open WMP without going through the "Open with" dialog. However, when I go to the control panel applet "default programs", I find myself unable to uncheck WMP associations or partner with another application with them.
    I can't go to the association of foobar2000 (my audio player of choice) and file associations "Select all", then "Save". And behold, when I return to registration after registration, it is empty again (this program a default 124 0).
    Now as the mucking with the registry seems to be the way to go about these things, as evidenced by most of the advice on the internet, as well as on this site, I decided to test a theory. In HKEY_CLASSES_ROOT for all types of file WMP STOLE, the (default) value was WMP11Assoc.Something. I decided to change these values to their equivalent of type foobar2000 (such as foobar2000. MP3) and Hello! Suddenly, foobar2000 has "29 of 124 by default". Surely, which should count for something.
    Nope. Opening one of the 29 file types where I applied this change is that open dialogue 'Open with' once again. At least he didn't open WMP, I thank Bob for this. But again, we're back to square one. The initial problem.
    Now, in an interesting case study, I invented a new type of file on the spot, which was not used for anything else. In this case, I used '.lam '. I made an empty file with this extension and set to open in Notepad. This works. But where it gets interesting is when I try to change the association then. I opened the menu popup and select 'Open with' and (arbitrarily) has decided to open it with 7 - zip, check "always use the selected program to open this type of file". But the next time I opened it, it is still open in Notepad! Closer to the irrefutable, I searched for the novel file extension using Regedit. The results of three who came were in the following keys:
    HKEY_CURRENT_USER\Software\Classes\. Lam
    HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\. Lam
    HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\RecentDocs\. Lam
    The first linking lam_auto_file. I deleted all three keys and the key lam_auto_file. After refreshing the Explorer, I could choose a different association, and it's stuck
    ! This is a solution for the types of files that are not normally associate with something else.
    However, when I tried this same technique with .mp3 (noting that the association who is system wide and therefore in HKEY_CLASSES_ROOT instead of HKEY_CURRENT_USER\Software\Classes), delete all the keys and associations, when I try to associate it with something, it won't be yet to stick. Subsequent attempts to open the file still pop up the "Open with" dialog
    Normally, I can find a solution to almost any problem, an extensive search on Google, either by launching logic mixed with trial and error to her. It left me speechless. Someone has ideas, outside the usual "have you tried it turning on and off again", "have you tried super registry cleaner ultimate Xtreme ($500)", "delete system32", "Reinstall", "you have a virus", etc.. ?

    Hello

    A sound solution suggests allows you to perform the following method.

    Method 1: use this option to choose which programs you want Windows to use, by default.

    If a program does not appear in the list, you can make the default program using set Associations.

    1. open default programs by clicking the Start button, click default programs.

    2. click on associate a type of file or Protocol with a program.

    3. click on the file type or protocol that you want the program to act as the default value.

    4. click on the program of change.

    5. click on the program that you want to use by default for the selected file type, or click the arrow next to

    Other programs to show other programs. (If you don't see your program, or other programs
    is not listed,

    Click Browse to find the program that you want to use and then click Open

    6. click on OK

    For more details follow the link below:

    http://Windows.Microsoft.com/en-us/Windows7/change-which-programs-Windows-uses-by-default

    Method 2: try to create a new user account and check if you have the same problem.

    To create a user account

    1. to open user accounts, click the Start button, select Control Panel, click on accounts of users and parental controlsand then click user accounts.

    2. click on Manage another account. If you are prompted for an administrator password or a confirmation, type the password or provide confirmation.

    3. click on create a new account.

    4 type the name that you want to assign to the user account, click an account type, and then click create an account.

    For more information follow the link below:

    http://Windows.Microsoft.com/en-us/Windows7/create-a-user-account

    If everything works well in the new user account, then the user account may be damaged.

    To fix the damaged user profile, you can check the link below:

    http://Windows.Microsoft.com/en-us/Windows7/fix-a-corrupted-user-profile

  • Problems with the Power Manager 1.51 new T60 has

    I've updated Power manager version 1.51 has and I have problems with the gauge of Power Manager in the task bar. Life remaining battery is not updated once more. Is there any chance I can find an earlier version of the software that worked perfectly before? Or there is a method to solve the problem?

    Sincerely,

    Nikita Septucha


  • Cumulative Update 9 is stable? are there major problems with UR9 I share with partners / customers?

    Cumulative Update 9 is stable? are there major problems with UR9 I share with partners / customers?

    Hello

    Your question is beyond the scope of this community.

    I suggest that repost you your Question in Exchange for TechNet Forums.

    https://social.technet.Microsoft.com/forums/Exchange/en-us/home?category=ExchangeServer

    Or here:

    https://social.technet.Microsoft.com/forums/Exchange/en-us/home?Forum=exchangesvrgeneral

    "Update rollup 9 for System Center Operations Manager R2 2012"

    https://support.Microsoft.com/en-AU/KB/3129774

    See you soon.

  • Problems with the 'Association' in Windows 7 64 bit file

    Even if I am able to go through the 'normal' process to associate a program with an extension, it does not work.  After having completed steps browse and selecting the program it brings back me to the "Open with" window  The program I selected does not appear in the "Open with" window and it seems that he ignores me everything simply.

    I also tried the 'Default programs' route but wind upwards in the same window 'Open with' which ignores me.

    Suggestions?

    -----------------------
    [EDIT]
    (1) I realized that this probably isn't a forum appropriate for this question so feel free to ignore!
    (2) I also realized that this may be a problem with associating extensions with non-64-bit programs and seems to be a non-issue if trying to associate with a 64-bit program... go figure.

    After playing a lil, I think that I figured it... [for me at least...]

    The program you are pointing to is not saved correctly.
    In regedit: go to Computer\HKEY_CLASSES_ROOT\Applications and find your .exe name.
    Sail under its name of shell > open > order. In the default change its location to the actual location of the executable file, press OK and then try and reassociate the file type as you normally would.
    Let me know if this doesn't seem to work.
  • Problem with touch in a focus Manager

    I searched the threads on this topic but impossible to find a solution.

    Here's the thing: I have a screen, to which I add a custom handler that I add other components such as buttons, textfields, other managers and so on.

    One of the components of this is a focus Manager, I did work as a button, because he was too customized to be a button, with two blocks of text and a bitmap.

    In a trackball device it works fine, when I ride down he's focused and I can select normally, but when I use a camera touch (9550) touchs are ignored.

    I had other problems with Tush, I used a VerticalManager for the front screen and no matter where I hit, the only button I could choose was the last. Then I changed VerticalManager to the Manager and it worked, but the focus Manager I mentioned previously still did not work.

    Any ideas?

    Thanks in advance.

    Kind regards

    Dan

    It seems that the Manager cannot be selected unless there is an active field inside so you need to touch this area.

    So, the solution is to add a new field to the handler, like this:

    add(managerFocusButton = new Field() {
        protected void paint(Graphics graphics) {
        }
        protected void layout(int width, int height) {
            setExtent(width, height);
        }
        public boolean isFocusable() {
            return true;
        }
        protected void drawFocus(Graphics graphics, boolean on) {
        }
    });
    

    And then this kid with the width and height of his Manager.

    The field is not visible and the Manager won't entirely.

    Thank you.

  • Windows 7. I recently had problems with loss of internet connection. When I have trouble Shooting, told me that impossible to find a driver.

    I have a desktop running Windows 7 PC.  I recently had problems with loss of internet connection.  When I have trouble Shooting, told me that impossible to find a driver.  The adapter does not appear in Device Manager.  Help!

    Hello

    Definitely looks like a problem with the network device. Check with sound
    Support, their books online, the drivers and ask in their forums (if any)
    on known problems. If there is a control of the device shipped with the system
    Manufacturer (manufacturer of motherboard for customized systems). If a device check separated
    with the support of its creator and other resources.

    You could also remove or disable the device and try a new add-on as one
    new card or device USD. None of those who are dear.

    I hope this helps.

    Rob Brown - Microsoft MVP<- profile="" -="" windows="" expert="" -="" consumer="" :="" bicycle=""><- mark="" twain="" said="" it="">

Maybe you are looking for