When Parent, the child is not getting saved.

Hello
I have 2 entities

Public parent()
{
int A;
int B;
Child of the child;

@ManyToOne (waterfall = CascadeType.ALL, fetch = FetchType.EAGER)
@JoinColumn (name = "child_id", nullable = false)
public child getChild() {}
Return this.child;
}
}

public Child()
{
int child_Id;
int Y;
The value < Parent > parents;

@OneToMany (fetch = FetchType.LAZY, mappedBy = "child")
public Set < Parent > getParents() {}
Return this.parents;
}

}

Then
Parent P = new Parent();
Class c Child = new Child();
....
I put values for classes of the mother and the child
p.setChild (c);

So, when I save the parent class

entityManager.persist (parent);

Ideally, it should save the child. But she got the following error. My mapping entity were not manually written. They were generated by eclipse. So I guess that as long as the database mapping is correct by the entity mapping will be also correct.

+
Caused by: openjpa - 1.1.1 - SNAPSHOT-error no fatal store r422266:807362 > org.apache.openjpa.util.StoreException: ORA-02291: integrity (PARENT_R03) violated constraint - found parent key
{prepstmnt 4234 INSERT INTO PARENT (A, B, CHILD_ID) VALUES (?,?,?,?,?,?,?)} {[(null), (null) null, null, (BigDecimal) 58608]} [code = 2291, State = 23000]
FailedObject: com.ejb.entity.Parent@337261
at org.apache.openjpa.jdbc.sql.DBDictionary.narrow(DBDictionary.java:4207)
at org.apache.openjpa.jdbc.sql.DBDictionary.newStoreException(DBDictionary.java:4171)
at org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:102)
at org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:72)
at kodo.jdbc.kernel.BatchingPreparedStatementManager.flushInternal(BatchingPreparedStatementManager.java:214)
at kodo.jdbc.kernel.BatchingPreparedStatementManager.flushInternal(BatchingPreparedStatementManager.java:112)
at kodo.jdbc.kernel.BatchingPreparedStatementManager.flush(BatchingPreparedStatementManager.java:72)
at kodo.jdbc.kernel.AutoOrderUpdateManager.flush(AutoOrderUpdateManager.java:84)
at kodo.jdbc.kernel.ConstraintUpdateManager.flush(ConstraintUpdateManager.java:68)
at org.apache.openjpa.jdbc.kernel.AbstractUpdateManager.flush(AbstractUpdateManager.java:89)
at org.apache.openjpa.jdbc.kernel.AbstractUpdateManager.flush(AbstractUpdateManager.java:72)
at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.flush(JDBCStoreManager.java:549)
at org.apache.openjpa.kernel.DelegatingStoreManager.flush(DelegatingStoreManager.java:130)
at org.apache.openjpa.datacache.DataCacheStoreManager.flush(DataCacheStoreManager.java:554)
at org.apache.openjpa.kernel.DelegatingStoreManager.flush(DelegatingStoreManager.java:130)
... more than 49
+
As you can see the CHILD_ID was generated. But I think that the order in which it gets commited is different. Please let me know if I need to change the configuration of my entity to make it work.

Jebus, a column of ID of BigDecimal. You must have the intention to store the whole universe in there. I never managed to go on a primary key to precision 10 sequence generated to myself...

Same difference: sound in rear. You have a card with a RfuiRfDef child and a child of RfuiRfDef belonging to many cards. Huh?

In this scenario, I see only one true way to persistence it.

-persist RfuiRfDef child object to a managed JPA entity
-assign the child entity MANAGED RfuiRfDef to RfuiRfLgcMap object
-persist RfuiRfLgcMap object to a managed JPA entity
-to be complete, paste the RfuiRfLgcMap parent entity at the address now managed in the game of rfuiRfLgcMaps of the child object

That translates into SQL statements; You cannot persist the Map object when there is firstly a RfuiRfDef record so you can store a foreign key relationship itself.

