Delete only the child object and not the parent object

Hi,
I have the below code:-
TAnswer
@ManyToOne(fetch = FetchType.LAZY)
     @JoinColumn(name = "question_id", nullable = false)
//     @Cascade(value=CascadeType.ALL)
     public TQuestion getTQuestion() {
          return this.TQuestion;
     }     TQuestion
@OneToMany(fetch = FetchType.LAZY, mappedBy = "TQuestion", orphanRemoval = true)
     @Cascade(value=CascadeType.ALL)
     /*@Cascade({org.hibernate.annotations.CascadeType.SAVE_UPDATE,
            org.hibernate.annotations.CascadeType.DELETE,
            org.hibernate.annotations.CascadeType.MERGE,
            org.hibernate.annotations.CascadeType.PERSIST,
            org.hibernate.annotations.CascadeType.DELETE_ORPHAN})*/
     public List<TAnswer> getTAnswers() {
          return this.TAnswers;
               In Java:-
     public void removeAnswers(TQuestion question)
                    throws ApplicationException {
               List<TAnswer> answerList =  question.getTAnswers();
               deleteall(answerList);
     public void deleteall(Collection objects) {
               try {
                    getHibernateTemplate().deleteAll(objects);
                    getHibernateTemplate().flush();
               } catch (Exception e) {
                    throw new ServerSystemException(ErrorConstants.DATA_LAYER_ERR, e);
     }               Here the "deleteall" will delete both the answer records and question records, I don't want the questions
     records to be deleted. I have tried making the question as null when we set the answer object to be passed for delete
     bit still it is     deleting the question records as well.How to achieve the above in deleting only the answer (child) records
     and not the question(parent) record? Is there any thing we need to do with @Cascade for Question object? Please clarify.
Thanks.

What does deleteAll do, it doesn't look like a JPA method. You might want to ask your question on your provider forum, or use straight JPA methods as a simple EntityManager.remove(answer) on each answer in the collection should work.
Regards,
Chris

Similar Messages

  • How can I restore my data from iCal? I didn't make any backup, but I use  time machine with an external HD. I deleted iCal when I deleted my gmail account. I have tried to restore, but I can only restore the iCal software and not the data.

    How can I restore my data from iCal? I didn't make any backup, but I use  time machine with an external HD. I deleted iCal when I deleted my gmail account. I have tried to restore, but I can only restore the iCal software and not the data.

    So what is your question?
    If you forgot your encryption password:
    Warning: Make sure it's a password you will remember or write it down for safekeeping. If you encrypt an iPhone backup in iTunes and forget your password, you can't restore from backup and your data will be unrecoverable.
    If you can't remember the password and want to start again, you must perform a full software restore and chooseset up as a new device when iTunes prompts you to select the backup from which to restore.
    The above comes from here:
    http://support.apple.com/kb/HT4946

  • I bought a movie on iTunes and when it loads up I can only play the bonus features and not the actual film. The title screen is also glitched and merges with the scene selection. I don't think it downloaded properly. what can I do?

    I bought a movie on iTunes and when it loads up I can only play the bonus features and not the actual film. The title screen is also glitched and merges with the scene selection. I don't think it downloaded properly. what can I do?

    It happens sometimes. Delete the current copies, don't hide from iTunes in the cloud if prompted, close iTunes, reopen, download from iTunes Store > Quicklinks > Purchased > Music > Not on this computer.
    While downloading click the download icon at the top right and uncheck Enable simultaneous downloads. You may find it more reliable that way.
    tt2

  • I have a WD 2 tb hard drive that I want to use to back up my Mac Pro quad core.  How do I create a back up startup disk?  Also, when I used Time macine, it only backed up users and not the system or library folders.  Ideas?

    I have a WD 2 tb hard drive that I want to use to back up my Mac Pro quad core.  How do I create a back up startup disk?  Also, when I used Time macine, it only backed up users and not the system or library folders.  Ideas?

    Welcome to Apple Support Communities
    Time Machine should be enough to make a backup of your files. Also, it should back up all folders, so open System Preferences > Time Machine > Options, and make sure that there are no folders included in the excluded items list.
    If you want to create a bootable clone of your hard drive, you need to use an app like Carbon Copy Cloner or the Disk Utility's Restore feature > http://pondini.org/OSX/DU7.html

  • Can i get the time capsule to automatically back up my file from my Mac Book Air but have certain files which are only stored on the time capsule and not the computer? Then can i access these files only on the time capsule without connecting it?

    Can i get the time capsule to automatically back up my file from my Mac Book Air but have certain files which are only stored on the time capsule and not the computer? Then can i access these files only on the time capsule without connecting it?

    igonneau wrote:
    Can i get the time capsule to automatically back up my file from my Mac Book Air but have certain files which are only stored on the time capsule and not the computer?
    You can, but how are you going to back up those other files?  When (not if) your Time Capsule fails, you risk losing them.  See #Q3 in Using Time Machine with a Time Capsule for details.
    Then can i access these files only on the time capsule without connecting it?
    Not sure what you mean.  You have to connect a computer, either via Ethernet cable or wirelessly, to read or write to the disk. 

  • I have 5 devices all on one itune account.i have not activated icloud because i dont want it to sync all our information together. is there a way to set it up to only sync the music together and not the contacts photos messages etc

    i have 5 devices all on one itune account.i have not activated icloud because i dont want it to sync all our information together. is there a way to set it up to only sync the music together and not the contacts photos messages etc

    Unless you subscribe to iTunes Match, iCloud doesn't sync music.  Just set up every person's devices on a separate iCloud account and your iCloud data and photo stream will remain separated.  Each iCloud account will need a separate ID, but it does not need to be the same as your iTunes ID.  You can continue to share the same iTunes ID and maintain separate iCloud accounts with separate IDs for iCloud.
    You'll also want to use separate IDs for each person for iMessage and FaceTime.  This will keep your text messages and FaceTime called separated as well.  The easiest way to do this is to have everyone use their iCloud ID for these two services as well.

  • I have CS6 and CC installed on my mac when I'm using CS6 and use bridge CC activates how can I set this to only work on one and not the other

    I have CS6 and CC installed on my mac when I'm using CS6 and use bridge CC activates how can I set this to only work on one and not the other

    If you want Bridge CS6 to open when using Photoshop CS6, you must quit Bridge CC.
    Then File menu > Browse in Bridge will bring up Bridge CS6.
    If Bridge CC is already open, The File > Browse in Bridge for Photoshop CS6 will use Bridge CC and Bridge CS6 will not open.
    I hope that's the answer you were looking for.
    Gene

  • I accidentally created an identical email acct, how to I delete the newer one and not the old one?

    entally created an identical email acct, how to I delete the newer one and not the old one? And I'm receiving e's just from the new one.

    Move the "e's" (email messages?) to the old account first. You can drag and drop.
    To remove an account in Thunderbird:
    '''[http://kb.mozillazine.org/Menu_differences_in_Windows,_Linux,_and_Mac Tools|Account Settings]|&lt;select the unwanted account&gt;|'''
    Down at the bottom of the left-hand pane, '''Account Actions''' then '''Remove Account'''.
    Are both accounts using POP? That could explain why new messages appear in the new account but not the old.
    It could help to post your Thunderbird settings data: '''Help|Troubleshooting Information'''. Clear the "Include account names" checkbox. Click on "Copy text to clipboard", then paste (ctrl+v) into your next posting here.

  • In Textedit, how do I copy a hyperlink url, but only copy the link location and not the link text?

    Suppose I have a list of hyperlinked internet URL's. I want to extract their Internet addresses -- the link locations --  which are essentially hidden in the link text. Is there any way to select and copy the list of hyperlinks, but only copy the link locations, and not the link text?
    For example, with the links:
    The White House
    Google
    One of my previous posts
    What I really want to copy are: "http://www.whitehouse.gov/", "http://www.google.com/", and "https://discussions.apple.com/thread/2737556".

    I figured out how to do it. First, copy the hyperlinks onto a blank RTF document in TextEdit and save the file.
    Second, open the file from within TextEdit, and make sure that the box "Ignore rich text commands" is checked in the open file dialog box. In the open document, the hyperlinks from my example in my first post will look like this:
    {\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf360
    {\fonttbl\f0\froman\fcharset0 Times-Roman;}
    {\colortbl;\red255\green255\blue255;\red0\green7\blue232;}
    {\info
    {\author Garald P. Weller}
    {\*\copyright Garald P. Weller}}\margl1440\margr1440\vieww20000\viewh14400\viewkind0
    \deftab720
    \pard\pardeftab720\sa240\ql\qnatural
    \f0\fs24 \cf0 \
    \pard\pardeftab720\sa240\ql\qnatural
    {\field{\*\fldinst{HYPERLINK "http://www.whitehouse.gov/"}}{\fldrslt \cf2 \ul \ulc2 The White House}}\
    \pard\pardeftab720\sa240\ql\qnatural
    {\field{\*\fldinst{HYPERLINK "http://www.google.com/"}}{\fldrslt \cf2 \ul \ulc2 Google}}\
    \pard\pardeftab720\sa240\ql\qnatural
    {\field{\*\fldinst{HYPERLINK "https://discussions.apple.com/thread/2737556"}}{\fldrslt \cf2 \ul \ulc2 One of my previous posts}}\
    Third, use the Automator function, "Get URLs From Text," to create a service, which I called "Get URLs From Text," that receives text from any window, gets the URLs, and copies the result to the clipboard:
    Fourth, select the entire page above, and go to TextEdit > Services to activate the "Get URLs" service.
    Fifth, create a new TextEdit document, and paste the result.
    The output is exactly what I wanted, the URLs -- i.e., the link locations -- of the three web pages, without the link text.
    Another utility that will extract URLs is CopyPaste Pro, which has an innate ability to extract Internet addresses from either web pages or text pages.

  • How to show the break totals and NOT the report totals in an SQL report

    APEX 4.0.1
    In an normal SQL report (Not interactive) with a break applied on the first column, how do you just show the break totals and NOT the extra full report totals?
    Next, Is it possible to display only some of the row totals and not for all columns that have the sum option checked against them?
    PaulP

    PaulP wrote:
    APEX 4.0.1
    In an normal SQL report (Not interactive) with a break applied on the first column, how do you just show the break totals and NOT the extra full report totals?Instead of using the APEX break feature, try doing all of this in the query using <tt>GROUPING SETS</tt> or <tt>ROLLUP</tt> to get the break rows, and <tt>GROUPING_ID</tt> in the <tt>HAVING</tt> clause to suppress the unwanted rows.
    Next, Is it possible to display only some of the row totals and not for all columns that have the sum option checked against them?Don't really understand what's meant here?

  • The last few times I've used headphones in my iPad, the audio has been all messed up to the extent where it's better to just use the internal speakers and not the headphones. I've tried multiple pairs of headphones to no avail. Help?

    The last few times I've used headphones in my iPad, the audio has been all messed up to the extent where it's better to just use the internal speakers and not the headphones. I've tried multiple pairs of headphones to no avail.
    The iPad was bought in mid-June, but I did not get extended Apple-Care warranty on it. Any idea of what's happenening?

    Multiple means how many? If only 2 or 3, they could all be faulty. Try the headphones in some other device, to make sure they are OK. Or there could be something wrong with the headphone port.
    Your iPad is still covered by the 1-year warranty so you should make a Genius appointment and have it looked at.
    Another thing to try is to plug in the headphone jack a few times in succession to see if it frees up something inside the port.

  • How to force BI Server to pick from the Agg table and not the Fact table?

    Hi All,
    I have 3 tables as the Sources in the Key measures. 2 are fact tables and the other one is the agg table.
    E.g.
    Fact 1 at A,B,C,D and E level
    Fact 2 at A,B,C level
    Agg at A,B,C level which contains the measures from the Fact1 and Fact2
    So when I select the measures from the Agg which are coming from Fact1 the Agg table get fired and when I select measures from Agg which are coming from Fact2, the Fact2 table gets fired in the SQL Query.
    Now my question here is there anyway to tell BI Server that when I select Fact2 measures fire the Agg table and not the Fact2 table. The reason being the Agg and Fact2 tables are at the same level.
    But I need to keep the Agg table as it is one level higher than the Fact1 tables.
    Any pointers would be helpful.

    hi,
    you explain us your situation really good.but you forgot to tell us the most import,the measures in aggregate table and the aggregated dimensions.
    meaning,you have 7 measures aggregated in some levels of your dimensions tables?if yes,there is no possibility Bi goes anywhere else..(by choosing only these measures and the defined levels at your dimensions..)
    One more thing,if you choose a combination of your 2 fact data sources,bi goes?where???
    hope i helped...
    http://greekoraclebi.blogspot.com/

  • I have an iTunes account with a $25.00 credit but everytime I go to purchase a song, it goes to my credit card details. How do I use the iTunes credit and not the credit card?

    I have an iTunes account with a $25.00 credit but everytime I go to purchase a song, it goes to my credit card details. How do I use the iTunes credit and not the credit card?

    Just to confirm, you are logged into the iTunes Store using the account in which the balance exists, and the balance is showing at the top of the iTunes Store window? And you're not trying to purchase gifts for someone else?

  • Having arranged some scanned pictures in an album in I-Photo how can I keep them in the order I have chosen when I move the album. They all have the scan date and not the taken date and move to new positions if I move them from one album to another.

    Having arranged some scanned pictures in an album in I-Photo how can I keep them in the order I have chosen when I move the album. They all have the scan date and not the taken date and move to new positions if I move them from one album to another.
    Is there any way to re-number them in the order I have chosen so that they can then be sorted by number? The scans are all from pre-digital images that I wish to move to a photobook and I don't want to have to organise them twice!
    Thanks for any suggestions.

    I was a bit short, Chris, sorry. It is limited, what can be posted, when typing on an iPad.
    Now I am back on my Mac. I meant the following:  Batch Change the date for a large range of photos, that should have a date stepped in increments.
    Select all Photos at once and use the command "Photos > Batch Change".
    Then set the date for the first photo and select an increment, e.g. one minute.
    Now all photos will get a new date assigned, incremented by one minute, in the sequence you have selected. So you will be able to sort them by date.  This way it will be unnecessary to change the titles or filenames.

  • How do I set the HELP menu to use Indesign's local HELP files on the hard drive and not the web?

    How do I set the HELP menu to use Indesign's local HELP files on the hard drive and not the web?
    CS 5.0 launches the internet browser.  > TO SLOW I DONT WANT THIS.
    CS 3.0 uses the local help files > I WANT THIS FOR 5.0.

    You're not speaking to the right forum for your request. Help is a Suite-wide feature and here is the forum where the Help application is discussed, and where the proper Adobe people hang out:
    Community Help Application

Maybe you are looking for

  • How to log the user and group setup from weblogic console

    If I use the file realm to setup my acls, does it possible to log these action? Our customer ask us must to log which user or group you added, deleted. Thanks and Best Regards, Tom Hsu ³\®aºa (Tom Hsu) Project Manager Banking Solution Dept. Bull Info

  • WRT54GC Wireless Issue

    I've had this router for about 18 months and it's always worked fine until recently. Whenever I try connecting a wireless device, the router loses it's internet connection. The internet light on the router goes off and all of the devices on the netwo

  • Status Selection Profile

    Hello, Is it possible to create a selection profile for DLFL orders in Order Information System ? I agree marking the deletion flag in COOIS would do, but for the CJI3 report, I want to include DLFL orders as well.

  • How do I forward an email in IOS7

    How do I forward an email in IOS7?

  • HT1218 my airport is not available or not working.

    I don't know what to do. My airport is not working. so i can't use my wifi. May be you can help me. I don't know if i delete something; but i saw my airport logo in my utilities also. thank you.