Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1023423
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T11:37:00+00:00 2026-05-16T11:37:00+00:00

In hibernate, there are many information about set cascade to all, delete and so

  • 0

In hibernate, there are many information about set cascade to “all, delete” and so on,
but I want to know the effect of set cascade to “none”

now I have a class Parent, and it’s child-class Child,

class Parent{
List<Child> childs;
 ....}

and in the file parent.hbm.xml(I omitted other content)

   <class name="Parent" table="parent" >
 <bag name="childs"  lazy="false" table="parenthaschildsTable" cascade="none">
    <key>
         <column name="parentId" not-null="true"/>
    </key>
    <one-to-many  class="Child">
         <column name="childId" not-null="true"/>
    </one-to-many>
   </bag>

when save the parent, I don’t want to cascade update his childs, so I set cascade="none".
my question is :
I set the cascade is “none”, if I add a child#1 to parent, then I save the parent, can hibernate insert a new record to the table parenthaschildsTable, but not cascade the Child?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T11:37:01+00:00Added an answer on May 16, 2026 at 11:37 am

    I set the cascade is “none”, if I add a child#1 to parent, then I save the parent, can hibernate insert a new record to the table parenthaschildsTable, but not cascade the Child?

    You changed the parent (by modifying a collection) so Hibernate will insert a record in the join table to reflect that on save (when should it happen else?). And of course this will only succeed if the child has already an identifier value assigned. But why don’t you try it actually?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know that there is many question about it but i can not find
I want to interrupt some specific grails domain class events(read,write,delete,update).Is there any hibernate eventlistner
There are many topics on abstract mapping in Hibernate, but I couldn't find something
I am using Spring with Hibernate in my project.There are many methods written in
I know there are non-standard frameworks such as commons-validator, and hibernate validator. I wanted
I'm migrating from Hibernate to OpenJPA. And there are many entities with annotations like
There are many similar questions, but I couldn't find exactly how to use a
Are there any tools that auto-generate the hibernate POJOs by gathering information from the
Is there a Hibernate configuration (hopefully an annotation on a classes mapped @Column field)
To keep it short and sweet: There is hibernate-commons-annotations 4.1.0-Final and hibernate-annotations 3.5.6-Final. I'm

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.