I see a waterfall ALL slapped on everything (this is not recommended, don't use generated code as is the case, you must understand what it all does and adjust according to what is safe and necessary) - maybe it will work if you persist in fact the object of RfuiRfDef as follows:

-create the child object RfuiRfDef
-create the RfuiRfLgcMap object (with the game in the RfuiRfDef object)
-stick RfuiRfLgcMap object in the game of RfuiRfDef.rfuiRfLgcMaps
-persisted child object RfuiRfDef

Tags: Java

Similar Questions

  • Problem: one of the members of the child is not aggregate to the Parent cube ASO

    Problem: one of the members of the child is not aggregate to the Parent cube ASO

    Here is the hierarchical structure of the ASO.

    At ~ Labelonly

    b + shared member

    C + Shared member

    Aggregated Expectated result: A = 150 USD

    b contribution 100 USD

    C contribution 50 USD

    But total shwoing associate for A is currently 100 instead of 150 USD.

    Then, I tried to remove members of 'b' then no value does show for A which means Member 'c' does not participate in the aggregation.

    Please let us know if anyone is facing the similar problem

    One member of the label will always be equal to the value of the first child.  You need to remove to get a sum

  • Whenever I try to save a PDF file using Adobe Acrobat DC (Version 15.1), I get the error "the document could not be saved. There was a problem reading this document (21). »

    Whenever I try to save a PDF file using Adobe Acrobat DC (Version 15.1), I get the error "the document could not be saved. There was a problem reading this document (21). "When I click ok, an error message appears saying:"insufficient data for an image. "I tried to do a repair on Acrobat, but it has not changed anything. I also tried some updates, but nothing that is. I did hours of research on the Internet and have found nothing so far. Does anyone know why this error keeps appearing?

    Thank you!

    Hi all

    This problem has been corrected and is implemented to come or update.

    Kind regards

    Rave

  • VMDK not getting saved by the VCBackup for VMS V7

    Hello

    We did an upgrade to VI3 to vSphere4 a couple of weeks.

    This week, I created a few new virtual machines that are now 7 vms.

    These virtual machines are running much and have no problems.

    Only downside, it's that we are more able to creat VCBackups of these machines V7, because the VMDK will not be saved.

    The only files get saved are .log, .vmx, .vram and. Bah

    Here's what VCbackup connects:

    Current working directory: D:\Jobs\VCBBackup

    HOSTINFO: See Intel CPU, numCoresPerCPU 4, numThreadsPerCore 1.

    HOSTINFO: This machine has 4 cores total, 1 physical CPU and 4 logical processors.

    Using the libcrypto, version 90709F

    Copy "BERVM09A16/BERVM09A16.vmx [_CX_Oracle_02]:

    +        0%=====================50%=====================100%+

    +        **************************************************+

    Copy "BERVM09A16/BERVM09A16.nvram [_CX_Oracle_02]:

    +        0%=====================50%=====================100%+

    +        **************************************************+

    Copy "BERVM09A16//vmware-7.log [_CX_Oracle_02]:

    +        0%=====================50%=====================100%+

    +        **************************************************+

    Copy "BERVM09A16//vmware-2.log [_CX_Oracle_02]:

    +        0%=====================50%=====================100%+

    +        **************************************************+

    Copy "BERVM09A16//vmware-3.log [_CX_Oracle_02]:

    +        0%=====================50%=====================100%+

    +        **************************************************+

    Copy "BERVM09A16//vmware-4.log [_CX_Oracle_02]:

    +        0%=====================50%=====================100%+

    +        **************************************************+

    Copy "BERVM09A16//vmware-5.log [_CX_Oracle_02]:

    +        0%=====================50%=====================100%+

    +        **************************************************+

    Copy "BERVM09A16//vmware-6.log [_CX_Oracle_02]:

    +        0%=====================50%=====================100%+

    +        **************************************************+

    Copy "BERVM09A16//vmware.log [_CX_Oracle_02]:

    +        0%=====================50%=====================100%+

    +        **************************************************+

    We use this command to start the backup:

    vcbmounter.exe h vcenter.ourcompany.local u Pei ultrasecurepassword - a name: % 1 - fullvm 'E:\VCBBACKUP\TODAY\%DATE%_%1' of backup-L t r 2 & gt; D:\Jobs\VCBBackup\VCBLog\%date%\%1.txt

    Old virtual machines are getting backed up without any problem.

    You have any suggestions?

    Kind regards

    John

    Hello.

    You use the latest version of VCB, i.e. 1.5 U1?

    Good luck!

  • I was doing a winpeshl.exe.error when starting "the application was not properly initialze (0xc0000006). "Click to complete the application.

    I was doing a winpeshl.exe.error when starting "the application was not properly initialze (0xc0000006). "Click to complete the application" when I click ok it reboots. I can even recover the system, tried F8 startup, alt/F10, F2, launch repair system, Safe Mode and all the rest and still get the same error. System specs are Acer Aspire 5920, Intel T5450 processor, 2 GB ram, 160 GB of HDD, windows vista edition Home premium.  I am currently under the memory diagnostic tool windows, but it is said that the test results will be displayed again once you log in, but I can't log in to view them.  The test seems to be hanging around 21% so I don't know how well it will do

    Hi A1W1LL,

    A clean boot helps eliminate software conflicts.  Let us check if software is causing the problem by following the clean boot procedure that may help you resolve the issue.

    To perform the clean boot procedure, follow the instructions in the link below.

    Step 1: Perform a clean boot
    Step 2: Enable half the services
    Step 3: Determine whether the problem returns
    Step 4: Enable half of the startup items
    Step 5: Determine whether the problem returns
    Step 6: Resolve the problem
    Step 7: Reset the computer to start as usual

    How to troubleshoot a problem by performing a clean boot in Windows Vista
    http://support.Microsoft.com/kb/929135

    After reviewing the issue, put the computer into Normal mode.
    Uninstall or update the program that is causing the problem.

    If you are not able to boot to the desktop, you can try to restore your computer from WinRE.

    1. Insert the Windows Vista installation disc in the disc drive, and then start the computer.
    2. Press any key when the message "Press any key to boot from CD or DVD".
    3. Select a language, a time and currency, and a keyboard or input method, and then click Next.
    4. click on repair your computer.
    5. in the System Recovery Options dialog box, select the drive of your Windows installation and click Next
    6. in the System Recovery Options dialog box, click System Restore.
    7. follow the instructions in the wizard to restore system as usual and choose the appropriate restore point.
    8. click Finish to restore the system.

    Please post back and let us know if it helped to solve your problem.

    Kind regards
    KarthiK TP

  • Message from the AR - "the document could not be saved.  There was a problem reading this document. »

    I have a PC and downloaded a file from a site that I use frequently.  When I tried to save the file, I got the message, "the document could not be saved.  There was a problem reading the document. "" When I clicked on ok, a new message appeared, "" out of memory ".  My computer has plenty of available storage.

    I would be so grateful for any assistance.

    The most likely problem is that your temporary file area is full. You can make in your temp directory and empty the file manually. The other possibility is that the file is corrupted.

  • Win7 with FF 31, smart phone 4.2 with FF letest ver. using the same account with 1 email. But the phone is not getting any collar, Bokmr, etc.

    Brother.
    We use win7 with Mozila 31, 4.2 with Mozila Android smart phone latest google app store on 04/10/0214. Using the same account with the same email. But the phone does not get any new information of win7 with Mozila 31. PL z give useful information.

    Hi w3ur_team,
    Thank you for your question. I understand that there are two features that are documented in the sync account. However the Android is not synchronized.

    There are two places we can check:

    1. In the Android settings, under accounts is the Firefox Sync or Firefox Sync (discouraged) joint account?
    2. Credentials work on accounts.firefox.com on the mobile device and are there any error messages in the synchronization of the settings menu > sync?

    See also Firefox Sync troubleshooting and tips for more troubleshooting steps.

  • the settings have not been saved for the iphone because it was not found

    the settings have not been saved for my iPhone 5 because it was not found

    Nappys wrote:

    the settings have not been saved for my iPhone 5 because it was not found

    OK thank you very much for sharing your question vague.

  • My labtop sound works, but when connect the headphones does not work

    My labtop sound works, but when connect the headphones does not work. Note that the headset before 1 HR was working.

    Hello

    ·         Are these USB headset or headphone jack analog standard?

    ·         What version of the operating system is installed on the system?

    If you continue Windows 7 or Windows Vista refer to the procedure in method provided below and check if they help to resolve the issue.

    Method 1:

    Step 1:

    You can check if the headphones are activated as a playback device. To do this, see the following steps:

    (a) the Pearl-click Start and type Sound in the start search box.

    (b) in the Start Menu Options, select change adapter settings .

    (c) then, on the Read tab, right-click and select Show hidden devices and Show disconnected devices if they are available.

    (d) select headphones and select

    Step 2:

    Also try to put headphones of default device and check, follow the steps below.

    (a) go to Start and click on Panel.

    (b) click Sound, and then a new window will open.

    (c) in the new window click on the "Playback" tab and right-click in the window and click on Show disabled devices.

    (d) now check if headphone is listed there and right-click on it and choose activate.

    (e) highlight this helmet and click on "as default'.»»

  • short cuts on the desktop for the URL will not work. Try to connect the browser when rises the address has not been transposed, it's all just white

    short cuts on the desktop for the URL will not work. Try to connect the browser when rises the address has not been transposed, it's all just white

    There may be some problems that repair tools are not picking up. It may be preferable to a repair facility. This can help with any corruption of the registry, which could happen by the deletion of these programs. http://support.Microsoft.com/kb/917964

    Keep in mind when running all that modifies the system it is always a good idea to have your data and backup programs (it's general advice for any system its always good to have a backup in case of possible failure of material/virus)

  • the button may not get focus, Pls help

    A screen contained two buttons and a browserfield. I use jde 5.0, for this browserfield either on net.rim.device.api.browser.field2.BrowserField.

    This browserfield be contained in a Manager.

    for these two buttons, I use another Manager to add.

    The problem is: the button can not get focus after I move the browserfield box.

    Just show that arrowhead at the top of the button of button.this cannot get the focus. also can't click

    OK, got the solution.

    just use the BrowserFieldConfig.NAVIGATION_MODE_CARET, and then may alter browserfield performance.

  • I constantly get the error 'could not get new comments. One or more files are missing on the server.

    I constantly get the error 'could not get new comments. One or more files are missing on the server.

    It gets a little old. I know that the files are there. There is some ongoing compatibility issue?

    Hi kuntzmd

    Please visit: http://forums.adobe.com/thread/533034

    http://forums.Adobe.com/thread/33586

  • When runing the system restore, I get a message says, "System Restore did not complete Sudessfully" the reason why it gives States "an unspecified error occurred during system restore.

    When I was runing the Sytem Restore I get a message that says "System restore was not completed successfully" the reason he give said "an unknown error occurred during system restore.

    Problems with system restore:

    http://Service1.Symantec.com/support/sharedtech.nsf/pfdocs/2005113009323013

    1. If you use Norton (Etc), disable it before using System Restore. info at the link above.

    2. try SR in safe mode:

    Try typing F8 at startup and in the list of Boot selections, select Mode safe using ARROW top to go there > and then press ENTER.

    Try a restore of the system once, to choose a Restore Point prior to your problem...

    Click Start > programs > Accessories > system tools > system restore > choose another time > next > etc.

    3 Malware will stop at the system restore:

    If necessary, do all the workSafe Mode with network.

     

    To get intoSafe Mode with network, press F8 at the Power On / boot and use key arrow upward to get intoSafeMode with networking from the list of options, and then press ENTER.

    http://www.Malwarebytes.org/MBAM.php

    Malwarebytes is as its name suggests, a Malware Remover!

    Download the free Version from the link above.

    Download, install, upgrade and scan once a fortnight.

    See you soon.

    Mick Murphy - Microsoft partner

  • laptop of the child is not able to connect to internet even though I have a westell wireless

    so, how can I solve this problem, friends weeks before no problem could get on the internet from their laptops with the wireless westell router for ATT but limited access now so that they can not get on the internet?

    Hello

    1. what happens when you try to connect to the internet?

    2. what operating system is installed on your computer?

    Method 1:

    Follow the link and use the Troubleshooter: in the Windows wireless network connection problems http://windows.microsoft.com/en-US/windows/help/wireless-network-connection-problems-in-windows

    Method 2:

    Follow the steps in this article and check if that helps: "Internet Explorer cannot display the webpage" error when you view a Web site in Internet Explorer http://support.microsoft.com/kb/956196

  • Cursor disappears when entering, the window is not active.

    I have Vista home SP2.
    When I type the cursor disappears and the typing stops. The window is not active until I'm clicking on it again. It's as if it times out.
    I thought it was just Firefox, but that's all. I watched q. similar, but nothing. It has been since the last update, or just before, then, either, about 3 days.

    Hi Hobittual,

    Follow the instructions below that may help you resolve the issue.

    Method 1:

    Follow the instructions to start the computer in safe mode.

    1 turn on the computer or restart the computer

    2 start typing the F8 key. The Windows Advanced Boot Menu of Options will appear.

    If you start typing the F8 key too soon, some computers display a "keyboard error". To resolve this issue, restart the computer and try again.

    3. ensure that the safe mode option is selected.

    4. press ENTER. The computer then begins to start in safe mode.

    Check if you have the same problem in safe mode as well.

    Startup options (including safe mode)

    http://Windows.Microsoft.com/en-us/Windows-Vista/advanced-startup-options-including-safe-mode

    Method 2:

    Let us perform virus scan online that may help you resolve the issue.

    Windows Live OneCare safety scanner is a free service designed to help ensure the health of your PC.

    • Check and remove viruses
    • Get rid of junk on your hard disk
    • Improve the performance of your PC

    Click on the link below for Online Virus scanner.

    http://safety.live.com/

    Check whether the problem is resolved.

    You can go to Microsoft Security Essentials protect your computer from malware.

    Click on the link below for more information on Microsoft Security Essentials.

    http://www.Microsoft.com/security_essentials/

    You can also check out the link below.

    How to get rid of malware

    http://social.answers.Microsoft.com/forums/en-us/vistasecurity/thread/ba80504b-61f1-4D71-960f-b561798b7b42

    Please post back and let us know if it helped to solve your problem.

    Kind regards

    KarthiK TP

Maybe you are looking for